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

UpdatePlayerCountryBadgeSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
c 0
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\CountryEvent;
6
use VideoGamesRecords\CoreBundle\Service\Badge\CountryBadgeHandler;
7
use VideoGamesRecords\CoreBundle\VideoGamesRecordsCoreEvents;
8
9
final class UpdatePlayerCountryBadgeSubscriber implements EventSubscriberInterface
10
{
11
    private CountryBadgeHandler $countryBadgeHandler;
12
13
    public function __construct(CountryBadgeHandler $countryBadgeHandler)
14
    {
15
        $this->countryBadgeHandler = $countryBadgeHandler;
16
17
    }
18
19
    public static function getSubscribedEvents(): array
20
    {
21
        return [
22
            VideoGamesRecordsCoreEvents::COUNTRY_MAJ_COMPLETED => 'process',
23
        ];
24
    }
25
26
    /**
27
     * @param CountryEvent $event
28
     */
29
    public function process(CountryEvent $event)
30
    {
31
        $this->countryBadgeHandler->process($event->getCountry());
32
    }
33
}
34