Constants   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
wmc 6
eloc 11
c 0
b 0
f 0
dl 0
loc 30
ccs 8
cts 14
cp 0.5714
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A loadFile() 0 8 2
A constantsRequired() 0 3 1
A buildRequires() 0 8 2
A paramsRequired() 0 3 1
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