Passed
Pull Request — master (#6)
by ANTHONIUS
02:38
created

RestoreCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the dotfiles project.
7
 *
8
 *     (c) Anthonius Munthi <[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 Dotfiles\Core\Command;
15
16
use Dotfiles\Core\Processor\Hooks;
17
use Dotfiles\Core\Processor\Patcher;
18
use Dotfiles\Core\Processor\Template;
19
use Symfony\Component\Console\Input\InputInterface;
20
use Symfony\Component\Console\Output\OutputInterface;
21
22
class RestoreCommand extends Command
23
{
24
    /**
25
     * @var Hooks
26
     */
27
    private $hooks;
28
29
    /**
30
     * @var Patcher
31
     */
32
    private $patcher;
33
    /**
34
     * @var Template
35
     */
36
    private $template;
37
38
    public function __construct(
39
        ?string $name = null,
40
        Template $template,
41
        Patcher $patcher,
42
        Hooks $hooks
43
    ) {
44
        parent::__construct($name);
45
        $this->template = $template;
46
        $this->patcher = $patcher;
47
        $this->hooks = $hooks;
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    protected function configure(): void
54
    {
55
        $this
56
            ->setName('restore')
57
            ->setDescription('Restore dotfiles from backup')
58
        ;
59
    }
60
61
    protected function execute(InputInterface $input, OutputInterface $output): void
62
    {
63
        $this->template->run();
64
        $this->patcher->run();
65
        $this->hooks->run();
66
    }
67
}
68