Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function filterNodes(Crawler $crawler): ?Crawler { |
||
26 | |||
27 | if ($crawler->count() === 0) |
||
28 | { |
||
29 | return null; |
||
30 | } |
||
31 | elseif (empty($this->regex)) |
||
32 | { |
||
33 | return $crawler; |
||
34 | } |
||
35 | else |
||
36 | { |
||
37 | $regex = $this->regex; |
||
38 | return $crawler->reduce(function ($node) use ($regex) { |
||
39 | return preg_match("/$regex/", $node->text()) === 1; |
||
40 | }); |
||
44 | } |