GuessCodePath::__invoke()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 3
nop 1
dl 0
loc 16
ccs 7
cts 7
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace UsageFinder;
6
7
use function is_dir;
8
9
final class GuessCodePath
10
{
11 9
    public function __invoke(string $path) : ?string
12
    {
13
        $checks = [
14 9
            'lib',
15
            'src',
16
        ];
17
18 9
        foreach ($checks as $check) {
19 9
            $dir = $path . '/' . $check;
20
21 9
            if (is_dir($dir)) {
22 6
                return $check;
23
            }
24
        }
25
26 3
        return null;
27
    }
28
}
29