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


PHP UniversalClassLoader::loadClass方法代码示例

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


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

示例1: 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

示例2: __construct

 public function __construct()
 {
     $this->tmpDir = sys_get_temp_dir() . '/sf2_' . rand(1, 9999);
     if (!is_dir($this->tmpDir)) {
         if (false === @mkdir($this->tmpDir)) {
             die(sprintf('Unable to create a temporary directory (%s)', $this->tmpDir));
         }
     } elseif (!is_writable($this->tmpDir)) {
         die(sprintf('Unable to write in a temporary directory (%s)', $this->tmpDir));
     }
     parent::__construct('env', true);
     require_once __DIR__ . '/FacebookApiException.php';
     $loader = new UniversalClassLoader();
     $loader->loadClass('\\FacebookApiException');
     $loader->register();
 }
开发者ID:tarjei,项目名称:statsdbundle,代码行数:16,代码来源:Kernel.php

示例3: UniversalClassLoader

<?php

use Symfony\Component\ClassLoader\UniversalClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array('Symfony' => array(__DIR__ . '/../vendor/symfony/src', __DIR__ . '/../vendor/bundles'), 'Sensio' => __DIR__ . '/../vendor/bundles', 'JMS' => __DIR__ . '/../vendor/bundles', 'Doctrine\\ODM\\MongoDB' => __DIR__ . '/../vendor/doctrine-mongodb-odm/lib', 'Doctrine\\MongoDB' => __DIR__ . '/../vendor/doctrine-mongodb/lib', 'Doctrine\\Common' => __DIR__ . '/../vendor/doctrine-common/lib', 'Doctrine\\DBAL' => __DIR__ . '/../vendor/doctrine-dbal/lib', 'Doctrine' => __DIR__ . '/../vendor/doctrine/lib', 'Monolog' => __DIR__ . '/../vendor/monolog/src', 'Assetic' => __DIR__ . '/../vendor/assetic/src', 'Metadata' => __DIR__ . '/../vendor/metadata/src', 'FOS' => __DIR__ . '/../vendor/bundles'));
$loader->registerPrefixes(array('Twig_Extensions_' => __DIR__ . '/../vendor/twig-extensions/lib', 'Twig_' => __DIR__ . '/../vendor/twig/lib'));
// intl
if (!function_exists('intl_get_error_code')) {
    require_once __DIR__ . '/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
    $loader->registerPrefixFallbacks(array(__DIR__ . '/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs'));
}
$loader->registerNamespaceFallbacks(array(__DIR__ . '/../src'));
$loader->register();
AnnotationRegistry::registerLoader(function ($class) use($loader) {
    $loader->loadClass($class);
    return class_exists($class, false);
});
AnnotationRegistry::registerFile(__DIR__ . '/../vendor/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php');
AnnotationRegistry::registerFile(__DIR__ . '/../vendor/doctrine-mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php');
// Swiftmailer needs a special autoloader to allow
// the lazy loading of the init file (which is expensive)
require_once __DIR__ . '/../vendor/swiftmailer/lib/classes/Swift.php';
Swift::registerAutoload(__DIR__ . '/../vendor/swiftmailer/lib/swift_init.php');
开发者ID:ntictogolais,项目名称:Habobo,代码行数:24,代码来源:autoload.php


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