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.

GetToken::call()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace zaporylie\Vipps\Resource\Authorization;
4
5
use zaporylie\Vipps\Model\Authorization\ResponseGetToken;
6
use zaporylie\Vipps\Resource\ResourceBase;
7
use zaporylie\Vipps\Resource\HttpMethod;
8
use zaporylie\Vipps\VippsInterface;
9
10
/**
11
 * Class GetToken
12
 *
13
 * @package Vipps\Resource\Authorization
14
 */
15
class GetToken extends ResourceBase
16
{
17
18
    /**
19
     * @var \zaporylie\Vipps\Resource\HttpMethod;
20
     */
21
    protected $method = HttpMethod::POST;
22
23
    /**
24
     * @var string
25
     */
26
    protected $path = '/accessToken/get';
27
28
    /**
29
     * GetToken constructor.
30
     *
31
     * @param \zaporylie\Vipps\VippsInterface $vipps
32
     * @param string $subscription_key
33
     * @param string $client_secret
34
     */
35
    public function __construct(VippsInterface $vipps, $subscription_key, $client_secret)
36
    {
37
        parent::__construct($vipps, $subscription_key);
38
        // Authorization module requires client_id to be set on "client_id"
39
        // header.
40
        $this->headers['client_id'] = $this->app->getClient()->getClientId();
41
        $this->headers['client_secret'] = $client_secret;
42
    }
43
44
    /**
45
     * @return \zaporylie\Vipps\Model\Authorization\ResponseGetToken
46
     */
47
    public function call()
48
    {
49
        $response = $this->makeCall();
50
        /** @var \zaporylie\Vipps\Model\Authorization\ResponseGetToken $responseObject */
51
        $responseObject = $this
52
            ->getSerializer()
53
            ->deserialize(
54
                $response->getBody()->getContents(),
55
                ResponseGetToken::class,
56
                'json'
57
            );
58
59
        return $responseObject;
60
    }
61
}
62