Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function purge(array $iris) |
||
42 | { |
||
43 | if (!$iris) { |
||
|
|||
44 | return; |
||
45 | } |
||
46 | |||
47 | $store = $this->kernel->getStore(); |
||
48 | |||
49 | if (!$store instanceof Psr6StoreInterface) { |
||
50 | return; |
||
51 | } |
||
52 | |||
53 | // Encode tags for greater compatiblity with different proxies |
||
54 | // Some do not allow special characters like / or @ in cache tags and |
||
55 | // also it allows to use a , in a tag, if you wish to do so. |
||
56 | $iris = array_map(function($resource) { |
||
57 | return base64_encode($resource); |
||
58 | }, $iris); |
||
59 | |||
60 | $store->invalidateTags($iris); |
||
61 | } |
||
63 |
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.