@@ -21,13 +21,15 @@ |
||
21 | 21 | public function filterNodes(Crawler $crawler): ?Crawler { |
22 | 22 | |
23 | 23 | // Nth needs one parameter |
24 | - if (count($this->parameters) === 0) |
|
25 | - throw new \ErrorException(':nth(x) css selector should have at least one parameter'); |
|
24 | + if (count($this->parameters) === 0) { |
|
25 | + throw new \ErrorException(':nth(x) css selector should have at least one parameter'); |
|
26 | + } |
|
26 | 27 | |
27 | 28 | // If not enough nodes in the list, return null |
28 | 29 | $count = intval($this->parameters[0]); |
29 | - if ($crawler->count() < $count) |
|
30 | - return null; |
|
30 | + if ($crawler->count() < $count) { |
|
31 | + return null; |
|
32 | + } |
|
31 | 33 | |
32 | 34 | // Get the nth element |
33 | 35 | return $crawler->eq($count - 1); |
@@ -27,12 +27,10 @@ |
||
27 | 27 | { |
28 | 28 | $guzzleClient = new GuzzleClient($client); |
29 | 29 | $goutteClient->setClient($guzzleClient); |
30 | - } |
|
31 | - elseif (is_a($client, GuzzleClient::class)) |
|
30 | + } elseif (is_a($client, GuzzleClient::class)) |
|
32 | 31 | { |
33 | 32 | $goutteClient->setClient($client); |
34 | - } |
|
35 | - else |
|
33 | + } else |
|
36 | 34 | { |
37 | 35 | // Unknow parmeter type or null, use default configuration |
38 | 36 | $this->getClient(); |