Completed
Push — master ( 37a280...0c4ce1 )
by Yo
02:09
created

BehatKernelEventDispatcher::beforeShutdown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\Dispatcher;
3
4
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
5
use Symfony\Component\HttpKernel\KernelInterface;
6
use Yoanm\Behat3SymfonyExtension\Event\Events;
7
use Yoanm\Behat3SymfonyExtension\Event\KernelEvent;
8
9
/**
10
 * Will dispatch events related to symfony app kernel
11
 * It's just a wrapper to have the minimum of requirements in the AppKernel mock
12
 * and the maximum of code coverage for this extension
13
 * @see Yoanm\Behat3SymfonyExtension\Factory\KernelFactory::load()
14
 */
15
class BehatKernelEventDispatcher
16
{
17
    /** @var EventDispatcherInterface */
18
    private $behatEventDispatcher;
19
20
    /**
21
     * @param EventDispatcherInterface $behatEventDispatcher
22
     */
23 4
    public function __construct(EventDispatcherInterface $behatEventDispatcher)
24
    {
25 4
        $this->behatEventDispatcher = $behatEventDispatcher;
26 4
    }
27
28
    /**
29
     * @param KernelInterface $kernel
30
     */
31 1
    public function beforeBoot(KernelInterface $kernel)
32
    {
33 1
        $this->behatEventDispatcher->dispatch(
34 1
            Events::BEFORE_KERNEL_BOOT,
35 1
            new KernelEvent($kernel)
36 1
        );
37 1
    }
38
39
    /**
40
     * @param KernelInterface $kernel
41
     */
42 1
    public function afterBoot(KernelInterface $kernel)
43
    {
44 1
        $this->behatEventDispatcher->dispatch(
45 1
            Events::AFTER_KERNEL_BOOT,
46 1
            new KernelEvent($kernel)
47 1
        );
48 1
    }
49
50
    /**
51
     * @param KernelInterface $kernel
52
     */
53 1
    public function beforeShutdown(KernelInterface $kernel)
54
    {
55 1
        $this->behatEventDispatcher->dispatch(
56 1
            Events::BEFORE_KERNEL_SHUTDOWN,
57 1
            new KernelEvent($kernel)
58 1
        );
59 1
    }
60
61
    /**
62
     * @param KernelInterface $kernel
63
     */
64 1
    public function afterShutdown(KernelInterface $kernel)
65
    {
66 1
        $this->behatEventDispatcher->dispatch(
67 1
            Events::AFTER_KERNEL_SHUTDOWN,
68 1
            new KernelEvent($kernel)
69 1
        );
70 1
    }
71
}
72