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


PHP ClassLoader::register方法代码示例

本文整理汇总了PHP中Composer\Autoload\ClassLoader::register方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::register方法的具体用法?PHP ClassLoader::register怎么用?PHP ClassLoader::register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Autoload\ClassLoader的用法示例。


在下文中一共展示了ClassLoader::register方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerLoader

 private function registerLoader()
 {
     $package = $this->composer->getPackage();
     $generator = $this->composer->getAutoloadGenerator();
     $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
     $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
     $map = $generator->parseAutoloads($packageMap, $package);
     $this->loader = $generator->createLoader($map);
     $this->loader->register();
 }
开发者ID:helhum,项目名称:typo3-console-plugin,代码行数:10,代码来源:ScriptDispatcher.php

示例2: load

 /**
  * Load bundle
  *
  * @param BundleInterface $bundle
  *
  * @throws MissingBundleException
  */
 public static function load(BundleInterface $bundle)
 {
     if (is_dir($bundle->getPath())) {
         self::$bundlesLoaded[$bundle->getName()] = ['namespace' => $bundle->getNamespace(), 'path' => $bundle->getPath()];
         if (!self::$classLoader) {
             self::$classLoader = new ClassLoader();
         }
         self::$classLoader->addPsr4($bundle->getNamespace(), $bundle->getPath());
         self::$classLoader->register();
     } else {
         throw new MissingBundleException(sprintf('Bundle "%s" could not be found.', $bundle->getName()));
     }
 }
开发者ID:radphp,项目名称:core,代码行数:20,代码来源:Bundles.php

示例3: autoload

 /**
  * Autoloads all registered extension files with an instance of the app.
  *
  * @return void
  **/
 public function autoload($app)
 {
     $loader = new ClassLoader();
     $mapfile = $this->basefolder . '/vendor/composer/autoload_psr4.php';
     if (is_readable($mapfile)) {
         $map = (require $mapfile);
         foreach ($map as $namespace => $path) {
             $loader->setPsr4($namespace, $path);
         }
         $mapfile = $this->basefolder . '/vendor/composer/autoload_classmap.php';
         if (is_readable($mapfile)) {
             $map = (require $mapfile);
             $loader->addClassMap($map);
         }
         $loader->register();
     }
     $filepath = $this->basefolder . '/vendor/composer/autoload_files.php';
     if (is_readable($filepath)) {
         $files = (include $filepath);
         foreach ($files as $file) {
             try {
                 if (is_readable($file)) {
                     require $file;
                 }
             } catch (\Exception $e) {
                 $this->logInitFailure('Error importing extension class', $file, $e, Logger::ERROR);
             }
         }
     }
 }
开发者ID:ClemsB,项目名称:bolt,代码行数:35,代码来源:Extensions.php

示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     $classLoader = new ClassLoader();
     $classLoader->addPsr4('App\\', __DIR__ . '/Fixtures/src/App');
     $classLoader->addPsr4('Test\\', __DIR__ . '/Fixtures/src/Test');
     $classLoader->register();
 }
开发者ID:radphp,项目名称:radphp,代码行数:7,代码来源:EtcTest.php

示例5: __construct

 /** {@inheritdoc} */
 public function __construct()
 {
     parent::__construct();
     $this->directory = WT_MODULES_DIR . $this->getName();
     // register the namespaces
     $loader = new ClassLoader();
     $loader->addPsr4('JustCarmen\\WebtreesAddOns\\FancyTreeviewPdf\\', $this->directory . '/app');
     $loader->register();
 }
开发者ID:JustCarmen,项目名称:fancy_treeview_pdf,代码行数:10,代码来源:module.php

示例6: registerLoader

 /**
  * Register classloader for extension
  *
  * @return \Composer\Autoload\ClassLoader
  */
 protected function registerLoader()
 {
     $classpath = __DIR__;
     $nsprefix = __NAMESPACE__ . '\\';
     $loader = new ClassLoader();
     $loader->addPsr4($nsprefix, $classpath);
     $loader->register();
     return $loader;
 }
开发者ID:Hoplite-Software,项目名称:observatory,代码行数:14,代码来源:ExtensionHelper.php

示例7: __construct

 public function __construct()
 {
     parent::__construct('fancy_research_links');
     $this->directory = WT_MODULES_DIR . $this->getName();
     // register the namespace
     $loader = new ClassLoader();
     $loader->addPsr4('JustCarmen\\WebtreesAddOns\\FancyResearchLinks\\', WT_MODULES_DIR . $this->getName() . '/app');
     $loader->register();
 }
开发者ID:bschwede,项目名称:fancy_research_links,代码行数:9,代码来源:module.php

