RemoveSkeletonDirectory::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.2559

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
ccs 3
cts 5
cp 0.6
cc 2
eloc 5
nc 2
nop 0
crap 2.2559
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