config) { $config = include __DIR__ . '/../config.php'; $this->config = $config; } if (!$value) { return $config; } if (!array_key_exists($value, $config)) { throw new Exception('Failed loading config value `' . $value . '`'); } return $config[$value]; } public function initCommands() { $api_key = $this->getConfig('api_key'); $this->addCommand( 'flight:check {flight}', function (InputInterface $input, OutputInterface $output) use ($api_key) { $flight_data = (new Helper($api_key))->getFlightByIata($input->getArgument('flight')); $output->writeLn($flight_data); return Command::SUCCESS; } ); $this->addCommand( 'flight {flight}', function (InputInterface $input, OutputInterface $output) use ($api_key) { $flight_data = (new Helper($api_key))->getFlightByIata($input->getArgument('flight')); $output->writeLn($flight_data); return Command::SUCCESS; } ); } }