Failed Conditions
Push — feature/improve ( ac6d69...acfd74 )
by Yo
02:11
created

Kernel::shutdown()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 16
cp 0
rs 9.3142
c 0
b 0
f 0
cc 2
eloc 11
nc 2
nop 0
crap 6
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\Kernel;
3
4
use Symfony\Component\EventDispatcher\EventDispatcher;
5
use Yoanm\Behat3SymfonyExtension\Context\BehatDispatcherAwareInterface;
6
use Yoanm\Behat3SymfonyExtension\Event\Events;
7
use Yoanm\Behat3SymfonyExtension\Event\KernelEvent;
8
9
class Kernel implements BehatDispatcherAwareInterface
10
{
11
    /** @var EventDispatcher */
12
    private $eventDispatcher;
13
14
    /**
15
     * @inheritDoc
16
     */
17
    public function setBehatDispatcher(EventDispatcher $eventDispatcher)
18
    {
19
        $this->eventDispatcher = $eventDispatcher;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function boot()
26
    {
27
        if (true === $this->booted) {
28
            return;
29
        }
30
31
        $event = new KernelEvent($this);
32
        $this->eventDispatcher->dispatch(
33
            Events::BEFORE_KERNEL_BOOT,
34
            $event
35
        );
36
37
        parent::boot();
38
39
        $this->eventDispatcher->dispatch(
40
            Events::AFTER_KERNEL_BOOT,
41
            $event
42
        );
43
44
    }
0 ignored issues
show
Coding Style introduced by
Function closing brace must go on the next line following the body; found 1 blank lines before brace
Loading history...
45
46
    /**
47
     * {@inheritdoc}
48
     */
49
    public function shutdown()
50
    {
51
        if (false === $this->booted) {
52
            return;
53
        }
54
55
        $event = new KernelEvent($this);
56
        $this->eventDispatcher->dispatch(
57
            Events::BEFORE_KERNEL_SHUTDOWN,
58
0 ignored issues
show
Coding Style introduced by
Empty lines are not allowed in multi-line function calls
Loading history...
59
            $event
60
        );
61
62
        parent::shutdown();
63
64
        $this->eventDispatcher->dispatch(
65
            Events::AFTER_KERNEL_SHUTDOWN,
66
0 ignored issues
show
Coding Style introduced by
Empty lines are not allowed in multi-line function calls
Loading history...
67
            $event
68
        );
69
    }
70
}
71