GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

RollbackCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 5

Size

Total Lines 12
Code Lines 8

Duplication

Lines 12
Ratio 100 %

Importance

Changes 5
Bugs 2 Features 1
Metric Value
c 5
b 2
f 1
dl 12
loc 12
rs 9.4285
cc 2
eloc 8
nc 5
nop 2
1
<?php
2
3
namespace Czogori\DamiBundle\Command;
4
5
use Symfony\Component\Console\Input\InputArgument,
6
    Symfony\Component\Console\Input\InputInterface,
7
    Symfony\Component\Console\Output\OutputInterface;
8
9
use Dami\Cli\Command\RollbackCommand as DamiRollbackCommand;
10
11 View Code Duplication
class RollbackCommand extends AbstractCommand
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    protected function configure()
17
    {
18
        $this
19
            ->setName('dami:rollback')
20
            ->setDescription('Rollback migrations.')
21
            ->addArgument('to-version', InputArgument::OPTIONAL, 'Rollback to specific version of migrations');
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        try {
30
            $this->prepareMigrationDirectory();
31
32
            $migration = $this->getContainer()->get('dami.migration');
0 ignored issues
show
Unused Code introduced by
$migration 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...
33
            $damiStatusCommand = new DamiRollbackCommand($this->getName(), $this->getContainer());
34
            $damiStatusCommand->execute($input, $output);
35
        } catch (\Exception $e) {
36
            $output->writeln(sprintf("<error>%s</error>", $e->getMessage()));
37
        }
38
    }
39
}
40