From 07326efbe2b77ca77e569718ae8c618add359d32 Mon Sep 17 00:00:00 2001 From: Jakub Turek Date: Sun, 7 Sep 2014 10:49:50 +0200 Subject: [PATCH] Remove old Autoload class --- Mage/Autoload.php | 72 ----------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 Mage/Autoload.php diff --git a/Mage/Autoload.php b/Mage/Autoload.php deleted file mode 100644 index 474aa0c..0000000 --- a/Mage/Autoload.php +++ /dev/null @@ -1,72 +0,0 @@ - -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ - -namespace Mage; - -/** - * Magallanes custom Autoload for BuiltIn and Userspace Commands and Tasks. - * - * @author Andrés Montañez - */ -class Autoload -{ - /** - * Autoload a Class by it's Class Name - * @param string $className - * @return boolean - */ - public function autoLoad($className) - { - $className = ltrim($className, '/'); - $postfix = '/' . str_replace(array('_', '\\'), '/', $className . '.php'); - - // Change BaseDir according to Namespace - if (strpos($className, 'Task\\') === 0) { - $baseDir = getcwd() . '/.mage/tasks'; - $postfix = substr($postfix, 5); - - } else if (strpos($className, 'Command\\') === 0) { - $baseDir = getcwd() . '/.mage/commands'; - $postfix = substr($postfix, 8); - - } else { - $baseDir = dirname(dirname(__FILE__)); - } - - //Try to load a normal Mage class (or Task). Think that Mage component is compiled to .phar - $classFileWithinPhar = $baseDir . $postfix; - if ($this->isReadable($classFileWithinPhar)) { - /** @noinspection PhpIncludeInspection */ - require_once $classFileWithinPhar; - return true; - } - - //Try to load a custom Task or Class. Notice that the path is absolute to CWD - $classFileOutsidePhar = getcwd() . '/.mage/tasks' . $postfix; - if ($this->isReadable($classFileOutsidePhar)) { - /** @noinspection PhpIncludeInspection */ - require_once $classFileOutsidePhar; - return true; - } - - return false; - } - - /** - * Checks if a file can be read. - * @param string $filePath - * @return boolean - */ - public function isReadable($filePath) - { - return is_readable($filePath); - } - -}