ConfigPatcher   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 39
ccs 8
cts 13
cp 0.6153
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A patch() 0 5 2
A __construct() 0 12 2
1
<?php
2
3
/**
4
 * Copyright MediaCT. All rights reserved.
5
 * https://www.mediact.nl
6
 */
7
8
declare(strict_types=1);
9
10
namespace Mediact\CodingStandard\PhpStorm\Patcher;
11
12
use Mediact\CodingStandard\PhpStorm\EnvironmentInterface;
13
use Mediact\CodingStandard\PhpStorm\XmlAccessor;
14
15
class ConfigPatcher implements ConfigPatcherInterface
16
{
17
    /**
18
     * @var ConfigPatcherInterface[]
19
     */
20
    private $patchers;
21
22
    /**
23
     * Constructor.
24
     *
25
     * @param array $patchers
26
     */
27 1
    public function __construct(array $patchers = null)
28
    {
29 1
        $xmlAccessor = new XmlAccessor();
30
31 1
        $this->patchers = $patchers !== null
32 1
            ? $patchers
33
            : [
34
                new CodeStylePatcher(),
35
                new FileTemplatesPatcher($xmlAccessor),
36
                new InspectionsPatcher($xmlAccessor),
37
                new TemplateSettingsPatcher($xmlAccessor),
38
                new LiveTemplatesPatcher()
39
            ];
40 1
    }
41
42
    /**
43
     * Patch the config.
44
     *
45
     * @param EnvironmentInterface $environment
46
     *
47
     * @return void
48
     */
49 1
    public function patch(
50
        EnvironmentInterface $environment
51
    ): void {
52 1
        foreach ($this->patchers as $patcher) {
53 1
            $patcher->patch($environment);
54
        }
55 1
    }
56
}
57