MemoryHelperAwareInitializer   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\MemoryHelperAware;
8
use JsonSpec\Behat\Helper\MemoryHelper;
9
10
/**
11
 * Class MemoryHelperAwareInitializer
12
 * @package JsonSpec\Behat\Context\Initializer
13
 */
14
class MemoryHelperAwareInitializer implements ContextInitializer
15
{
16
17
    /**
18
     * @var MemoryHelper
19
     */
20
    private $memoryHelper;
21
22
    /**
23
     * @param MemoryHelper $memoryHelper
24
     */
25
    public function __construct(MemoryHelper $memoryHelper)
26
    {
27
        $this->memoryHelper = $memoryHelper;
28
    }
29
30
    /**
31
     * @inheritdoc
32
     */
33
    public function initializeContext(Context $context)
34
    {
35
        if ($context instanceof MemoryHelperAware) {
36
            $context->setMemoryHelper($this->memoryHelper);
37
        }
38
    }
39
40
}
41