當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。