RemoveSkeletonDirectory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0
ccs 5
cts 7
cp 0.7143

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 2
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
use Symfony\Component\Filesystem\Exception\IOException;
20
21
/**
22
 * Class RemoveSkeletonDirectory
23
 *
24
 * @author Gennady Knyazkin <[email protected]>
25
 */
26
final class RemoveSkeletonDirectory implements ActionInterface, VarAwareInterface
27
{
28
    use VarAwareTrait,
29
        FilesystemAwareTrait;
30
31
    /**
32
     * Execute action
33
     *
34
     * @return void
35
     * @throws \RuntimeException
36
     */
37 2
    public function execute()
38
    {
39
        try {
40 2
            $this->fs->remove($this->vars['skeleton']);
41
        } catch (IOException $e) {
42
            throw new \RuntimeException($e->getMessage(), $e->getCode(), $e);
43
        }
44 2
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 4
    public function getPriority(): int
50
    {
51 4
        return 4;
52
    }
53
}
54