Passed
Push — master ( fafb88...d2829c )
by Marek
02:46
created

RemoveDoneTicketTask::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace AppBuilder\Application\Module\TaskManager\Task;
6
7
use AppBuilder\Application\Configuration\ValueObject\Parameters;
8
use AppBuilder\Application\Model\ValueObject\Ticket;
9
use AppBuilder\Application\Utils\FileManager\FileManagerService;
10
use Symfony\Component\Filesystem\Exception\IOException;
11
12
class RemoveDoneTicketTask implements Task
13
{
14
    /** @var Ticket */
15
    private $ticket;
16
17
    /** @var string */
18
    private $homeDir;
19
20
    /** @var FileManagerService */
21
    private $fileManager;
22
23 1
    public function __construct(Ticket $ticket, Parameters $applicationParams, FileManagerService $fileManager)
24
    {
25 1
        $this->ticket      = $ticket;
26 1
        $this->homeDir     = $applicationParams->projectsHomeDir();
27 1
        $this->fileManager = $fileManager;
28 1
    }
29
30
    /**
31
     * Removes application directory when its done.
32
     *
33
     * @throws IOException
34
     */
35 1
    public function execute() : void
36
    {
37 1
        $this->fileManager->remove($this->homeDir . $this->ticket->key());
38 1
    }
39
}
40