| Total Complexity | 11 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | final class CacheItem implements CacheItemInterface |
||
| 13 | { |
||
| 14 | private const DEFAULT_EXPIRATION = 'now +1 year'; |
||
| 15 | |||
| 16 | private string $key; |
||
| 17 | private mixed $value; |
||
| 18 | private bool $hit; |
||
| 19 | private DateTimeInterface | int | null $expiration; |
||
| 20 | |||
| 21 | public function __construct(string $key, mixed $value) |
||
| 22 | { |
||
| 23 | $this->key = $key; |
||
| 24 | $this->value = $value; |
||
| 25 | $this->hit = null !== $value; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getKey(): string |
||
| 29 | { |
||
| 30 | return $this->key; |
||
| 31 | } |
||
| 32 | |||
| 33 | public function get(): mixed |
||
| 34 | { |
||
| 35 | return $this->value; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function isHit(): bool |
||
| 39 | { |
||
| 40 | return $this->hit; |
||
| 41 | } |
||
| 42 | |||
| 43 | public function set(mixed $value): void |
||
| 46 | } |
||
| 47 | |||
| 48 | public function expiresAt(?DateTimeInterface $expiration): void |
||
| 49 | { |
||
| 50 | $this->expiration = $expiration; |
||
| 51 | if (null === $expiration) { |
||
| 52 | $this->expiration = new DateTimeImmutable(self::DEFAULT_EXPIRATION); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | public function expiresAfter(DateInterval | int | null $time): void |
||
| 57 | { |
||
| 58 | if ($time instanceof DateInterval) { |
||
| 59 | $this->expiration = new DateTimeImmutable(); |
||
| 60 | $this->expiration->add($time); |
||
| 61 | |||
| 62 | return; |
||
| 63 | } |
||
| 64 | |||
| 65 | if (is_int($time)) { |
||
| 66 | $this->expiration = new DateTimeImmutable(sprintf('now +%d seconds', $time)); |
||
| 67 | |||
| 68 | return; |
||
| 69 | } |
||
| 70 | |||
| 71 | $this->expiration = new DateTimeImmutable(self::DEFAULT_EXPIRATION); |
||
| 72 | } |
||
| 73 | |||
| 74 | public function expiration(): DateTimeInterface | int | null |
||
| 77 | } |
||
| 78 | } |
||
| 79 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths