Completed
Push — dev ( 4deee6...a8b68f )
by Zach
02:10
created

MigrateRollback::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
rs 9.4285
1
<?php
2
3
namespace Yarak\Commands;
4
5
use Yarak\Output\SymfonyOutput;
6
use Symfony\Component\Console\Input\InputOption;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
class MigrateRollback extends YarakCommand
11
{
12
    /**
13
     * Configure the command.
14
     */
15
    protected function configure()
16
    {
17
        $this->setName('migrate:rollback')
18
            ->setDescription('Rollback migrations by given number of steps.')
19
            ->setHelp('This command allows you to rollback migrations.')
20
            ->addOption(
21
                'steps',
22
                null,
23
                InputOption::VALUE_OPTIONAL,
24
                'Number of steps to rollback.',
25
                1
26
            );
27
    }
28
29
    /**
30
     * Execute the command.
31
     *
32
     * @param InputInterface  $input
33
     * @param OutputInterface $output
34
     */
35
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37
        $migrator = $this->getMigrator(new SymfonyOutput($output))
0 ignored issues
show
Unused Code introduced by
$migrator is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
38
            ->rollback($input->getOption('steps'));
39
    }
40
}
41