Completed
Push — master ( 6bc113...63b4f9 )
by Yo
02:07
created

KernelHandlerAwareInitializer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 25
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A initializeContext() 0 8 2
1
<?php
2
namespace Yoanm\Behat3SymfonyExtension\Context\Initializer;
3
4
use Behat\Behat\Context\Context;
5
use Behat\Behat\Context\Initializer\ContextInitializer;
6
use Yoanm\Behat3SymfonyExtension\Context\KernelHandlerAwareInterface;
7
use Yoanm\Behat3SymfonyExtension\Handler\KernelHandler;
8
9
/**
10
 * Class KernelHandlerAwareInitializer
11
 */
12
class KernelHandlerAwareInitializer implements ContextInitializer
13
{
14
    /** @var KernelHandler */
15
    private $kernelHandler;
16
17
    /**
18
     * @param KernelHandler $kernelHandler
19
     */
20 2
    public function __construct(KernelHandler $kernelHandler)
21
    {
22 2
        $this->kernelHandler = $kernelHandler;
23 2
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 2
    public function initializeContext(Context $context)
29
    {
30 2
        if (!$context instanceof KernelHandlerAwareInterface) {
31 1
            return;
32
        }
33
34 1
        $context->setKernelHandler($this->kernelHandler);
35 1
    }
36
}
37