@return Configurable

@TODO: Move into ConsoleVents::COMMAND Event - if $command instanceOf RequiresConfiguration - load config
778084
private function loadConfiguration() {

		$config = $this->configWrapper->configuration();

		$this->configWrapper->loadGlobalConfig( $config );
		$this->configWrapper->loadProjectConfig( $config );

		$event = new ConfigurationLoadedEvent();
		$event->setConfiguration( $config );
		$this->eventDispatcher->dispatch( $event::NAME, $event );

		return $config;
	}
43913
public static function configurator()
    {
        //====================================================================//
        // Configuration Array Already Exists
        //====================================================================//
        if (isset(self::core()->configurator)) {
            return self::core()->configurator;
        }

        //====================================================================//
        // Load Configurator Class Name from Configuration
        $className = self::configuration()->Configurator;
        //====================================================================//
        // No Configurator Defined
        if (!is_string($className) || empty($className)) {
            return new NullConfigurator();
        }
        //====================================================================//
        // Validate Configurator Class Name
        if (false == self::validate()->isValidConfigurator($className)) {
            return new NullConfigurator();
        }

        //====================================================================//
        // Initialize Configurator
        self::core()->configurator = new $className();

        return self::core()->configurator;
    }
970761
public function loadConfiguration()
    {
        if (empty($this->conf)) {
            $this->conf = $this->loadDefault();
        } else {
            $this->conf = array_merge(self::loadDefault(), $this->conf);
        }

        return $this->conf;
    }
769269
public function command(ConsoleCommandEvent $event)
    {
        /** @var BridgeCommand $command */
        $command = $event->getCommand();

        if (!in_array($command->getName(), $this->getSupportedCommands())) {
            return;
        }

        $command->setRegistry($this->registry);
    }
1207029
public function loadConfiguration()
    {
        $builder = $this->getContainerBuilder();
        $config = $this->getConfig($this->defaults);

        // Create instance of extension
        $menuFactory = $builder->addDefinition($this->prefix('extension'))
            ->setClass('Smf\Menu\MenuExtension');

        // Create instance of menufactory
        $menuFactory = $builder->addDefinition($this->prefix('factory'))
            ->addSetup('addExtension', array($this->prefix('@extension')))
            ->setClass('Knp\Menu\MenuFactory');

        // Create renderers manager
        $rendererManager = $builder->addDefinition($this->prefix('rendererManager'))
            ->setClass('Smf\Menu\Renderer\Manager')
            ->addSetup(get_called_class() . '::setupRenderers', array('@self', '@container'))
            ->addSetup('setDefaultRenderer', array($config['defaultRenderer']));;

        // Create a factory for control
        $builder->addDefinition($this->prefix('controlFactory'))
            ->setClass('Smf\Menu\Control\Factory', array($menuFactory, $rendererManager));

        // Matcher
        $matcher = $builder->addDefinition($this->prefix('matcher'))
            ->addSetup(get_called_class() . '::setupVoters', array('@self', '@container'))
            ->setClass('Smf\Menu\Matcher\Matcher');

        // Create a default renderers
        $renderers = array(
            'Smf\Menu\Renderer\ListRenderer',
            'Smf\Menu\Renderer\BootstrapNavRenderer',
        );
        foreach ($renderers as $renderer) {
            $name = explode('\\', $renderer);
            $name = lcfirst(preg_replace('#Renderer$#', '', end($name)));
            $builder->addDefinition($this->prefix('renderer_' . $name))
                ->setClass($renderer, array($matcher))
                ->addTag(self::RENDERER_TAG_NAME, $name);
        }

        // Create default voter
        $builder->addDefinition($this->prefix('presenterVoter'))
            ->setClass('Smf\Menu\Matcher\Voter\PresenterVoter')
            ->addTag(self::VOTER_TAG_NAME);
    }
921731
protected function getConfigurationInstance() {
    // get config file to modify
    $configFiles = $this->configuration->getConfigurations();
    if (sizeof($configFiles) == 0) {
      return false;
    }

    // create a writable configuration and modify the permission
    $mainConfig = $configFiles[0];
    $config = new InifileConfiguration(dirname($mainConfig).'/');
    $config->addConfiguration(basename($mainConfig));
    return [
      'instance' => $config,
      'file' => $mainConfig
    ];
  }
852357
protected function getCommandConfig($commandKey)
    {
        if (isset($this->configsPerCommandKey[$commandKey])) {
            return $this->configsPerCommandKey[$commandKey];
        }
        $config = new Config($this->config->get('default')->toArray(), true);
        if ($this->config->__isset($commandKey)) {
            $commandConfig = $this->config->get($commandKey);
            $config->merge($commandConfig);
        }
        $this->configsPerCommandKey[$commandKey] = $config;
        return $config;
    }
