protected function initialize(InputInterface $input, OutputInterface $output)
    {
        parent::initialize($input, $output); // necessary to register autoloader

        $config = $input->getOption('config');
        if (!empty($config)) {
            if (!is_readable($config)) {
                throw new \InvalidArgumentException('Config file path "' . $config . '" is not readable.');
            }

            $this->config_path = $config;

            if ($input->getOption('verbose')) {
                $output->writeln('<comment>Config file path specified: ' . $this->config_path . '</comment>');
            }
        } else {
            $this->config_path = $this->getCurrentWorkingDirectory();

            if ($input->getOption('verbose')) {
                $output->writeln(
                    '<comment>Config file path not specified, using "' . $this->config_path .
                    '" as default lookup location.</comment>'
                );
            }
        }

        $config_handler_implementor = $input->getOption('config-handler');
        if (empty($config_handler_implementor)) {
            $config_handler_implementor = 'Environaut\Config\ConfigHandler';
        }

        $this->config_handler = new $config_handler_implementor();
        $this->config_handler->addLocation($this->config_path);

        // TODO allow multiple locations for config option?
        // $config_reader->setLocations(array($this->config_path));
    }
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        parent::initialize($input, $output); // necessary to register autoloader

        $config = $input->getOption('config');
        if (!empty($config)) {
            if (!is_readable($config)) {
                throw new \InvalidArgumentException('Config file path "' . $config . '" is not readable.');
            }

            $this->config_path = $config;

            if ($input->getOption('verbose')) {
                $output->writeln('<comment>Config file path specified: ' . $this->config_path . '</comment>');
            }
        } else {
            $this->config_path = $this->getCurrentWorkingDirectory();

            if ($input->getOption('verbose')) {
                $output->writeln(
                    '<comment>Config file path not specified, using "' . $this->config_path .
                    '" as default lookup location.</comment>'
                );
            }
        }

        $config_handler_implementor = $input->getOption('config-handler');
        if (empty($config_handler_implementor)) {
            $config_handler_implementor = 'Environaut\Config\ConfigHandler';
        }

        $this->config_handler = new $config_handler_implementor();
        $this->config_handler->addLocation($this->config_path);

        // TODO allow multiple locations for config option?
        // $config_reader->setLocations(array($this->config_path));
    }
protected function initialize ( InputInterface $ input , OutputInterface $ output ) { parent :: initialize ( $ input , $ output ) ; // necessary to register autoloader $ config = $ input -> getOption ( 'config' ) ; if ( ! empty ( $ config ) ) { if ( ! is_readable ( $ config ) ) { throw new \ InvalidArgumentException ( 'Config file path "' . $ config . '" is not readable.' ) ; } $ this -> config_path = $ config ; if ( $ input -> getOption ( 'verbose' ) ) { $ output -> writeln ( '<comment>Config file path specified: ' . $ this -> config_path . '</comment>' ) ; } } else { $ this -> config_path = $ this -> getCurrentWorkingDirectory ( ) ; if ( $ input -> getOption ( 'verbose' ) ) { $ output -> writeln ( '<comment>Config file path not specified, using "' . $ this -> config_path . '" as default lookup location.</comment>' ) ; } } $ config_handler_implementor = $ input -> getOption ( 'config-handler' ) ; if ( empty ( $ config_handler_implementor ) ) { $ config_handler_implementor = 'Environaut\Config\ConfigHandler' ; } $ this -> config_handler = new $ config_handler_implementor ( ) ; $ this -> config_handler -> addLocation ( $ this -> config_path ) ; // TODO allow multiple locations for config option? // $config_reader->setLocations(array($this->config_path)); }
Initializes the command just after the input has been validated.

@param InputInterface $input An InputInterface instance
@param OutputInterface $output An OutputInterface instance
Initializes the command just after the input has been validated .