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   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 47
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A call() 0 14 1
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