Test Failed
Pull Request — master (#3)
by MediaCT
03:44
created

ConfigPatcher::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 6
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
rs 9.4285
1
<?php
2
/**
3
 * Copyright MediaCT. All rights reserved.
4
 * https://www.mediact.nl
5
 */
6
7
namespace Mediact\CodingStandard\PhpStorm\Patcher;
8
9
use Mediact\CodingStandard\PhpStorm\EnvironmentInterface;
10
use Mediact\CodingStandard\PhpStorm\XmlAccessor;
11
12
class ConfigPatcher implements ConfigPatcherInterface
13
{
14
    /**
15
     * @var ConfigPatcherInterface[]
16
     */
17
    private $patchers;
18
19
    /**
20
     * Constructor.
21
     *
22
     * @param array $patchers
23
     */
24
    public function __construct(array $patchers = null)
25
    {
26
        $xmlAccessor = new XmlAccessor();
27
28
        $this->patchers = $patchers !== null
29
            ? $patchers
30
            : [
31
                new CodeStylePatcher(),
32
                new FileTemplatesPatcher($xmlAccessor),
33
                new InspectionsPatcher($xmlAccessor)
34
            ];
35
    }
36
37
    /**
38
     * Patch the config.
39
     *
40
     * @param EnvironmentInterface $environment
41
     *
42
     * @return void
43
     */
44
    public function patch(
45
        EnvironmentInterface $environment
46
    ) {
47
        foreach ($this->patchers as $patcher) {
48
            $patcher->patch($environment);
49
        }
50
    }
51
}
52