N98\Magento\Application::init PHP Method

init() public method

public init ( array $initConfig = [], Symfony\Component\Console\Input\InputInterface $input = null, Symfony\Component\Console\Output\OutputInterface $output = null ) : void
$initConfig array [optional]
$input Symfony\Component\Console\Input\InputInterface [optional]
$output Symfony\Component\Console\Output\OutputInterface [optional]
return void
    public function init(array $initConfig = array(), InputInterface $input = null, OutputInterface $output = null)
    {
        if ($this->_isInitialized) {
            return;
        }
        // Suppress DateTime warnings
        date_default_timezone_set(@date_default_timezone_get());
        // Initialize EventDispatcher early
        $this->dispatcher = new EventDispatcher();
        $this->setDispatcher($this->dispatcher);
        $input = $input ?: new ArgvInput();
        $output = $output ?: new ConsoleOutput();
        if (null !== $this->config) {
            throw new UnexpectedValueException(sprintf('Config already initialized'));
        }
        $loadExternalConfig = !$input->hasParameterOption('--skip-config');
        $this->config = $config = new Config($initConfig, $this->isPharMode(), $output);
        if ($this->configurationLoaderInjected) {
            $config->setLoader($this->configurationLoaderInjected);
        }
        $config->loadPartialConfig($loadExternalConfig);
        $this->detectMagento($input, $output);
        $configLoader = $config->getLoader();
        $configLoader->loadStageTwo($this->_magentoRootFolder, $loadExternalConfig, $this->_magerunStopFileFolder);
        $config->load();
        if ($autoloader = $this->autoloader) {
            $config->registerCustomAutoloaders($autoloader);
            $this->registerEventSubscribers();
            $config->registerCustomCommands($this);
        }
        $this->registerHelpers();
        $this->_isInitialized = true;
    }

Usage Example

Example #1
0
 /**
  * Get an instance of the Magerun app.
  *
  * @return \N98\Magento\Application
  */
 public function getMagerun()
 {
     if (!$this->magerun) {
         $this->magerun = new MagerunApplication($this->getApplication()->getAutoloader());
         $this->magerun->init();
     }
     return $this->magerun;
 }
All Usage Examples Of N98\Magento\Application::init