Passed
Pull Request — master (#6)
by Dmitriy
58:09 queued 43:13
created

Defines::hasConstants()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yiisoft\Composer\Config\Configs;
4
5
/**
6
 * Defines class represents output configuration file with constant definitions.
7
 */
8
class Defines 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 hasConstants(): bool
31
    {
32
        return true;
33
    }
34
35
    public function hasParams(): bool
36
    {
37
        return true;
38
    }
39
}
40