Completed
Pull Request — 2.1 (#7)
by David
02:07
created

ResetPatchesCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 2
cbo 2
dl 0
loc 33
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 17 1
A execute() 0 6 1
1
<?php
2
namespace Mouf\Utils\Patcher\Commands;
3
4
use Mouf\Utils\Patcher\PatchInterface;
5
use Mouf\Utils\Patcher\PatchService;
6
use Symfony\Component\Console\Helper\Table;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Command\Command;
12
13
/**
14
 * Command to reset and reapply all patches
15
 */
16
class ResetPatchesCommand extends AbstractApplyAllCommand
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    protected function configure()
22
    {
23
        $this
24
        ->setName('patches:reset')
25
        ->setDescription('Reset database and reapply all patches.')
26
        ->setDefinition(array(
27
28
        ))
29
        ->setHelp(<<<EOT
30
Reset the database and reapplies all pending patches. You can select the type of patches to be applied using the options. Default patches are always applied.
31
32
Use patches:apply-all if you want to apply remaining patches without resetting the database.
33
EOT
34
        );
35
36
        $this->registerOptions();
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $this->patchService->reset();
45
46
        $this->applyAll($input, $output);
47
    }
48
}
49