Passed
Push — develop ( a1dd18...3f55cc )
by BENARD
04:37
created

UpdateTeamMasterBadgeSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 23
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 4 1
A process() 0 3 1
A __construct() 0 3 1
1
<?php
2
namespace VideoGamesRecords\CoreBundle\EventSubscriber\Badge;
3
4
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
5
use VideoGamesRecords\CoreBundle\Event\GameEvent;
6
use VideoGamesRecords\CoreBundle\Service\Badge\TeamMasterBadgeHandler;
7
use VideoGamesRecords\CoreBundle\VideoGamesRecordsCoreEvents;
8
9
final class UpdateTeamMasterBadgeSubscriber implements EventSubscriberInterface
10
{
11
    private TeamMasterBadgeHandler $teamMasterBadgeHandler;
12
13
    public function __construct(TeamMasterBadgeHandler $teamMasterBadgeHandler)
14
    {
15
        $this->teamMasterBadgeHandler = $teamMasterBadgeHandler;
16
    }
17
18
    public static function getSubscribedEvents(): array
19
    {
20
        return [
21
            VideoGamesRecordsCoreEvents::TEAM_GAME_MAJ_COMPLETED => 'process',
22
        ];
23
    }
24
25
26
    /**
27
     * @param GameEvent $event
28
     */
29
    public function process(GameEvent $event): void
30
    {
31
        $this->teamMasterBadgeHandler->process($event->getGame());
32
    }
33
}
34