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


PHP ClassLoader::canLoadClass方法代码示例

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


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

示例1: testClassLoader

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

示例2:

    exit;
}
/**
 * Check for the correct DoctrineORM version. We only support Doctrine 2.1.0 or higher.
 */
if (\Doctrine\ORM\Version::compare("2.2.0") > 0) {
    $versionInvalidMessage = "DoctrineORM is installed, but needs to be at Version 2.2.0 or higher. ";
    $versionInvalidMessage .= "Please run pear upgrade-all to bring your packages up-to-date.";
    echo json_encode(array("error" => true, "message" => $versionInvalidMessage));
    exit;
}
/**
 * Check for the Symfony YAML component. This component is required to parse YAML files and is used during installation
 * of footprints.
 */
if (!$doctrineClassLoader->canLoadClass("Doctrine\\Symfony\\Component\\Yaml\\Yaml")) {
    $yamlErrorMessage = "The YAML component of symfony is not installed. This component is required; please install ";
    $yamlErrorMessage .= "it using:<br/><br/>";
    $yamlErrorMessage .= "<code>pear install pear.doctrine-project.org/DoctrineSymfonyYaml</code><br/><br/>";
    $yamlErrorMessage .= "If you are getting the error:<br/><br/><code>doctrine/DoctrineSymfonyYaml is already ";
    $yamlErrorMessage .= "installed and is the same as the released version</code><br/><br/>";
    $yamlErrorMessage .= "please REINSTALL the package using<br/><br/><code>pear uninstall ";
    $yamlErrorMessage .= "doctrine/DoctrineSymfonyYaml<br/>pear install doctrine/DoctrineSymfonyYaml</code>";
    echo json_encode(array("error" => true, "message" => $yamlErrorMessage));
    exit;
}
/**
 * Check for the Symfony Console component.
 * of footprints.
 */
if (!$doctrineClassLoader->canLoadClass("Doctrine\\Symfony\\Component\\Console\\Command\\Command")) {
开发者ID:JohnEffland,项目名称:PartKeepr,代码行数:31,代码来源:check-doctrine.php


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