Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
53 | private function purgeRequest(array $iris) |
||
54 | { |
||
55 | // Create the regex to purge all tags in just one request |
||
56 | $parts = array_map(function ($iri) { |
||
57 | return sprintf('(^|\,)%s($|\,)', preg_quote($iri)); |
||
58 | }, $iris); |
||
59 | |||
60 | $regex = \count($parts) > 1 ? sprintf('(%s)', implode(')|(', $parts)) : array_shift($parts); |
||
61 | |||
62 | foreach ($this->clients as $client) { |
||
63 | $client->request('BAN', '', ['headers' => ['ApiPlatform-Ban-Regex' => $regex]]); |
||
64 | } |
||
68 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.