Constants::buildRequires()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 8
ccs 4
cts 5
cp 0.8
rs 10
cc 2
nc 2
nop 0
crap 2.032
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Config;
6
7
/**
8
 * Defines class represents output configuration file with constant definitions.
9
 */
10
class Constants extends ConfigOutput
11
{
12
    protected function loadFile(string $path): array
13
    {
14
        parent::loadFile($path);
15
        if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
16
            return [];
17
        }
18
19
        return [$path];
20
    }
21
22 2
    public function buildRequires(): string
23
    {
24 2
        $res = [];
25 2
        foreach ($this->values as $path) {
26
            $res[] = "require_once '$path';";
27
        }
28
29 2
        return implode("\n", $res);
30
    }
31
32 2
    protected function constantsRequired(): bool
33
    {
34 2
        return false;
35
    }
36
37 2
    protected function paramsRequired(): bool
38
    {
39 2
        return false;
40
    }
41
}
42