Total Complexity | 3 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 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 | 3 | $items = $this->items((string) $page); |
|
36 | |||
37 | 3 | $result = array_merge($result, $items); |
|
38 | 2 | } |
|
39 | |||
40 | 3 | return $result; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * Returns an array of articles to scrape. |
||
45 | * |
||
46 | * @param string $link |
||
47 | * @return string[] |
||
48 | */ |
||
49 | 3 | protected function items($link) |
|
66 | } |
||
67 | } |
||
68 |