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.

Auth   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 55
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A finish() 0 12 1
1
<?php
2
3
namespace Choccybiccy\HumanApi;
4
5
/**
6
 * Class Auth
7
 * @package Choccybiccy\HumanApi
8
 */
9
class Auth extends Api
10
{
11
12
    /**
13
     * @var string
14
     */
15
    protected $apiUrl = "https://user.humanapi.co";
16
17
    /**
18
     * @var int
19
     */
20
    protected $apiVersion = 1;
21
22
    /**
23
     * @var array
24
     */
25
    protected $sessionTokenData;
26
27
    /**
28
     * Constructor
29
     *
30
     * @see https://docs.humanapi.co/docs/connect-backend
31
     *
32
     * @param array $sessionTokenData
33
     * @param string $clientSecret
34
     */
35
    public function __construct(array $sessionTokenData, $clientSecret)
36
    {
37
38
        $sessionTokenData['clientSecret'] = $clientSecret;
39
        $this->sessionTokenData = $sessionTokenData;
40
41
        parent::__construct();
42
43
    }
44
45
    /**
46
     * Finish the auth flow and post to connect endpoint, and return response array
47
     * containing accessToken and other data about the 'human' entity.
48
     *
49
     * @return array
50
     */
51
    public function finish()
52
    {
53
        $response = $this->post(
54
            $this->buildUrlParts(array("tokens"), "connect"),
55
            array(
56
                "json" => $this->sessionTokenData,
57
            )
58
        );
59
60
        $responseJson = json_decode($response->getBody(), true);
61
        return $responseJson;
62
    }
63
}
64