Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $url = $input->getArgument('url');
     $dest = $input->getOption('dest');
     $timeout = floatval($input->getOption('timeout'));
     if ($dest == 'data') {
         $dest = getcwd() . DIRECTORY_SEPARATOR . 'data';
     }
     if (!file_exists($dest) || !is_writable($dest)) {
         throw new RuntimeException(sprintf('"%s" is not found or is not writable', $dest));
     }
     $client = new Client(new Options(['url' => $url, 'dest' => $dest, 'timeout' => $timeout]), $output);
     $client->crawl();
 }