| Conditions | 6 | 
| Paths | 5 | 
| Total Lines | 16 | 
| Code Lines | 9 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 10 | 
| CRAP Score | 6 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 21 | 10 | public static function replaceValuesByMatchingKeys(array $input, array $keys, $replacement) | |
| 22 |     { | ||
| 23 | 10 |         $keys = array_map('strtolower', $keys); | |
| 24 | |||
| 25 | 10 |         foreach ($input as $key => $value) { | |
| 26 | 10 |             if(is_array($value)) { | |
| 27 | 2 | $input[$key] = static::replaceValuesByMatchingKeys($value, $keys, $replacement); | |
| 28 | } | ||
| 29 | 10 |             elseif(is_string($key) && in_array(strtolower($key), $keys)) { | |
| 30 | 7 | $input[$key] = $replacement instanceof \Closure | |
| 31 | 1 | ? $replacement($key, $value) | |
| 32 | 10 | : $replacement; | |
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | 10 | return $input; | |
| 37 | } | ||
| 38 | } |