| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function write(array $items, string $namespace, callable $putItem): void |
||
| 28 | { |
||
| 29 | $processedCount = 0; |
||
| 30 | $itemCount = count($items); |
||
| 31 | |||
| 32 | while ($processedCount < $itemCount) { |
||
| 33 | $batchItems = array_slice($items, $processedCount, $this->batchSize); |
||
| 34 | foreach ($batchItems as $item) { |
||
| 35 | if (!isset($item['cacheKey'], $item['cacheData'])) { |
||
| 36 | continue; |
||
| 37 | } |
||
| 38 | $putItem($item['cacheKey'], $item['cacheData'], $namespace); |
||
| 39 | } |
||
| 40 | $processedCount += count($batchItems); |
||
| 41 | } |
||
| 44 |