当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassLoader\UniversalClassLoader类代码示例

本文整理汇总了PHP中Symfony\Component\ClassLoader\UniversalClassLoader的典型用法代码示例。如果您正苦于以下问题:PHP UniversalClassLoader类的具体用法?PHP UniversalClassLoader怎么用?PHP UniversalClassLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了UniversalClassLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sf2AutoLoad

function sf2AutoLoad()
{
    $loader = new UniversalClassLoader();
    $loader->registerNamespaces(array('Sf2Plugins' => __DIR__ . '/src'));
    $loader->registerPrefixes(array('Twig_Extensions_' => __DIR__ . '/lib/Twig-extensions/lib', 'Twig_' => __DIR__ . '/lib/Twig/lib'));
    $loader->register();
}
开发者ID:nunnun,项目名称:wp-sf2,代码行数:7,代码来源:wp-sf2.php

示例2: earlyInitialize

 public static function earlyInitialize()
 {
     $classLoader = new UniversalClassLoader();
     $classLoader->registerNamespace('Stagehand\\TestRunner', array(__DIR__ . '/../../..', __DIR__ . '/../../../../src/Stagehand/TestRunner/Resources/examples'));
     $classLoader->registerPrefix('Stagehand_TestRunner_', __DIR__ . '/../../../../src/Stagehand/TestRunner/Resources/examples');
     $classLoader->register();
 }
开发者ID:ngyuki,项目名称:stagehand-testrunner,代码行数:7,代码来源:TestEnvironment.php

示例3: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection($app['routes']);
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () {
         return new ControllerResolver();
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
 }
开发者ID:NoDiskInDriveA,项目名称:Silex,代码行数:31,代码来源:Application.php

示例4: testLegacyHandleClassNotFound

 /**
  * @group legacy
  */
 public function testLegacyHandleClassNotFound()
 {
     $prefixes = array('Symfony\\Component\\Debug\\Exception\\' => realpath(__DIR__ . '/../../Exception'));
     $symfonyUniversalClassLoader = new SymfonyUniversalClassLoader();
     $symfonyUniversalClassLoader->registerPrefixes($prefixes);
     $this->testHandleClassNotFound(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException\"?", array($symfonyUniversalClassLoader, 'loadClass'));
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:10,代码来源:ClassNotFoundFatalErrorHandlerTest.php

示例5: testLoadClassPrefixCollision

 /**
  * @dataProvider getLoadClassPrefixCollisionTests
  */
 public function testLoadClassPrefixCollision($prefixes, $className, $message)
 {
     $loader = new UniversalClassLoader();
     $loader->registerPrefixes($prefixes);
     $loader->loadClass($className);
     $this->assertTrue(class_exists($className), $message);
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:10,代码来源:UniversalClassLoaderTest.php

示例6: __construct

 /**
  * Constructor
  *
  * @param KernelInterface $kernel
  */
 public function __construct(KernelInterface $kernel)
 {
     // register email address proxy class loader
     $loader = new UniversalClassLoader();
     $loader->registerNamespaces([self::ENTITY_PROXY_NAMESPACE => $kernel->getCacheDir() . DIRECTORY_SEPARATOR . self::CACHED_ENTITIES_DIR_NAME]);
     $loader->register();
 }
开发者ID:xamin123,项目名称:platform,代码行数:12,代码来源:OroEmailBundle.php

示例7: registerBundles

 public function registerBundles()
 {
     $loader = new UniversalClassLoader();
     $loader->registerNamespace('SomeProject\\', array(__DIR__));
     $loader->registerNamespace('SomeAnotherProject\\', array(__DIR__));
     $loader->register();
     return array(new \SomeProject\Bundle\SomeBundle\SomeBundle(), new \SomeAnotherProject\Bundle\SomeAnotherBundle\SomeAnotherBundle());
 }
开发者ID:Maksold,项目名称:platform,代码行数:8,代码来源:TestKernel.php

示例8: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
开发者ID:nubeiro,项目名称:LogMonitor,代码行数:14,代码来源:LogSpyApp.php

示例9: provideLegacyClassNotFoundData

 public function provideLegacyClassNotFoundData()
 {
     $prefixes = array('Symfony\\Component\\Debug\\Exception\\' => realpath(__DIR__ . '/../../Exception'));
     $symfonyAutoloader = new SymfonyClassLoader();
     $symfonyAutoloader->addPrefixes($prefixes);
     $symfonyUniversalClassLoader = new SymfonyUniversalClassLoader();
     $symfonyUniversalClassLoader->registerPrefixes($prefixes);
     return array(array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException\"?", array($symfonyAutoloader, 'loadClass')), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for \"Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException\"?", array($symfonyUniversalClassLoader, 'loadClass')), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), "Attempted to load class \"UndefinedFunctionException\" from namespace \"Foo\\Bar\".\nDid you forget a \"use\" statement for another namespace?", function ($className) {
         /* do nothing here */
     }));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:11,代码来源:ClassNotFoundFatalErrorHandlerTest.php

