| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 35 | public function set($key, $value): void |
|
| 32 | { |
||
| 33 | $cacheEntry = [ |
||
| 34 | 35 | 'key' => $key, |
|
| 35 | 35 | 'value' => $value, |
|
| 36 | ]; |
||
| 37 | 35 | $index = $this->findCacheIndexByKey($key); |
|
| 38 | |||
| 39 | 35 | if ($index !== null) { |
|
| 40 | 1 | $this->cache[$index] = $cacheEntry; |
|
| 41 | |||
| 42 | 1 | return; |
|
| 43 | } |
||
| 44 | |||
| 45 | 35 | $this->cache[] = $cacheEntry; |
|
| 46 | 35 | } |
|
| 47 | |||
| 89 |