Conditions | 1 |
Paths | 1 |
Total Lines | 18 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 3 | public function crawl() |
|
28 | { |
||
29 | 3 | $response = Client::request($this->link); |
|
30 | |||
31 | 3 | $callback = function (DomCrawler $node) |
|
32 | { |
||
33 | 3 | $url = 'https://news.abs-cbn.com'; |
|
34 | |||
35 | 3 | return $url . $node->attr('href'); |
|
36 | 3 | }; |
|
37 | |||
38 | 3 | $crawler = new DomCrawler((string) $response); |
|
39 | |||
40 | 3 | $news = $crawler->filter('#latest-news li > p > a'); |
|
41 | |||
42 | 3 | $news = $this->verify($news->each($callback)); |
|
43 | |||
44 | 3 | return array_reverse(array_filter((array) $news)); |
|
45 | } |
||
69 |