Conditions | 7 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function get(string $key): ?float |
||
27 | { |
||
28 | $value = $this->cache->get($key); |
||
29 | if (!is_int($value) && !is_float($value) && $value !== false && $value !== null) { |
||
30 | throw new InvalidArgumentException('The value is not supported by SimpleCacheStorage, it must be int, float or null.'); |
||
31 | } |
||
32 | |||
33 | if ($value === false || $value === null) { |
||
34 | $value = null; |
||
35 | } else { |
||
36 | $value = (float)$value; |
||
37 | } |
||
38 | return $value; |
||
39 | } |
||
41 |