Passed
Pull Request — main (#123)
by Andrey
29:01 queued 13:53
created

Keyable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 2
b 0
f 0
dl 0
loc 17
ccs 3
cts 3
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getKeysOnly() 0 15 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Helldar\LaravelLangPublisher\Concerns;
6
7
trait Keyable
8
{
9 28
    protected function getKeysOnly(array $array): array
10
    {
11 28
        $result = [];
12
13 28
        foreach ($array as $key => $value) {
14
            if (is_array($value)) {
15
                $result[$key] = $this->getKeysOnly($value);
16
17
                continue;
18
            }
19
20
            array_push($result, $key);
21
        }
22
23
        return $result;
24
    }
25
}
26