Conditions | 5 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5.0187 |
Changes | 5 | ||
Bugs | 3 | Features | 0 |
1 | <?php |
||
308 | 2 | public static function array_change_key_case( |
|
309 | array $array, |
||
310 | int $case = \CASE_LOWER, |
||
311 | string $encoding = 'UTF-8' |
||
312 | ): array { |
||
313 | if ( |
||
314 | 2 | $case !== \CASE_LOWER |
|
315 | && |
||
316 | 2 | $case !== \CASE_UPPER |
|
317 | ) { |
||
318 | $case = \CASE_LOWER; |
||
319 | } |
||
320 | |||
321 | 2 | $return = []; |
|
322 | 2 | foreach ($array as $key => &$value) { |
|
323 | 2 | $key = $case === \CASE_LOWER |
|
324 | 2 | ? self::strtolower($key, $encoding) |
|
325 | 2 | : self::strtoupper($key, $encoding); |
|
326 | |||
327 | 2 | $return[$key] = $value; |
|
328 | } |
||
329 | |||
330 | 2 | return $return; |
|
331 | } |
||
13665 |