Passed
Push — issue#777 ( 7b5785...f6ccb8 )
by Guilherme
05:28
created

BadgesSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 2
cts 2
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace LoginCidadao\BadgesControlBundle\Event;
4
5
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
6
use LoginCidadao\BadgesControlBundle\BadgesEvents;
7
use LoginCidadao\BadgesControlBundle\Handler\BadgesHandler;
8
9
class BadgesSubscriber implements EventSubscriberInterface
10
{
11
    /** @var BadgesHandler */
12
    protected $handler;
13
14
    public function __construct(BadgesHandler $handler)
15
    {
16
        $this->handler = $handler;
17
    }
18
19 1
    public static function getSubscribedEvents()
20
    {
21
        return array(
22 1
            BadgesEvents::BADGES_REGISTER_EVALUATOR => array('onRegisterEvaluator',
23
                0),
24
            BadgesEvents::BADGES_EVALUATE => array('onBadgeEvaluate', 0)
25
        );
26
    }
27
28
    public function onBadgeEvaluate(EvaluateBadgesEvent $event)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    public function onBadgeEvaluate(/** @scrutinizer ignore-unused */ EvaluateBadgesEvent $event)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        //
31
    }
32
33
    public function onRegisterEvaluator(RegisterEvaluatorEvent $event)
34
    {
35
        $evaluator = $event->getEvaluator();
36
        $id        = $evaluator->getName();
37
        $this->handler->register($evaluator);
38
        error_log("Evaluator $id registered");
39
    }
40
}
41