Test Failed
Pull Request — master (#3)
by MediaCT
06:30
created

ConfigPatcher   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A patch() 0 5 2
A __construct() 0 10 2
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