public static function getInstance($type = self::PSR0) { if (!isset(static::$instances[$type])) { switch ($type) { case self::PSR0: Common::prefixPsr0ClassRequire('Symfony\\Component\\ClassLoader\\ClassLoader'); static::$instances[$type] = new ClassLoader(); break; case self::PSR4: Common::prefixPsr0ClassRequire('Symfony\\Component\\ClassLoader\\Psr4ClassLoader'); static::$instances[$type] = new Psr4ClassLoader(); break; default: throw new \InvalidArgumentException('Invalid type'); } static::$instances[$type]->register(); } return static::$instances[$type]; }
<?php /** * This file is part of the Fedora Autoload package. * * (c) Shawn Iwinski <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Fedora\Autoload; use Zend\Loader\AutoloaderFactory; require_once __DIR__ . '/Common.php'; Common::prefixPsr0ClassRequire('Zend\\Loader\\AutoloaderFactory'); final class Zend { private function __construct() { } public static function factory($options = null) { AutoloaderFactory::factory(array(AutoloaderFactory\STANDARD_AUTOLOADER => $options)); } } if (!Common::isFedoraNamespaceRegistered()) { Zend::factory(array('namespaces' => array('Fedora\\Autoload\\' => __DIR__, 'Fedora\\' => Common::LIB_DIR . '/Fedora'))); Common::setFedoraNamespaceRegistered(); }