Completed
Push — master ( 897757...1cf9f7 )
by Paweł
18s queued 10s
created

sortNestedArrayAssocAlphabeticallyByKey()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SWP\Component\Common;
6
7
class ArrayHelper
8
{
9
    public static function sortNestedArrayAssocAlphabeticallyByKey(array $a): array
10
    {
11
        ksort($a);
12
        foreach ($a as $key => $value) {
13
            if (is_array($value)) {
14
                $a[$key] = self::sortNestedArrayAssocAlphabeticallyByKey($value);
15
            }
16
        }
17
18
        return $a;
19
    }
20
}
21