Conditions | 3 |
Paths | 1 |
Total Lines | 23 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
49 | 3 | protected function verify($items) |
|
50 | { |
||
51 | 3 | $base = 'https://www.gmanetwork.com/news/'; |
|
52 | |||
53 | 3 | $allowed = (array) $this->allowed; |
|
54 | |||
55 | 3 | $callback = function ($item) use ($base, $allowed) |
|
56 | { |
||
57 | 3 | $link = null; |
|
58 | |||
59 | 3 | foreach ((array) $allowed as $keyword) |
|
60 | { |
||
61 | 3 | $result = strpos($item['link'], (string) $keyword); |
|
62 | |||
63 | 3 | $result !== false && $link = $base . $item['link']; |
|
64 | 1 | } |
|
65 | |||
66 | 3 | return (string) $link; |
|
67 | 3 | }; |
|
68 | |||
69 | 1 | $result = array_map($callback, (array) $items); |
|
70 | |||
71 | 1 | return array_values(array_filter($result)); |
|
72 | } |
||
74 |