本文整理汇总了PHP中ClassLoader::getLoaders方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::getLoaders方法的具体用法?PHP ClassLoader::getLoaders怎么用?PHP ClassLoader::getLoaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::getLoaders方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main
*
* @param string[] args
* @return int
*/
public static function main(array $args)
{
Console::writeLinef('XP %s { PHP %s & ZE %s } @ %s', xp::version(), phpversion(), zend_version(), php_uname());
Console::writeLine('Copyright (c) 2001-2013 the XP group');
foreach (ClassLoader::getLoaders() as $delegate) {
Console::writeLine($delegate->toString());
}
return 1;
}
示例2: findLoaderFor
/**
* Find first classloader responsible for a given path
*
* @param string path
* @return lang.IClassLoader
*/
protected function findLoaderFor($path)
{
foreach (ClassLoader::getLoaders() as $cl) {
if (0 === strncmp($cl->path, $path, strlen($cl->path))) {
return $cl;
}
}
return NULL;
}
示例3: main
/**
* Main
*
* @param string[] args
*/
public static function main(array $args)
{
if (sizeof($args) < 1 || '' == $args[0]) {
Console::$err->writeLine('*** No class or package name given');
return 2;
}
// Check whether a file, class or a package directory or name is given
$cl = ClassLoader::getDefault();
if (strstr($args[0], xp::CLASS_FILE_EXT)) {
$class = self::findClassBy(new File($args[0]));
} else {
if ($cl->providesClass($args[0])) {
$class = XPClass::forName($args[0], $cl);
} else {
if (strcspn($args[0], '\\/') < strlen($args[0])) {
$package = self::findPackageBy(new Folder($args[0]));
} else {
$package = $args[0];
}
$provided = FALSE;
foreach (ClassLoader::getLoaders() as $loader) {
if (!$loader->providesPackage($package)) {
continue;
}
Console::writeLine('@', $loader);
$provided = TRUE;
}
if ($provided) {
self::printPackage(Package::forName($package));
return 0;
}
// Not found
Console::$err->writeLine('*** Failed to locate either a class or a package named "', $args[0], '", tried all of {');
foreach (ClassLoader::getLoaders() as $loader) {
Console::$err->writeLine(' ', $loader);
}
Console::$err->writeLine('}');
return 1;
}
}
Console::writeLine('@', $class->getClassLoader());
if ($class->isInterface()) {
self::printInterface($class);
} else {
if ($class->isEnum()) {
self::printEnum($class);
} else {
self::printClass($class);
}
}
return 0;
}
示例4: after_via_inspect
public function after_via_inspect()
{
$loader = $this->track(ClassLoader::registerPath('.', NULL));
$loaders = ClassLoader::getLoaders();
$this->assertEquals($loader, $loaders[sizeof($loaders) - 1]);
}