LiveTemplatesPatcher::patch()   A
last analyzed

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
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\FilesystemInterface;
14
15
class LiveTemplatesPatcher implements ConfigPatcherInterface
16
{
17
    use CopyFilesTrait;
18
19
    /**
20
     * Patch the config.
21
     *
22
     * @param EnvironmentInterface $environment
23
     *
24
     * @return void
25
     */
26
    public function patch(
27
        EnvironmentInterface $environment
28
    ): void {
29
        if (! empty($environment->getIdeDefaultConfigFilesystem()->getRoot())) {
30
            $this->copyDirectory(
31
                $environment->getDefaultsFilesystem(),
32
                $environment->getIdeDefaultConfigFilesystem(),
33
                'templates'
34
            );
35
        }
36
    }
37
}
38