Command::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of gpupo/pipe2
5
 *
6
 * (c) Gilmar Pupo <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * For more information, see
12
 * <https://opensource.gpupo.com/pipe2/>.
13
 */
14
15
namespace Gpupo\Pipe2\Documentor;
16
17
use Symfony\Component\Console\Command\Command as Core;
18
use Symfony\Component\Console\Input\InputArgument;
19
use Symfony\Component\Console\Input\InputInterface;
20
use Symfony\Component\Console\Output\OutputInterface;
21
22
class Command extends Core
23
{
24
    protected function configure()
25
    {
26
        parent::configure();
27
        $this
28
            ->setName('documentor')
29
            ->setDescription('Generate Markdown Documentation from PhpUnit XML')
30
            ->addArgument(
31
                'inputFile',
32
                InputArgument::REQUIRED,
33
                'PhpUnit Xml file path'
34
            )
35
            ->addArgument(
36
                'outputFile',
37
                InputArgument::REQUIRED,
38
                'Output file path'
39
            );
40
    }
41
42
    protected function getParameters(InputInterface $input)
43
    {
44
        $parameters = [];
45
46
        foreach (['inputFile', 'outputFile'] as $argument) {
47
            $parameters[$argument] = $input->getArgument($argument);
48
        }
49
50
        return $parameters;
51
    }
52
53
    protected function execute(InputInterface $input, OutputInterface $output)
54
    {
55
        $parameters = $this->getParameters($input);
56
        $validator = new InputValidator();
57
58
        if ($validator->validateInputParameters($parameters)) {
59
            $converter = new Converter($parameters);
0 ignored issues
show
Unused Code introduced by
$converter 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...
60
            $output->writeln('Generated '.$parameters['outputFile']);
61
        }
62
    }
63
}
64