Command   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 2
b 0
f 0
dl 0
loc 36
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 5 1
A configure() 0 5 1
1
<?php
2
3
namespace AppBundle\ConsolidateUsedFiles;
4
5
use Symfony\Component\Console\Command\Command as BaseCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use Symfony\Component\Console\Style\SymfonyStyle;
10
11
/**
12
 * Symfony-Console-Command wrapper for the ConsolidateUsedFiles task.
13
 */
14
final class Command extends BaseCommand
15
{
16
    const ARGUMENT_USED_FILES = 'usedFiles';
17
18
    /**
19
     * @var Task
20
     */
21
    private $task;
22
23
    /**
24
     * @param Task $task
25
     */
26
    public function __construct(Task $task)
27
    {
28
        parent::__construct();
29
        $this->task = $task;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function configure()
36
    {
37
        $this->setName('consolidate-used-files')
38
             ->setDescription('Consolidate the list of unused PHP files to improve performance of later commands and readability for human readers.')
39
             ->addArgument(self::ARGUMENT_USED_FILES, InputArgument::REQUIRED, 'Path to the list of used files.');
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    protected function execute(InputInterface $input, OutputInterface $output)
46
    {
47
        $this->task->consolidate(
48
            $input->getArgument(self::ARGUMENT_USED_FILES),
0 ignored issues
show
Bug introduced by
It seems like $input->getArgument(self::ARGUMENT_USED_FILES) can also be of type string[]; however, parameter $userProvidedPathToConsolidate of AppBundle\ConsolidateUsedFiles\Task::consolidate() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

48
            /** @scrutinizer ignore-type */ $input->getArgument(self::ARGUMENT_USED_FILES),
Loading history...
49
            new SymfonyStyle($input, $output)
50
        );
51
    }
52
}
53