Passed
Push — features/scrutinizer_conf ( cf2d4a...45dfb6 )
by Nicolas
01:09
created

ConfigurationManager::check()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: nicolas
5
 * Date: 18/02/17
6
 * Time: 07:07
7
 */
8
9
namespace Devgiants\Configuration;
10
11
12
use Symfony\Component\Config\Definition\Processor;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Config\Definition\Processor was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Symfony\Component\Yaml\Yaml;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Yaml\Yaml was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
class ConfigurationManager
16
{
17
    /**
18
     * @var string
19
     */
20
    private $configurationFile;
21
22
    public function __construct($filePath) {
23
        $this->configurationFile = $filePath;
24
    }
25
    /**
26
     * @return string
27
     */
28
    public function getConfigurationFile()
29
    {
30
        return $this->configurationFile;
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function load() {
37
        // TODO check exception behavior
38
        $configuration = Yaml::parse(file_get_contents($this->configurationFile));
39
40
        return $this->check($configuration);
41
    }
42
43
44
    /**
45
     * @param $configurationUnprocessed
46
     * @return array
47
     */
48
    private function check($configurationUnprocessed) {
49
        $processor = new Processor();
50
        $applicationConfiguration = new ApplicationConfiguration();
51
        $processedConfiguration = $processor->processConfiguration($applicationConfiguration, $configurationUnprocessed);
52
        return $processedConfiguration;
53
    }
54
}