GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 512ed0...66c291 )
by Bruno
01:45
created

PlaceholdersRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace Ciandt\Behat\PlaceholdersExtension\Config;
3
4
use Symfony\Component\Yaml\Yaml;
5
6
/**
7
 * Description of ConfigsRepository
8
 *
9
 * @author bwowk
10
 */
11
class PlaceholdersRepository
12
{
13
14
    private $configs;
15
16
    /**
17
     * @var string
18
     */
19
    private $environment;
20
21
    public function __construct($configs_mapping)
22
    {
23
        $this->configs = array();
24
        $this->loadConfigFiles($configs_mapping);
25
    }
26
27
    /**
28
     *
29
     * @return string[]
30
     * @todo read configs and also bring alternative @config:section tags
31
     */
32
    public function getTags()
33
    {
34
        return array_keys($this->configs);
35
    }
36
37
    /**
38
     *
39
     * @param type $config_files
0 ignored issues
show
Bug introduced by
There is no parameter named $config_files. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
40
     * @todo user %paths.base% value
41
     */
42
    private function loadConfigFiles($configs_mapping)
43
    {
44
        $placeholder_maps = array();
45
        foreach ($configs_mapping as $tag => $file_path) {
46
            $placeholder_maps[$tag]['config'] = Yaml::parse(file_get_contents($file_path));
47
            $placeholder_maps[$tag]['path'] = $file_path;
48
        }
49
        $this->configs = $placeholder_maps;
50
    }
51
52
    public function getConfigSection($tag, $section)
53
    {
54
        if ($this->hasTag($tag)) {
55
            return $this->configs[$tag]['config'][$section];
56
        }
57
        return null;
58
    }
59
60
    public function getFilePath($tag)
61
    {
62
        if ($this->hasTag($tag)) {
63
            return $this->configs[$tag]['path'];
64
        }
65
        return null;
66
    }
67
68
    public function hasTag($tag)
69
    {
70
        if (key_exists($tag, $this->configs)) {
71
            return true;
72
        } else {
73
            return false;
74
        }
75
    }
76
    
77
    public function getEnvironment()
78
    {
79
        return $this->environment;
80
    }
81
82
    public function setEnvironment($environment)
83
    {
84
        $this->environment = $environment;
85
    }
86
}
87