本文整理汇总了PHP中XPClass::getClassLoader方法的典型用法代码示例。如果您正苦于以下问题:PHP XPClass::getClassLoader方法的具体用法?PHP XPClass::getClassLoader怎么用?PHP XPClass::getClassLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XPClass
的用法示例。
在下文中一共展示了XPClass::getClassLoader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uriFor
/**
* Tries to get class uri via reflection
*
* @param lang.XPClass class The class to return the URI for
* @return string
*/
private function uriFor(XPClass $class)
{
try {
$Urimethod = $class->getClassLoader()->getClass()->getMethod('classURI');
$Urimethod->setAccessible(TRUE);
return $Urimethod->invoke($class->getClassLoader(), $class->getName());
} catch (Exception $ignored) {
return $class->getClassName();
}
}
示例2: main
/**
* Main
*
* @param string[] $args
* @return int
*/
public static function main(array $args)
{
$command = null;
if (empty($args)) {
$class = new XPClass(self::class);
$source = $class->getClassLoader();
$markdown = $class->getComment();
} else {
if ('@' === $args[0][0]) {
$resource = substr($args[0], 1);
if (null === ($source = ClassLoader::getDefault()->findResource($resource))) {
Console::$err->writeLine('No help topic named ', $resource);
return 2;
}
$markdown = $source->getResource($resource);
} else {
$class = $args[0];
if (null === ($source = ClassLoader::getDefault()->findClass($class))) {
Console::$err->writeLine('No class named ', $class);
return 2;
}
$markdown = $source->loadClass($class)->getComment();
}
}
self::render(Console::$out, $markdown, $source);
return 1;
}
示例3: forClass
/**
* Get instance for class
*
* @param lang.XPClass class
* @return remote.server.BeanContainer
*/
public static function forClass(XPClass $class)
{
$bc = new self();
$bc->instancePool = new Vector();
$bc->poolClass = $class;
// Fetch class' classloader to check for resources configured
// for the bean.
$cl = $class->getClassLoader();
// Try loading the well known resources, and remember if it exists
$bc->configuration['log.ini'] = $cl->providesResource('etc/log.ini');
$bc->configuration['database.ini'] = $cl->providesResource('etc/log.ini');
$bc->configuration['cl'] = $cl;
return $bc;
}