Passed
Push — master ( 27afec...e8b4e9 )
by Klaas
01:42 queued 14s
created

LiveTemplatesPatcher::patch()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 6
cp 0
crap 6
rs 10
1
<?php declare(strict_types=1);
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\FilesystemInterface;
11
12
class LiveTemplatesPatcher implements ConfigPatcherInterface
13
{
14
    use CopyFilesTrait;
15
16
    /**
17
     * Patch the config.
18
     *
19
     * @param EnvironmentInterface $environment
20
     *
21
     * @return void
22
     */
23
    public function patch(
24
        EnvironmentInterface $environment
25
    ): void {
26
        if (! empty($environment->getIdeDefaultConfigFilesystem()->getRoot())) {
27
            $this->copyDirectory(
28
                $environment->getDefaultsFilesystem(),
29
                $environment->getIdeDefaultConfigFilesystem(),
30
                'templates'
31
            );
32
        }
33
    }
34
}
35