| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 17 | 
| Code Lines | 10 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 11 | 
| CRAP Score | 4 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 16 | 6 | public static function mutate(array &$array, string $writeKey, $value) | |
| 17 |     { | ||
| 18 | 6 | $ref = &$array; | |
| 19 | 6 |         $keys = explode('.', $writeKey); | |
| 20 | 6 |         while (($key = array_shift($keys)) !== null) { | |
| 21 | 6 | $hasMoreKeys = \count($keys) > 0; | |
| 22 | 6 |             if ($hasMoreKeys) { | |
| 23 | 1 |                 if (!\array_key_exists($key, $ref)) { | |
| 24 | // Prepare the array | ||
| 25 | 1 | $ref[$key] = []; | |
| 26 | } | ||
| 27 | 1 | $ref = &$ref[$key]; | |
| 28 | 1 | continue; | |
| 29 | } | ||
| 30 | |||
| 31 | // Last key | ||
| 32 | 6 | $ref[$key] = $value; | |
| 33 | } | ||
| 36 |