| Conditions | 4 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function purge(array $iris) |
||
| 41 | { |
||
| 42 | if (!$iris) { |
||
|
|
|||
| 43 | return; |
||
| 44 | } |
||
| 45 | |||
| 46 | // Create the regex to purge all tags in just one request |
||
| 47 | $parts = array_map(function ($iri) { |
||
| 48 | return sprintf('(^|\,)%s($|\,)', preg_quote($iri)); |
||
| 49 | }, $iris); |
||
| 50 | |||
| 51 | $regex = count($parts) > 1 ? sprintf('(%s)', implode(')|(', $parts)) : array_shift($parts); |
||
| 52 | |||
| 53 | foreach ($this->clients as $client) { |
||
| 54 | $client->request('BAN', '', ['headers' => ['ApiPlatform-Ban-Regex' => $regex]]); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
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.