本文整理匯總了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);
}
示例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")) {