N98\Magento\Application\Config::registerCustomAutoloaders PHP Метод

registerCustomAutoloaders() публичный Метод

Adds autoloader prefixes from user's config
public registerCustomAutoloaders ( Composer\Autoload\ClassLoader $autoloader )
$autoloader Composer\Autoload\ClassLoader
    public function registerCustomAutoloaders(ClassLoader $autoloader)
    {
        $mask = '<debug>Registered %s autoloader </debug> <info>%s</info> -> <comment>%s</comment>';
        foreach ($this->getArray('autoloaders') as $prefix => $paths) {
            $paths = (array) $paths;
            $this->debugWriteln(sprintf($mask, self::PSR_0, OutputFormatter::escape($prefix), implode(",", $paths)));
            $autoloader->add($prefix, $paths);
        }
        foreach ($this->getArray('autoloaders_psr4') as $prefix => $paths) {
            $paths = (array) $paths;
            $this->debugWriteln(sprintf($mask, self::PSR_4, OutputFormatter::escape($prefix), implode(",", $paths)));
            $autoloader->addPsr4($prefix, $paths);
        }
    }

Usage Example

Пример #1
0
 /**
  * @param array           $initConfig
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 public function init($initConfig = array(), InputInterface $input = null, OutputInterface $output = null)
 {
     if (!$this->_isInitialized) {
         // Suppress DateTime warnings
         date_default_timezone_set(@date_default_timezone_get());
         $loadExternalConfig = !$this->_checkSkipConfigOption();
         if ($output === null) {
             $output = new NullOutput();
         }
         if (null !== $this->config) {
             throw new UnexpectedValueException(sprintf('Config already initialized'));
         }
         $this->config = $config = new Config($initConfig, $this->isPharMode(), $output);
         $configLoader = $config->getLoader();
         $config->loadPartialConfig($loadExternalConfig);
         $this->detectMagento($input, $output);
         $configLoader->loadStageTwo($this->_magentoRootFolder, $loadExternalConfig, $this->_magerunStopFileFolder);
         $config->load();
         $this->dispatcher = new EventDispatcher();
         $this->setDispatcher($this->dispatcher);
         if ($autoloader = $this->autoloader) {
             /**
              * Include commands shipped by Magento 2 core
              */
             if (!$this->_checkSkipMagento2CoreCommandsOption()) {
                 $this->registerMagentoCoreCommands($output);
             }
             $this->config->registerCustomAutoloaders($autoloader);
             $this->registerEventSubscribers();
             $config->registerCustomCommands($this);
         }
         $this->registerHelpers();
         $this->_isInitialized = true;
     }
 }
All Usage Examples Of N98\Magento\Application\Config::registerCustomAutoloaders