| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 3 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public static function redisListToArray(array $list) |
||
| 24 | { |
||
| 25 | // Redis lists come into a format where the keys are on even indexes |
||
| 26 | // and the values are on odd indexes. This way, we know which |
||
| 27 | // ones are keys and which ones are values and their get combined |
||
| 28 | // later to form the key => value array. |
||
| 29 | [$keys, $values] = collect($list)->partition(function ($value, $key) { |
||
| 30 | return $key % 2 === 0; |
||
| 31 | }); |
||
| 32 | |||
| 33 | return array_combine($keys->all(), $values->all()); |
||
| 34 | } |
||
| 51 |