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
Branch feature/normalise_config_files... (e124b9)
by Marc
03:34
created

ChapiConfigLoader::setParameters()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
crap 12
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2017-03-20
7
 *
8
 */
9
10
namespace Chapi\Component\DependencyInjection\Loader;
11
12
13
use Chapi\Component\Config\ChapiConfigInterface;
14
use Doctrine\Instantiator\Exception\InvalidArgumentException;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
class ChapiConfigLoader implements ChapiConfigLoaderInterface
18
{
19
    /**
20
     * @var ContainerBuilder
21
     */
22
    private $oContainer;
23
24
    /**
25
     * @var ChapiConfigInterface
26
     */
27
    private $oConfig;
28
29
    /**
30
     * ChapiConfigLoader constructor.
31
     * @param ContainerBuilder $oContainer
32
     * @param ChapiConfigInterface $oConfig
33
     */
34
    public function __construct(ContainerBuilder $oContainer, ChapiConfigInterface $oConfig)
35
    {
36
        $this->oContainer = $oContainer;
37
        $this->oConfig = $oConfig;
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    public function loadProfileParameters()
44
    {
45
        $_aContent = $this->oConfig->getProfileConfig();
46
47
        $this->oContainer->addObjectResource($this->oConfig);
48
49
        // empty config
50
        if (empty($_aContent)) {
51
            return;
52
        }
53
54
        // parameters
55
        if (isset($_aContent['parameters'])) {
56
            $this->setParameters($_aContent['parameters']);
57
        }
58
    }
59
60
    /**
61
     * @param array $aParameters
62
     */
63
    private function setParameters(array &$aParameters)
64
    {
65
        if (!is_array($aParameters)) {
66
            throw new InvalidArgumentException('The "parameters" key should contain an array. Please check your configuration files.');
67
        }
68
69
        foreach ($aParameters as $key => $value) {
70
            $this->oContainer->setParameter($key, $value);
71
        }
72
    }
73
}