| Total Complexity | 3 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class Crawler implements CrawlerInterface |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var string[] |
||
| 18 | */ |
||
| 19 | protected $pages = array( |
||
| 20 | 'https://www.sunstar.com.ph/morearticles/Manila/Local-news', |
||
| 21 | 'https://www.sunstar.com.ph/morearticles/Cebu/Local-news', |
||
| 22 | 'https://www.sunstar.com.ph/morearticles/Davao/Local-news', |
||
| 23 | ); |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Returns an array of articles to scrape. |
||
| 27 | * |
||
| 28 | * @return string[] |
||
| 29 | */ |
||
| 30 | 3 | public function crawl() |
|
| 31 | { |
||
| 32 | 3 | $result = array(); |
|
| 33 | |||
| 34 | 3 | foreach ((array) $this->pages as $page) |
|
| 35 | { |
||
| 36 | 3 | $items = $this->items((string) $page); |
|
| 37 | |||
| 38 | 3 | $result = array_merge($result, $items); |
|
| 39 | 1 | } |
|
| 40 | |||
| 41 | 3 | return $result; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Returns an array of articles to scrape. |
||
| 46 | * |
||
| 47 | * @param string $link |
||
| 48 | * @return string[] |
||
| 49 | */ |
||
| 50 | 3 | protected function items($link) |
|
| 68 | } |
||
| 69 | } |
||
| 70 |