当前位置: 首页>>代码示例>>PHP>>正文


PHP ClassLoader::registerLoader方法代码示例

本文整理汇总了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();
     }
 }
开发者ID:johannes85,项目名称:core,代码行数:40,代码来源:Xar.class.php

示例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'))));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:11,代码来源:ClassLoaderTest.class.php

示例3: registerXar

 /**
  * Register XAR
  *
  * @param  io.File $file
  * @return lang.IClassLoader
  */
 protected function registerXar($file)
 {
     return ClassLoader::registerLoader(new ArchiveClassLoader(new Archive($file)));
 }
开发者ID:johannes85,项目名称:core,代码行数:10,代码来源:ClassLoaderTest.class.php

示例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)));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:5,代码来源:IntegrationTest.class.php

示例5: register

 /**
  * Register a loader with the CL
  *
  * @param  lang.IClassLoader $l
  */
 protected function register($l)
 {
     $this->registered[] = ClassLoader::registerLoader($l);
 }
开发者ID:xp-framework,项目名称:core,代码行数:9,代码来源:ModuleLoadingTest.class.php

示例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'))));
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:7,代码来源:ResourcesTest.class.php

示例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'))));
 }
开发者ID:johannes85,项目名称:core,代码行数:10,代码来源:PackageTest.class.php

示例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');
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:6,代码来源:FullyQualifiedTest.class.php


注:本文中的lang\ClassLoader::registerLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。