PrintMatrixTestCommand::chooseSearchablePlaces()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 1
dl 0
loc 13
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
namespace GGGGino\WarehousePath\Tools\Console\Command;
4
5
use GGGGino\WarehousePath\Entity\Place;
6
use GGGGino\WarehousePath\Warehouse;
7
use Symfony\Component\Console\Command\Command;
8
use Symfony\Component\Console\Helper\Table;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class PrintMatrixTestCommand extends Command
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('ggggino:warehouse:print-matrix')
21
            ->setDescription('Print a beautiful matrix with the shortest path')
22
            ->setHelp(<<<EOT
23
Print a beautiful matrix.
24
EOT
25
            );
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        /** @var Warehouse $warehouse */
34
        $warehouse = Warehouse::createFromJson(getcwd() . "/./resources/simpleWarehouse.json");
35
36
        $this->printTable($output, array(), $warehouse->createMatrix());
37
    }
38
39
    /**
40
     * Output the table for debug purpose
41
     *
42
     * @param OutputInterface $output
43
     * @param array $arrayNodes
44
     * @param array $matrix
45
     */
46
    private function printTable(OutputInterface $output, array $arrayNodes, array $matrix)
0 ignored issues
show
Unused Code introduced by
The parameter $arrayNodes is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

46
    private function printTable(OutputInterface $output, /** @scrutinizer ignore-unused */ array $arrayNodes, array $matrix)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
47
    {
48
        $table = new Table($output);
49
        $table
50
            ->setRows($matrix)
51
        ;
52
        $table->render();
53
    }
54
55
    /**
56
     * Select the Places for find the path
57
     *
58
     * @param Place[] $calculatedArray
59
     * @return Place[]
60
     */
61
    private function chooseSearchablePlaces($calculatedArray)
0 ignored issues
show
Unused Code introduced by
The method chooseSearchablePlaces() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
62
    {
63
        return array(
64
            $calculatedArray[103],
65
            $calculatedArray[30],
66
            $calculatedArray[23],
67
            $calculatedArray[57],
68
            $calculatedArray[135],
69
            $calculatedArray[120],
70
            $calculatedArray[115],
71
            $calculatedArray[79],
72
            $calculatedArray[601],
73
            $calculatedArray[650]
74
        );
75
    }
76
}
77