示例8: __construct

 public function __construct()
 {
     parent::__construct('modulename');
     $this->directory = WT_MODULES_DIR . $this->getName();
     $this->action = Filter::get('mod_action');
     // register the namespaces
     $loader = new ClassLoader();
     $loader->addPsr4('vendor\\WebtreesModules\\modulename\\', $this->directory);
     $loader->register();
 }
开发者ID:bmhm,项目名称:webtrees-module-skeleton,代码行数:10,代码来源:module.php

示例9: setUp

 protected function setUp()
 {
     $filesystem = new Filesystem();
     $filesystem->remove(__DIR__ . '/Fixtures/tmp');
     $filesystem->mirror(__DIR__ . '/Fixtures/template', __DIR__ . '/Fixtures/tmp');
     $loader = new ClassLoader();
     $loader->addPsr4('Fixtures\\Maba\\Bundle\\', __DIR__ . '/Fixtures/tmp/src');
     $loader->addPsr4('Fixtures\\Maba\\', __DIR__ . '/Fixtures/tmp/app');
     $loader->register(true);
     static::bootKernel();
 }
开发者ID:mariusbalcytis,项目名称:webpack-migration-bundle,代码行数:11,代码来源:FunctionalTest.php

示例10: initialize

 public static function initialize(ClassLoader $autoloader = null)
 {
     if (null === self::$autoloader) {
         if (null === $autoloader) {
             $autoloader = new ClassLoader();
             $autoloader->register();
         }
         return self::$autoloader = $autoloader;
     }
     throw new \RuntimeException('Already initialized');
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:11,代码来源:ZikulaAutoload.php

示例11: __construct

 /** {@inheritdoc} */
 public function __construct()
 {
     parent::__construct('fancy_treeview');
     $this->tree = $this->tree();
     $this->tree_id = $this->tree->getTreeId();
     $this->directory = WT_MODULES_DIR . $this->getName();
     $this->action = Filter::get('mod_action');
     // register the namespaces
     $loader = new ClassLoader();
     $loader->addPsr4('JustCarmen\\WebtreesAddOns\\FancyTreeview\\', $this->directory . '/src');
     $loader->register();
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:13,代码来源:module.php

示例12: registerClassMaps

 public function registerClassMaps($classMap)
 {
     if (!$classMap) {
         return;
     }
     if (!is_array($classMap)) {
         $classMap = [$classMap];
     }
     $loader = new ClassLoader();
     $loader->addClassMap($classMap);
     $loader->register(true);
 }
开发者ID:pckg,项目名称:framework,代码行数:12,代码来源:Registrator.php

示例13: Container

 function __construct(array $testSuites = [])
 {
     $this->container = new Container();
     $this->dispatcher = new Dispatcher();
     $this->parameters = new ArrayCache();
     $this->filesystem = new Filesystem();
     $this->configs = new Config();
     $this->classLoader = new ClassLoader();
     $this->report = new Report();
     $this->testSuites = $testSuites;
     $this->initialize();
     $this->classLoader->register();
     static::$instance = $this;
 }
开发者ID:slince,项目名称:mechanic,代码行数:14,代码来源:Mechanic.php

示例14: register

 /**
  * Installs this class loader on the SPL autoload stack.
  *
  * @param bool $throw   If register should throw an exception or not
  * @param bool $prepend If register should prepend
  *
  * @return void
  */
 public function register($throw = true, $prepend = false)
 {
     // register the class loader instance
     parent::register($prepend);
     // require the files registered with composer (e. g. Swift Mailer)
     foreach ($this->directories as $directory) {
         if (file_exists($directory . '/composer/autoload_files.php')) {
             $includeFiles = (require $directory . '/composer/autoload_files.php');
             foreach ($includeFiles as $file) {
                 require_once $file;
             }
         }
     }
 }
开发者ID:jinchunguang,项目名称:appserver,代码行数:22,代码来源:ComposerClassLoader.php

示例15: scan

 /**
  * Scan plugin folder and load plugins
  *
  * @access public
  */
 public function scan()
 {
     if (file_exists(PLUGINS_DIR)) {
         $loader = new ClassLoader();
         $loader->addPsr4('Kanboard\\Plugin\\', PLUGINS_DIR);
         $loader->register();
         $dir = new DirectoryIterator(PLUGINS_DIR);
         foreach ($dir as $fileInfo) {
             if ($fileInfo->isDir() && substr($fileInfo->getFilename(), 0, 1) !== '.') {
                 $pluginName = $fileInfo->getFilename();
                 $this->loadSchema($pluginName);
                 $this->initializePlugin($this->loadPlugin($pluginName));
             }
         }
     }
 }
开发者ID:rammstein4o,项目名称:kanboard,代码行数:21,代码来源:Loader.php


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