예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->isForce = true;
     parent::init($input);
     $this->resultOfFetching = $this->exchangeService->fetchExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
     parent::execute($input, $output);
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::init($input);
     // If current is set then fetch the current rates.
     if (isset($this->inputOptions['current']) && $this->inputOptions['current']) {
         // Use last local date as start date if --with-local is given
         if (isset($this->inputOptions['with-local']) && $this->inputOptions['with-local']) {
             $objStartDate = $this->exchangeService->getLastLocalRateDate();
             // Abort if last local date is in the future
             if ($objStartDate > date('Y-m-d')) {
                 $output->writeln('<comment>The last local rate\'s date is in the future. Insertion aborted.</comment>');
                 exit(0);
             }
             $this->inputOptions['start'] = $objStartDate->format('Y-m-d');
             $this->resultOfFetching = $this->exchangeService->fetchExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
         } else {
             $this->resultOfFetching = $this->exchangeService->fetchCurrentExchangeRates();
         }
     } elseif (isset($this->inputOptions['missing']) && $this->inputOptions['missing']) {
         $this->isNotRequiredOptions['start'] = true;
         $this->resultOfFetching = $this->exchangeService->getMissingExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
         // If the last local rate's date is today or tomorrow then aborting the command.
         if (false === $this->resultOfFetching) {
             $output->writeln('<comment>The last local rate\'s date is today or tomorrow. Insertion aborted.</comment>');
             exit(0);
         }
     } else {
         $this->resultOfFetching = $this->exchangeService->fetchExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
     }
     parent::execute($input, $output);
 }
예제 #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->isNotRequiredOptions['start'] = true;
     parent::init($input);
     $this->resultOfFetching = $this->exchangeService->getDiffExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
     parent::execute($input, $output);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::init($input);
     // If current is set then fetch the current rates.
     if (isset($this->inputOptions['current']) && $this->inputOptions['current']) {
         $this->resultOfFetching = $this->exchangeService->fetchCurrentExchangeRates();
     } elseif (isset($this->inputOptions['missing']) && $this->inputOptions['missing']) {
         $this->isNotRequiredOptions['start'] = true;
         $this->resultOfFetching = $this->exchangeService->getMissingExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
         // If the last local rate's date is today or tomorrow then aborting the command.
         if (false === $this->resultOfFetching) {
             $output->writeln('<comment>The last local rate\'s date is today or tomorrow. The fetching is cancelled.</comment>');
             exit(0);
         }
     } else {
         $this->resultOfFetching = $this->exchangeService->fetchExchangeRates($this->validateCommandOptions($this->inputOptions, $output));
     }
     parent::execute($input, $output);
 }