512950
protected function configureContainerInternal()
	{
		$this->container->add(
			'instantiator',
			function () {
				return function ($name) {
					return $this->container->get($name);
				};
			}
		);

		$this->container->add(\Weave\Middleware\Middleware::class)
		->withArgument(\Weave\Middleware\MiddlewareAdaptorInterface::class)
		->withArgument(
			function ($pipelineName) {
				return $this->provideMiddlewarePipeline($pipelineName);
			}
		)
		->withArgument(\Weave\Resolve\ResolveAdaptorInterface::class)
		->withArgument(\Weave\Dispatch\DispatchAdaptorInterface::class)
		->withArgument(\Weave\Http\RequestFactoryInterface::class)
		->withArgument(\Weave\Http\ResponseFactoryInterface::class)
		->withArgument(\Weave\Http\ResponseEmitterInterface::class);

		$this->container->add(
			\Weave\Resolve\ResolveAdaptorInterface::class,
			\Weave\Resolve\Resolve::class
		)
		->withArgument('instantiator');

		$this->container->add(
			\Weave\Dispatch\DispatchAdaptorInterface::class,
			\Weave\Dispatch\Dispatch::class
		);

		$this->container->add(\Weave\Middleware\Dispatch::class)
		->withArgument(\Weave\Resolve\ResolveAdaptorInterface::class)
		->withArgument(\Weave\Dispatch\DispatchAdaptorInterface::class);

		$this->container->add(\Weave\Router\Router::class)
		->withArgument(\Weave\Router\RouterAdaptorInterface::class)
		->withArgument(
			function ($router) {
				return $this->provideRouteConfiguration($router);
			}
		)
		->withArgument(\Weave\Resolve\ResolveAdaptorInterface::class)
		->withArgument(\Weave\Dispatch\DispatchAdaptorInterface::class);
	}
20317
protected function loadCliCommands()
    {
        if (defined('WP_CLI') && WP_CLI && ($config = $this->loadConfigFile('commands.php'))) {
            foreach ($config as $command => $className) {
                \WP_CLI::add_command($command, $className);
            }
        }

        return $this;
    }
836621
protected function registerMakeControllerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\ControllerMakeCommand($app);
        });
    }
362454
public function exec($command)
    {
        $this->_events[] = $event = new Event($this->_mutex, $command);
        return $event;
    }
409741
public function required() {
        $this->validated = false;
        $this->config[self::REQUIRED] = true;
        return $this;
    }
1082034
function config()
    {
        if (!$this->configuration || !$this->configuration instanceof Entity)
            $this->configuration = new Entity();

        return $this->configuration;
    }
72678
protected function getConfiguration(InputInterface $input): ConsoleConfigInterface
    {
        // If the configuration to use is the default.
        if ($input->getOption('default')) {
            $this->validatePathsExist($input);
            // If it is a directory.
            if ($input->getOption('dir')) {
                return (new DefaultConsoleConfigFactory())
                    ->invokeDir($input->getArgument('source'), $input->getArgument('target'));
            }
            return (new DefaultConsoleConfigFactory())
                ->invokeFile($input->getArgument('source'), $input->getArgument('target'));
        }

        $path = $input->getOption('config');
        // If we have a "=" at the beginning of the option value
        $path = preg_replace('/^\=/', '', $path);

        $factory = $this->getConfigurationFactory($path);

        if ($input->getOption('dir')) {
            $this->validatePathsExist($input);
            return $factory->invokeDir(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        if ($input->getOption('file')) {
            $this->validatePathsExist($input);
            return $factory->invokeFile(
                $path,
                $input->getArgument('source'),
                $input->getArgument('target')
            );
        }
        return $factory->invoke($path);
    }
210089
protected function dispatchConfigurationEvents(): self
    {
        foreach ($this->iterationsEvents as $event) {
            if (!($this->loopCount % $event['count'])) {
                $this->dispatchEvent($event['name']);
            }
        }

        return $this;
    }
1350068
protected function configureEvents(): self
    {
        $container = $this->getContainer();
        $key = 'm6web_daemon.iterations_events';

        if ($container->hasParameter($key)) {
            $this->iterationsEvents = $container->getParameter($key);
        }

        return $this;
    }
972788
private static function _dispatch($command)
	{
		$dispatcher = self::_getDispatcher();
		$commandEvent = new CommandEvent(PluginEvents::COMMAND, $command, self::_getIO(), self::_getIO());
		$dispatcher->dispatch($commandEvent->getName(), $commandEvent);
	}