本文整理汇总了PHP中lang\ClassLoader::registerLoader方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::registerLoader方法的具体用法?PHP ClassLoader::registerLoader怎么用?PHP ClassLoader::registerLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lang\ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::registerLoader方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* Main
*
* Exitcodes used:
* <ul>
* <li>127: Archive referenced in -xar [...] does not exist</li>
* <li>126: No manifest or manifest does not have a main-class</li>
* </ul>
*
* @see http://tldp.org/LDP/abs/html/exitcodes.html
* @param string[] args
* @return int
*/
public static function main(array $args)
{
// Open archive
$f = new File(array_shift($args));
if (!$f->exists()) {
Console::$err->writeLine('*** Cannot find archive ' . $f->getURI());
return 127;
}
// Register class loader
$cl = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive($f)));
if (!$cl->providesResource(self::MANIFEST)) {
Console::$err->writeLine('*** Archive ' . $f->getURI() . ' does not have a manifest');
return 126;
}
// Load manifest
$pr = Properties::fromString($cl->getResource(self::MANIFEST));
if (null === ($class = $pr->readString('archive', 'main-class', null))) {
Console::$err->writeLine('*** Archive ' . $f->getURI() . '\'s manifest does not have a main class');
return 126;
}
// Run main()
try {
return \lang\XPClass::forName($class, $cl)->getMethod('main')->invoke(null, [$args]);
} catch (\lang\reflect\TargetInvocationException $e) {
throw $e->getCause();
}
}
示例2: setUp
/**
* Setup this test. Registeres class loaders deleates for the
* afforementioned XARs
*
*/
public function setUp()
{
$this->libraryLoader = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive(\lang\XPClass::forName(\xp::nameOf(__CLASS__))->getPackage()->getPackage('lib')->getResourceAsStream('three-and-four.xar'))));
$this->brokenLoader = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive(\lang\XPClass::forName(\xp::nameOf(__CLASS__))->getPackage()->getPackage('lib')->getResourceAsStream('broken.xar'))));
$this->containedLoader = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive($this->libraryLoader->getResourceAsStream('contained.xar'))));
}
示例3: registerXar
/**
* Register XAR
*
* @param io.File $file
* @return lang.IClassLoader
*/
protected function registerXar($file)
{
return ClassLoader::registerLoader(new ArchiveClassLoader(new Archive($file)));
}
示例4: registerClientClasses
public static function registerClientClasses()
{
$a = \lang\XPClass::forName(\xp::nameOf(__CLASS__))->getPackage()->getPackage('deploy')->getResourceAsStream('beans.test.CalculatorBean.xar');
self::$clientClassesLoader = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive($a)));
}
示例5: register
/**
* Register a loader with the CL
*
* @param lang.IClassLoader $l
*/
protected function register($l)
{
$this->registered[] = ClassLoader::registerLoader($l);
}
示例6: setUp
/**
* Sets up class loader
*/
public function setUp()
{
$this->cl = \lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive($this->getClass()->getPackage()->getPackage('lib')->getResourceAsStream('three-and-four.xar'))));
}
示例7: setUp
/**
* Setup this test. Registeres class loaders deleates for the
* afforementioned XARs
*
* @return void
*/
public function setUp()
{
$this->libraryLoader = ClassLoader::registerLoader(new ArchiveClassLoader(new Archive((new XPClass(__CLASS__))->getPackage()->getPackage('lib')->getResourceAsStream('three-and-four.xar'))));
}
示例8: __static
static function __static()
{
\lang\ClassLoader::registerLoader(new \lang\archive\ArchiveClassLoader(new Archive(\lang\XPClass::forName(\xp::nameOf(__CLASS__))->getPackage()->getPackage('lib')->getResourceAsStream('fqcns.xar'))));
\lang\XPClass::forName('info.binford6100.Date');
\lang\XPClass::forName('de.thekid.util.ObjectComparator');
}