Failed Conditions
Pull Request — master (#8)
by Yo
07:49 queued 05:41
created

SfKernelLoggerSubscriber::getSubscribedEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\Subscriber;
3
4
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
5
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
6
use Symfony\Component\HttpKernel\Kernel;
7
use Yoanm\Behat3SymfonyExtension\Event\KernelEvent;
8
use Yoanm\Behat3SymfonyExtension\Logger\SfKernelEventLogger;
9
10
/**
11
 * Class SfKernelLoggerSubscriber
12
 */
13
class SfKernelLoggerSubscriber implements EventSubscriberInterface
14
{
15
    /** @var SfKernelEventLogger */
16
    private $sfKernelEventLogger;
17
18
    /**
19
     * @param Kernel $kernel
0 ignored issues
show
Documentation introduced by
There is no parameter named $kernel. Did you maybe mean $sfKernelEventLogger?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
20
     */
21 2
    public function __construct(SfKernelEventLogger $sfKernelEventLogger)
22
    {
23 2
        $this->sfKernelEventLogger = $sfKernelEventLogger;
24 2
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1
    public static function getSubscribedEvents()
30
    {
31
        return [
32 1
            KernelEvent::AFTER_BOOT => 'initSfKernelLogger',
33 1
        ];
34
    }
35
36
    /**
37
     * @param KernelEvent $event
38
     */
39 1
    public function initSfKernelLogger(KernelEvent $event)
40
    {
41
        /** @var EventDispatcherInterface $eventDispatcher the event dispatcher of SF application (not behat one)*/
42 1
        $eventDispatcher = $event->getKernel()->getContainer()->get('event_dispatcher');
43
44 1
        $eventDispatcher->addSubscriber($this->sfKernelEventLogger);
45 1
    }
46
}
47