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


PHP ClassLoader::loadClass方法代码示例

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


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

示例1: testClassLoader

 public function testClassLoader()
 {
     $classLoader = new ClassLoader('ClassLoaderTest');
     $classLoader->setIncludePath(__DIR__);
     $classLoader->setFileExtension('.class.php');
     $classLoader->setNamespaceSeparator('_');
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassA'), true);
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassB'), true);
     $this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassC'), true);
 }
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:10,代码来源:ClassLoaderTest.php

示例2: testClassLoaderCheckFileExists

 public function testClassLoaderCheckFileExists()
 {
     $classLoader = new \Doctrine\Common\ClassLoader();
     $classLoader->setBasePath('ClassLoaderTest', __DIR__);
     $classLoader->setCheckFileExists(true);
     // This would return a fatal error without check file exists true
     $this->assertEquals($classLoader->loadClass('SomeInvalidClass'), false);
 }
开发者ID:jackbravo,项目名称:doctrine,代码行数:8,代码来源:ClassLoaderTest.php

示例3: testMultipleAutoloadRequestsWillProduceSameResult

 public function testMultipleAutoloadRequestsWillProduceSameResult()
 {
     $classLoader = new ClassLoader();
     $classLoader->setIncludePath(__DIR__);
     $classLoader->setFileExtension('.class.php');
     $classLoader->setNamespaceSeparator('_');
     $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA'));
     $this->assertTrue($classLoader->loadClass('ClassLoaderTest_ClassA'));
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:9,代码来源:ClassLoaderTest.php

示例4: ClassLoader

<?php

require_once __DIR__ . '/../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
require_once __DIR__ . '/../lib/vendor/doctrine-common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php';
use Doctrine\Common\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
$classLoader = new ClassLoader('Doctrine\\Tests', __DIR__ . '/../tests');
$classLoader->register();
$classLoader = new ClassLoader('Doctrine\\ODM', __DIR__ . '/../lib');
$classLoader->register();
$classLoader = new ClassLoader('Doctrine', __DIR__ . '/../lib/vendor/doctrine-common/lib');
$classLoader->register();
$classLoader = new ClassLoader('Documents', __DIR__);
$classLoader->register();
$classLoader = new ClassLoader('PHPCR\\Util', __DIR__ . '/../lib/vendor/phpcr-utils/src');
$classLoader->register();
$classLoader = new ClassLoader('PHPCR', __DIR__ . '/../lib/vendor/phpcr/src');
$classLoader->register();
$classLoader = new ClassLoader('Symfony\\Component\\Console', __DIR__ . '/../lib/vendor/jackalope/lib/phpcr-utils/lib/vendor');
$classLoader->register();
$classLoader = new ClassLoader('Symfony', __DIR__ . '/../lib/vendor');
$classLoader->register();
AnnotationRegistry::registerLoader(function ($class) use($classLoader) {
    $classLoader->loadClass($class);
    return class_exists($class, false);
});
AnnotationRegistry::registerFile(__DIR__ . '/../lib/Doctrine/ODM/PHPCR/Mapping/Annotations/DoctrineAnnotations.php');
开发者ID:nicam,项目名称:phpcr-odm,代码行数:27,代码来源:bootstrap.php


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