/** * @param Args $args * @param IO $io */ public function handle(Args $args, IO $io) { parent::parseConfig($io); $httpClient = new Client($this->profile); $result = $httpClient->reloadBouquets(); if ($result) { $io->writeLine("Reloaded"); } else { $io->errorLine("Cannot send HTTP request, please check config file"); } }
/** * @param Args $args * @param IO $io */ public function handle(Args $args, IO $io) { parent::parseConfig($io); try { $retriever = new Retriever(); $retriever->download($args->getArgument('url')); $io->writeLine('Downloaded and extracted'); } catch (\RuntimeException $e) { $io->errorLine('Invalid url'); exit; } }
/** * @param Args $args * @param IO $io */ public function handle(Args $args, IO $io) { parent::parseConfig($io); try { $filesScanner = new Files\Scanner($args->getArgument('path')); $files = $filesScanner->scan(); } catch (\RuntimeException $e) { $io->errorLine("Invalid path"); exit; } try { $uploader = new Uploader(new Ftp($this->profile)); $uploader->upload($files); $io->writeLine("Uploaded"); } catch (\RuntimeException $e) { $io->errorLine($e->getMessage()); exit; } }