Ejemplo n.º 1
0
 /**
  * Removes an autoloader from the stack and from $_registeredAutoloaders
  *
  * @param Mixed $autoloader The autoloader callback
  *
  * @see $_registeredAutoloaders
  * @see spl_autoload_unregister()
  * @return void
  */
 public function removeAutoloader($autoloader)
 {
     parent::removeAutoloader($autoloader);
     $index = \array_search($autoloader, $this->_registeredAutoloaders, true);
     if ($index !== false) {
         unset($this->_registeredAutoloaders[$index]);
     }
 }
Ejemplo n.º 2
0
 /**
  * Creates an AutoloadAPI instance
  *
  * @param String $classname Either AutoloadAPI or AutoloadAPI_Old
  *
  * @see AutoloadAPI_Constructable
  * @see AutoloadAPI_Old_Constructable
  * @return AutoloadAPI
  */
 private function _getAutoloadAPI($classname)
 {
     if (version_compare(PHP_VERSION, "5.2.11", '<')) {
         return AutoloadAPI::getInstance();
     }
     $classname .= "_Constructable";
     return new $classname();
 }
Ejemplo n.º 3
0
 /**
  * Decides which AutoloadAPI is working in your environment
  *
  * For PHP < 5.2.11 an AutoloadAPI_Old is chosen.
  *
  * @see AutoloadAPI_Old
  * @see http://bugs.php.net/44144
  * @return void
  */
 public static function classConstructor()
 {
     self::$_instance = version_compare(PHP_VERSION, "5.2.11", '>=') ? new self() : new AutoloadAPI_Old();
 }
Ejemplo n.º 4
0
 /**
  * Returns all registered Autoloader instances which are doing their jobs
  *
  * @see AutoloadAPI::getRegisteredAutoloaders()
  * @see register()
  * @return Array
  */
 public static function getRegisteredAutoloaders()
 {
     $autoloaders = array();
     $callbacks = AutoloadAPI::getInstance()->getRegisteredAutoloaders();
     foreach ($callbacks as $callback) {
         if (!is_array($callback)) {
             continue;
         }
         //TODO use static:: in PHP 5.3 and remove the other implementations
         if (!$callback[0] instanceof self) {
             continue;
         }
         $autoloaders[] = $callback[0];
     }
     return $autoloaders;
 }
Ejemplo n.º 5
0
 * @author     Markus Malkusch <*****@*****.**>
 * @copyright  2009 - 2010 Markus Malkusch
 * @license    http://php-autoloader.malkusch.de/en/license/ GPL 3
 * @version    SVN: $Id$
 * @link       http://php-autoloader.malkusch.de/en/
 */
namespace malkusch\autoloader;

/**
 * Require the needed class
 */
require_once __DIR__ . '/AutoloadAPI_Old.php';
/**
 * The class constructor is called.
 */
AutoloadAPI::classConstructor();
/**
 * A wrapper for the spl_autoload functions
 *
 * This class implements the singleton pattern. getInstance() returns
 * the propriate class for the PHP environment.
 * That's because in PHP < 5.2.11 spl_autoload_functions() didn't return objects.
 *
 * @category   PHP
 * @package    Autoloader
 * @subpackage AutoloadAPI
 * @author     Markus Malkusch <*****@*****.**>
 * @license    http://php-autoloader.malkusch.de/en/license/ GPL 3
 * @version    Release: 1.12
 * @link       http://php-autoloader.malkusch.de/en/
 * @see        spl_autoload_functions()