CreateSourceDirectories   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 11 3
A getPriority() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the skeleton package.
7
 *
8
 * (c) Gennady Knyazkin <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Gennadyx\Skeleton\Action;
15
16
use Gennadyx\Skeleton\Action\Traits\FilesystemAwareTrait;
17
use Gennadyx\Skeleton\Action\Traits\VarAwareTrait;
18
use Gennadyx\Skeleton\VarAwareInterface;
19
20
/**
21
 * Class CreateSourceDirectories
22
 *
23
 * @author Gennady Knyazkin <[email protected]>
24
 */
25
final class CreateSourceDirectories implements ActionInterface, VarAwareInterface
26
{
27
    use VarAwareTrait,
28
        FilesystemAwareTrait;
29
30
    /**
31
     * Execute action
32
     *
33
     * @return void
34
     * @throws \RuntimeException
35
     */
36 2
    public function execute()
37
    {
38 2
        foreach (['src', 'tests'] as $name) {
39 2
            $directory = $this->vars['root'].'/'.$name;
40
41 2
            if (!is_dir($directory)) {
42 2
                $this->fs->mkdir($directory);
43 2
                $this->fs->touch(sprintf('%s/.gitkeep', $directory));
44
            }
45
        }
46 2
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51 4
    public function getPriority(): int
52
    {
53 4
        return 5;
54
    }
55
}
56