JsonHolderAwareInitializer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A initializeContext() 0 6 2
1
<?php
2
3
namespace JsonSpec\Behat\Context\Initializer;
4
5
use Behat\Behat\Context\Context;
6
use Behat\Behat\Context\Initializer\ContextInitializer;
7
use JsonSpec\Behat\Context\JsonConsumerAware;
8
use JsonSpec\Behat\Consumer\JsonConsumer;
9
use JsonSpec\Behat\Context\JsonHolderAware;
10
use JsonSpec\Behat\JsonProvider\JsonHolder;
11
12
/**
13
 * Class JsonHolderAwareInitializer
14
 * @package JsonSpec\Behat\Context\Initializer
15
 */
16
class JsonHolderAwareInitializer implements ContextInitializer
17
{
18
19
    /**
20
     * @var JsonHolder
21
     */
22
    private $jsonHolder;
23
24
    /**
25
     * @param JsonHolder $jsonHolder
26
     */
27
    public function __construct(JsonHolder $jsonHolder)
28
    {
29
        $this->jsonHolder = $jsonHolder;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function initializeContext(Context $context)
36
    {
37
        if ($context instanceof JsonHolderAware) {
38
            $context->setJsonHolder($this->jsonHolder);
39
        }
40
    }
41
42
}
43