RestoreCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
A __construct() 0 10 1
A configure() 0 5 1
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
    /**
35
     * @var Template
36
     */
37
    private $template;
38
39
    public function __construct(
40
        ?string $name = null,
41
        Template $template,
42
        Patcher $patcher,
43
        Hooks $hooks
44
    ) {
45
        parent::__construct($name);
46
        $this->template = $template;
47
        $this->patcher = $patcher;
48
        $this->hooks = $hooks;
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    protected function configure(): void
55
    {
56
        $this
57
            ->setName('restore')
58
            ->setDescription('Restore dotfiles from backup')
59
        ;
60
    }
61
62
    protected function execute(InputInterface $input, OutputInterface $output): void
63
    {
64
        $this->template->run();
65
        $this->patcher->run();
66
        $this->hooks->run();
67
    }
68
}
69