示例10: provideClassNotFoundData

 public function provideClassNotFoundData()
 {
     $prefixes = array('Symfony\\Component\\Debug\\Exception\\' => realpath(__DIR__ . '/../../Exception'));
     $symfonyAutoloader = new SymfonyClassLoader();
     $symfonyAutoloader->addPrefixes($prefixes);
     $symfonyUniversalClassLoader = new SymfonyUniversalClassLoader();
     $symfonyUniversalClassLoader->registerPrefixes($prefixes);
     return array(array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'WhizBangFactory\' not found'), 'Attempted to load class "WhizBangFactory" from the global namespace in foo.php line 12. Did you forget a use statement for this class?'), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\WhizBangFactory\' not found'), 'Attempted to load class "WhizBangFactory" from namespace "Foo\\Bar" in foo.php line 12. Do you need to "use" it from another namespace?'), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from the global namespace in foo.php line 12. Did you forget a use statement for this class? Perhaps you need to add a use statement for one of the following: Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException.'), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'PEARClass\' not found'), 'Attempted to load class "PEARClass" from the global namespace in foo.php line 12. Did you forget a use statement for this class? Perhaps you need to add a use statement for one of the following: Symfony_Component_Debug_Tests_Fixtures_PEARClass.'), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from namespace "Foo\\Bar" in foo.php line 12. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException.'), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from namespace "Foo\\Bar" in foo.php line 12. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException.', array($symfonyAutoloader, 'loadClass')), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from namespace "Foo\\Bar" in foo.php line 12. Do you need to "use" it from another namespace? Perhaps you need to add a use statement for one of the following: Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException.', array($symfonyUniversalClassLoader, 'loadClass')), array(array('type' => 1, 'line' => 12, 'file' => 'foo.php', 'message' => 'Class \'Foo\\Bar\\UndefinedFunctionException\' not found'), 'Attempted to load class "UndefinedFunctionException" from namespace "Foo\\Bar" in foo.php line 12. Do you need to "use" it from another namespace?', function ($className) {
         /* do nothing here */
     }));
 }
开发者ID:roberto-sanchez,项目名称:gardencentral,代码行数:11,代码来源:ClassNotFoundFatalErrorHandlerTest.php

示例11: __construct

 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['basedir'] = __DIR__ . '/../../../..';
     $this->register_twig();
     $this->register_markdown();
 }
开发者ID:nacmartin,项目名称:Cazalla,代码行数:12,代码来源:Application.php

示例12: checkComposer

 /**
  * Check for composer in Namespace
  * and include via phar if possible
  */
 public static function checkComposer($pathToComposer = null)
 {
     if (!class_exists("Composer\\Factory")) {
         if (false === ($pathToComposer = self::whichComposer($pathToComposer))) {
             throw new \RuntimeException("Could not find composer.phar");
         }
         \Phar::loadPhar($pathToComposer, 'composer.phar');
         $loader = new UniversalClassLoader();
         $namespaces = (include "phar://composer.phar/vendor/composer/autoload_namespaces.php");
         $loader->registerNamespaces(array_merge(array('Composer' => "phar://composer.phar/src/"), $namespaces));
         $loader->register(true);
     }
 }
开发者ID:Viduc,项目名称:tiremoidlaold,代码行数:17,代码来源:ComposerAdapter.php

示例13: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $app = $this;
     $this['autoloader'] = $this->share(function () {
         $loader = new UniversalClassLoader();
         $loader->register();
         return $loader;
     });
     $this['routes'] = $this->share(function () {
         return new RouteCollection();
     });
     $this['controllers'] = $this->share(function () use($app) {
         return new ControllerCollection();
     });
     $this['exception_handler'] = $this->share(function () {
         return new ExceptionHandler();
     });
     $this['dispatcher'] = $this->share(function () use($app) {
         $dispatcher = new EventDispatcher();
         $dispatcher->addSubscriber($app);
         $urlMatcher = new LazyUrlMatcher(function () use($app) {
             return $app['url_matcher'];
         });
         $dispatcher->addSubscriber(new RouterListener($urlMatcher));
         return $dispatcher;
     });
     $this['resolver'] = $this->share(function () use($app) {
         return new ControllerResolver($app);
     });
     $this['kernel'] = $this->share(function () use($app) {
         return new HttpKernel($app['dispatcher'], $app['resolver']);
     });
     $this['request_context'] = $this->share(function () use($app) {
         $context = new RequestContext();
         $context->setHttpPort($app['request.http_port']);
         $context->setHttpsPort($app['request.https_port']);
         return $context;
     });
     $this['url_matcher'] = $this->share(function () use($app) {
         return new RedirectableUrlMatcher($app['routes'], $app['request_context']);
     });
     $this['request.default_locale'] = 'en';
     $this['request'] = function () {
         throw new \RuntimeException('Accessed request service outside of request scope. Try moving that call to a before handler or controller.');
     };
     $this['request.http_port'] = 80;
     $this['request.https_port'] = 443;
     $this['debug'] = false;
     $this['charset'] = 'UTF-8';
 }
