Completed
Push — master ( 531aca...edc713 )
by Kamil
04:19
created

ScenarioContainerResetter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSubscribedEvents() 0 7 1
A reset() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the ContextServiceExtension package.
5
 *
6
 * (c) FriendsOfBehat
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace FriendsOfBehat\ContextServiceExtension\Listener;
13
14
use Behat\Behat\EventDispatcher\Event\ExampleTested;
15
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
16
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
17
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
18
19
/**
20
 * @internal
21
 */
22
final class ScenarioContainerResetter implements EventSubscriberInterface
23
{
24
    /**
25
     * @var ResettableContainerInterface
26
     */
27
    private $scenarioContainer;
28
29
    /**
30
     * @param ResettableContainerInterface $scenarioContainer
31
     */
32
    public function __construct(ResettableContainerInterface $scenarioContainer)
33
    {
34
        $this->scenarioContainer = $scenarioContainer;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public static function getSubscribedEvents()
41
    {
42
        return [
43
            ScenarioTested::AFTER => ['reset', -15],
44
            ExampleTested::AFTER => ['reset', -15],
45
        ];
46
    }
47
48
    public function reset()
49
    {
50
        $this->scenarioContainer->reset();
51
    }
52
}
53