Passed
Pull Request — master (#22)
by Dmitriy
37:40 queued 22:25
created

Constants::buildRequires()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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