setName('nexmo:sms:pricing') ->setDescription('Gets sms price for given country') ->setDefinition(array( new InputArgument('country', InputArgument::REQUIRED, 'The country code'), )) ->setHelp("The nexmo:sms:pricing command gets Nexmo API SMS pricing for a given country"); } /** * @see Command */ protected function execute(InputInterface $input, OutputInterface $output) { $country = $input->getArgument('country'); $account = $this->getContainer()->get('jhg_nexmo_account'); $price = $account->smsPricing($country); if($price===false) { throw new \Exception("Country not valid"); } else { $output->writeln(sprintf('SMS sending price for "%s": %f',$country,$price)); } } }