Passed
Push — develop ( 04f018...e920eb )
by BENARD
04:15
created

PlayerBadgeUpdateCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 11
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A __construct() 0 4 1
A configure() 0 7 1
1
<?php
2
namespace VideoGamesRecords\CoreBundle\Command;
3
4
use Doctrine\DBAL\Exception;
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use VideoGamesRecords\CoreBundle\Handler\Badge\PlayerBadgeHandler;
9
10
class PlayerBadgeUpdateCommand extends Command
11
{
12
    protected static $defaultName = 'vgr-core:player-badge-update';
13
14
    private PlayerBadgeHandler $playerBadgeHandler;
15
16
    public function __construct(PlayerBadgeHandler $playerBadgeHandler)
17
    {
18
        $this->playerBadgeHandler = $playerBadgeHandler;
19
        parent::__construct();
20
    }
21
22
    protected function configure(): void
23
    {
24
        $this
25
            ->setName('vgr-core:player-badge-update')
26
            ->setDescription('Command to maj player badges')
27
        ;
28
        parent::configure();
29
    }
30
31
    /**
32
     * @param InputInterface  $input
33
     * @param OutputInterface $output
34
     * @return int
35
     * @throws Exception
36
     */
37
    protected function execute(InputInterface $input, OutputInterface $output): int
38
    {
39
        $this->playerBadgeHandler->process();
40
        return Command::SUCCESS;
41
    }
42
}
43