| Total Complexity | 7 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | final class VarnishPurger implements PurgerInterface |
||
| 26 | { |
||
| 27 | const CHUNK_SIZE = 100; |
||
| 28 | private $clients; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param ClientInterface[] $clients |
||
| 32 | */ |
||
| 33 | public function __construct(array $clients) |
||
| 34 | { |
||
| 35 | $this->clients = $clients; |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | public function purge(array $iris) |
||
| 42 | { |
||
| 43 | if (!$iris) { |
||
|
|
|||
| 44 | return; |
||
| 45 | } |
||
| 46 | |||
| 47 | $irisChunks = array_chunk($iris, self::CHUNK_SIZE); |
||
| 48 | foreach($irisChunks as $irisChunk) { |
||
| 49 | $this->purgeRequest($irisChunk); |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | private function purgeRequest(array $iris) |
||
| 64 | } |
||
| 65 | } |
||
| 66 | |||
| 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.