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.
Completed
Push — master ( b6868d...d3b2b1 )
by François
02:04
created

AccessToken::getTokenType()   A

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
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 *  Copyright (C) 2017 François Kooman <[email protected]>.
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as
7
 *  published by the Free Software Foundation, either version 3 of the
8
 *  License, or (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace fkooman\OAuth\Client;
20
21
use DateTime;
22
23
/**
24
 * AccessToken object containing the response from the OAuth 2.0 provider's
25
 * token response.
26
 */
27
class AccessToken
28
{
29
    /** @var string */
30
    private $token;
31
32
    /** @var string */
33
    private $tokenType;
34
35
    /** @var string */
36
    private $scope;
37
38
    /** @var \DateTime */
39
    private $expiresAt;
40
41
    public function __construct($token, $tokenType, $scope, DateTime $expiresAt)
42
    {
43
        $this->token = $token;
44
        $this->tokenType = $tokenType;
45
        $this->scope = $scope;
46
        $this->expiresAt = $expiresAt;
47
    }
48
49
    /**
50
     * Get the access token as string.
51
     *
52
     * @return string the access token
53
     */
54
    public function __toString()
55
    {
56
        return sprintf(
57
            'token_type: %s, scope: %s, expires_at: %s, token: %s',
58
            $this->getToken(),
59
            $this->getTokenType(),
60
            $this->getScope(),
61
            $this->getExpiresAt()->format('Y-m-d H:i:s')
62
        );
63
    }
64
65
    /**
66
     * Get the access token.
67
     *
68
     * @return string the access token
69
     *
70
     * @see https://tools.ietf.org/html/rfc6749#section-5.1
71
     */
72
    public function getToken()
73
    {
74
        return $this->token;
75
    }
76
77
    /**
78
     * Get the token type.
79
     *
80
     * @return string the token type
81
     *
82
     * @see https://tools.ietf.org/html/rfc6749#section-7.1
83
     */
84
    public function getTokenType()
85
    {
86
        return $this->tokenType;
87
    }
88
89
    /**
90
     * Get the scope.
91
     *
92
     * @return string the scope
93
     *
94
     * @see https://tools.ietf.org/html/rfc6749#section-3.3
95
     */
96
    public function getScope()
97
    {
98
        return $this->scope;
99
    }
100
101
    /**
102
     * @return DateTime
103
     */
104
    public function getExpiresAt()
105
    {
106
        return $this->expiresAt;
107
    }
108
}
109