| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | public function getExpires(Cache $cache) |
||
| 43 | { |
||
| 44 | $cacheFileNames = glob(GeneralUtility::getFileAbsFileName($this->getCacheDirectory($cache) . '*')); |
||
| 45 | if (!$cacheFileNames) { |
||
|
|
|||
| 46 | return null; |
||
| 47 | } |
||
| 48 | $expireTimes = []; |
||
| 49 | foreach ($cacheFileNames as $cacheFileName) { |
||
| 50 | $index = (int)file_get_contents($cacheFileName, null, null, (filesize($cacheFileName) - CoreFileBackend::DATASIZE_DIGITS), CoreFileBackend::DATASIZE_DIGITS); |
||
| 51 | $expireTimes[] = (int)file_get_contents($cacheFileName, null, null, $index, CoreFileBackend::EXPIRYTIME_LENGTH); |
||
| 52 | } |
||
| 53 | return (int)array_sum($expireTimes) / count($expireTimes); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
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.