Completed
Push — master ( 3dfb16...ce0600 )
by Rafael
8s
created

ClientResetSubscriber   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 25
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 4 1
A restartClient() 0 3 1
A __construct() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Behat\Client;
12
13
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
14
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
16
/**
17
 * Restart the client before every scenario
18
 */
19
class ClientResetSubscriber implements EventSubscriberInterface
20
{
21
    /**
22
     * @var GraphQLClient
23
     */
24
    protected $client;
25
26
    public function __construct(GraphQLClient $client)
27
    {
28
        $this->client = $client;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public static function getSubscribedEvents()
35
    {
36
        return [
37
            ScenarioTested::BEFORE => 'restartClient',
38
        ];
39
    }
40
41
    public function restartClient()
42
    {
43
        $this->client->restart();
44
    }
45
}