GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ApiClientAwareInitializer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Behat WebApiExtension.
5
 * (c) Konstantin Kudryashov <[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 Behat\WebApiExtension\Context\Initializer;
12
13
use Behat\Behat\Context\Context;
14
use Behat\Behat\Context\Initializer\ContextInitializer;
15
use Behat\WebApiExtension\Context\ApiClientAwareContext;
16
use GuzzleHttp\ClientInterface;
17
18
/**
19
 * Guzzle-aware contexts initializer.
20
 *
21
 * Sets Guzzle client instance to the ApiClientAwareContext.
22
 *
23
 * @author Frédéric G. Marand <[email protected]>
24
 */
25
class ApiClientAwareInitializer implements ContextInitializer
26
{
27
    /**
28
     * @var ClientInterface
29
     */
30
    private $client;
31
32
    /**
33
     * Initializes initializer.
34
     *
35
     * @param ClientInterface $client
36
     */
37
    public function __construct(ClientInterface $client)
38
    {
39
        $this->client = $client;
40
    }
41
42
    /**
43
     * Initializes provided context.
44
     *
45
     * @param Context $context
46
     */
47
    public function initializeContext(Context $context)
48
    {
49
        if ($context instanceof ApiClientAwareContext) {
50
            $context->setClient($this->client);
51
        }
52
    }
53
}
54