Passed
Branch develop (6d6783)
by BENARD
03:42
created

TeamCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 12 3
A configure() 0 8 1
1
<?php
2
namespace VideoGamesRecords\DwhBundle\Command;
3
4
use Exception;
5
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
use VideoGamesRecords\DwhBundle\Service\Dwh\DwhTeamHandler;
10
11
class TeamCommand extends Command
12
{
13
    protected static $defaultName = 'vgr-dwh:team';
14
15
    private DwhTeamHandler $dwhTeamHandler;
16
17
    public function __construct(DwhTeamHandler $dwhTeamHandler)
18
    {
19
        $this->dwhTeamHandler = $dwhTeamHandler;
20
        parent::__construct();
21
    }
22
23
    protected function configure()
24
    {
25
        $this->setName('vgr-dwh:team')
26
            ->setDescription('Command to update table vgr_team')
27
            ->addArgument(
28
                'function',
29
                InputArgument::REQUIRED,
30
                'Who do you want to do?'
31
            );
32
    }
33
34
    /**
35
     * @param InputInterface  $input
36
     * @param OutputInterface $output
37
     * @return int
38
     * @throws Exception
39
     */
40
    protected function execute(InputInterface $input, OutputInterface $output): int
41
    {
42
        $function = $input->getArgument('function');
43
        switch ($function) {
44
            case 'maj':
45
                $this->dwhTeamHandler->process();
46
                break;
47
            case 'purge':
48
                $this->dwhTeamHandler->purge();
49
                break;
50
        }
51
        return 0;
52
    }
53
}
54