Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 3 | public function crawl() |
|
31 | { |
||
32 | 3 | $articles = array(); |
|
33 | |||
34 | 3 | foreach ((array) $this->categories as $link) |
|
35 | { |
||
36 | 3 | $crawler = new DomCrawler(Client::request($link)); |
|
37 | |||
38 | 3 | $news = $crawler->filter('.articles-list > .article'); |
|
39 | |||
40 | 3 | $items = $news->each(function (DomCrawler $node) |
|
41 | { |
||
42 | 3 | $current = $node->filter('h4.title > a'); |
|
43 | |||
44 | 3 | return (string) $current->attr('href'); |
|
45 | 3 | }); |
|
46 | |||
47 | 1 | $articles = array_merge($articles, $items); |
|
48 | 1 | } |
|
49 | |||
50 | 1 | return array_reverse((array) $articles); |
|
51 | } |
||
53 |