Passed
Pull Request — master (#8)
by Dmitriy
11:32 queued 10s
created

Constants   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 35
rs 10
c 1
b 0
f 0
wmc 7

5 Methods

Rating   Name   Duplication   Size   Complexity  
A loadFile() 0 8 2
A constantsRequires() 0 3 1
A paramsRequires() 0 3 1
A envRequires() 0 3 1
A buildRequires() 0 8 2
1
<?php
2
3
namespace Yiisoft\Composer\Config\Configs;
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 constantsRequires(): bool
31
    {
32
        return false;
33
    }
34
35
    public function envRequires(): bool
36
    {
37
        return false;
38
    }
39
40
    public function paramsRequires(): bool
41
    {
42
        return false;
43
    }
44
}
45