ModernDetector::detect()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 3
nop 1
crap 3
1
<?php
2
3
namespace Buttress\Concrete\Locator\Detector;
4
5
use Buttress\Concrete\Locator\Site;
6
7
class ModernDetector implements Detector
8
{
9
10 9
    public function detect($path)
11
    {
12 9
        if (file_exists($path . '/concrete/config/concrete.php')) {
13 6
            $data = @include $path . '/concrete/config/concrete.php';
14 6
            if (isset($data['version'])) {
15 3
                return (new Site())->setPath($path)->setVersion($data['version']);
16
            }
17 2
        }
18
19 6
        return null;
20
    }
21
}
22