Passed
Push — 10.x ( a3a026...912076 )
by Andrey
11:38
created

Keyable::getKeysOnly()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10
cc 3
nc 3
nop 1
crap 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Helldar\LaravelLangPublisher\Concerns;
6
7
trait Keyable
8
{
9 14
    protected function getKeysOnly(array $array): array
10
    {
11 14
        $result = [];
12
13 14
        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