| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function itemsCount(array $filter): int |
||
| 18 | { |
||
| 19 | $totalItems = 0; |
||
| 20 | foreach ($this->connection->keys('*') as $key) { |
||
| 21 | if ($this->connection->type($key) !== RedisProxy::TYPE_STRING) { |
||
| 22 | continue; |
||
| 23 | } |
||
| 24 | $result = $this->connection->get($key); |
||
| 25 | $item = [ |
||
| 26 | 'key' => $key, |
||
| 27 | 'value' => $result, |
||
| 28 | 'length' => strlen($result), |
||
| 29 | ]; |
||
| 30 | |||
| 31 | if (Filter::apply($item, $filter)) { |
||
| 32 | $totalItems++; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | return $totalItems; |
||
| 36 | } |
||
| 37 | |||
| 72 |