<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Vendor\QuickRun\Crawl; use Illuminate\Console\Command; use ModStart\Core\Util\CodeUtil; use ModStart\Core\Util\FileUtil; class CrawlerRunnerCommand extends Command { protected $signature = 'crawler-runner {path}'; private $crawlers = array(); public function handle() { goto WDo1X; cVTw6: if (empty($this->crawlers)) { $this->info('CrawlerRunner: No Crawler Found'); return; } goto bNS09; rA2U6: foreach ($this->crawlers as $RTnsR) { $this->info('    > ' . get_class($RTnsR)); } goto h2LoJ; WDo1X: $vanIz = $this->argument('path'); goto T16_4; VHTB0: $this->info('CrawlerRunner: Run End'); goto hYdkv; h2LoJ: $this->info('CrawlerRunner: Run Start'); goto hHcGb; T16_4: if (is_file($vanIz)) { goto KrjpW; KrjpW: $gLDFc = CodeUtil::getFullClassNameForContent(file_get_contents($vanIz)); goto xwIFZ; xwIFZ: $QCsX1 = app($gLDFc); goto s19vV; s19vV: $this->crawlers[] = $QCsX1; goto cPdcn; cPdcn: } else { $cKrwB = FileUtil::listFiles($vanIz, '*.php'); foreach ($cKrwB as $x_XbT) { goto Z33EJ; MzyCl: if (preg_match('/\\\\Abstract[A-Za-z0-9_]+$/', $gLDFc)) { continue; } goto grBHI; Z33EJ: $gLDFc = CodeUtil::getFullClassNameForContent(file_get_contents($x_XbT['pathname'])); goto MzyCl; grBHI: $QCsX1 = app($gLDFc); goto VIEHm; VIEHm: if (!$QCsX1 instanceof AbstractCrawler || preg_match('/\\Abstract[A-Za-z0-9_]+$/', $gLDFc)) { continue; } goto criYY; criYY: $this->crawlers[] = $QCsX1; goto Z29Ma; Z29Ma: } } goto cVTw6; hHcGb: foreach ($this->crawlers as $RTnsR) { goto K1I1k; QxMF0: app()->call(array($RTnsR, 'setup')); goto uQeBh; K1I1k: $RTnsR->init(); goto QxMF0; uQeBh: $RTnsR->run(); goto HMYGR; HMYGR: } goto VHTB0; bNS09: $this->info('CrawlerRunner: ' . count($this->crawlers) . ' Crawler(s) Found'); goto rA2U6; hYdkv: } }