Passed
Push — develop ( f837ec...edf506 )
by BENARD
06:13
created

PlayerBadgeUpdateCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

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