开发者ID:noels,项目名称:Silex,代码行数:53,代码来源:Application.php

示例14: configureClassLoader

 protected function configureClassLoader()
 {
     if (!class_exists('Stagehand\\TestRunner\\Core\\Environment')) {
         if (!class_exists('Symfony\\Component\\ClassLoader\\UniversalClassLoader', false)) {
             require_once 'Symfony/Component/ClassLoader/UniversalClassLoader.php';
         }
         $includePaths = explode(PATH_SEPARATOR, get_include_path());
         $classLoader = new UniversalClassLoader();
         foreach (self::$namespaces as $namespace) {
             $classLoader->registerNamespace($namespace, $includePaths);
         }
         $classLoader->register();
     }
 }
开发者ID:ngyuki,项目名称:stagehand-testrunner,代码行数:14,代码来源:Bootstrap.php

示例15: initialize

 /**
  * Initialise.
  *
  * Runs at plugin init time.
  *
  * @return void
  */
 public function initialize(GenericEvent $event)
 {
     // register namespace
     // Because the standard kernel classloader already has Doctrine registered as a namespace
     // we have to add a new loader onto the spl stack.
     $autoloader = new UniversalClassLoader();
     $autoloader->register();
     $autoloader->registerNamespaces(array('DoctrineProxy' => 'ztemp/doctrinemodels'));
     $container = $event->getDispatcher()->getContainer();
     $config = $GLOBALS['ZConfig']['DBInfo']['databases']['default'];
     $dbConfig = array('host' => $config['host'], 'user' => $config['user'], 'password' => $config['password'], 'dbname' => $config['dbname'], 'driver' => 'pdo_' . $config['dbdriver']);
     $r = new \ReflectionClass('Doctrine\\Common\\Cache\\' . $container['dbcache.type'] . 'Cache');
     $dbCache = $r->newInstance();
     $ORMConfig = new \Doctrine\ORM\Configuration();
     $container->set('doctrine.configuration', $ORMConfig);
     $ORMConfig->setMetadataCacheImpl($dbCache);
     // create proxy cache dir
     \CacheUtil::createLocalDir('doctrinemodels');
     // setup annotations base
     include_once \ZLOADER_PATH . '/../vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php';
     // setup annotation reader
     $reader = new \Doctrine\Common\Annotations\AnnotationReader();
     $cacheReader = new \Doctrine\Common\Annotations\CachedReader($reader, new \Doctrine\Common\Cache\ArrayCache());
     $container->set('doctrine.annotationreader', $cacheReader);
     // setup annotation driver
     $annotationDriver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($cacheReader);
     $container->set('doctrine.annotationdriver', $annotationDriver);
     // setup driver chains
     $driverChain = new \Doctrine\ORM\Mapping\Driver\DriverChain();
     $container->set('doctrine.driverchain', $driverChain);
     // configure Doctrine ORM
     $ORMConfig->setMetadataDriverImpl($annotationDriver);
     $ORMConfig->setQueryCacheImpl($dbCache);
     $ORMConfig->setProxyDir(\CacheUtil::getLocalDir('doctrinemodels'));
     $ORMConfig->setProxyNamespace('DoctrineProxy');
     if (isset($container['log.enabled']) && $container['log.enabled']) {
         $ORMConfig->setSQLLogger(new \Zikula\Core\Doctrine\Logger\ZikulaSqlLogger());
     }
     // setup doctrine eventmanager
     $dispatcher = new \Doctrine\Common\EventManager();
     $container->set('doctrine.eventmanager', $dispatcher);
     // setup MySQL specific listener (storage engine and encoding)
     if ($config['dbdriver'] == 'mysql') {
         $mysqlSessionInit = new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit($config['charset']);
         $dispatcher->addEventSubscriber($mysqlSessionInit);
     }
     // setup the doctrine entitymanager
     $entityManager = \Doctrine\ORM\EntityManager::create($dbConfig, $ORMConfig, $dispatcher);
     $container->set('doctrine.entitymanager', $entityManager);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:57,代码来源:DoctrineListener.php


注:本文中的Symfony\Component\ClassLoader\UniversalClassLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。