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 ( 693676...f740ae )
by Mohammad Abdoli
04:13
created

AbstractOAuthProvider::setRedirectUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Rad\OAuthentication;
4
5
use Psr\Http\Message\RequestInterface;
6
7
/**
8
 * Abstract OAuth Provider
9
 *
10
 * @package Rad\OAuthentication
11
 */
12
abstract class AbstractOAuthProvider implements ProviderInterface
13
{
14
    protected $clientId;
15
    protected $clientSecret;
16
    protected $scopes = [];
17
    protected $redirectUri;
18
    protected $state;
19
20
    /**
21
     * AbstractOAuthProvider constructor.
22
     *
23
     * @param string $clientId     Client id
24
     * @param string $clientSecret Client secret
25
     * @param array  $scopes       Scopes
26
     * @param string $redirectUri  Redirect uri
27
     * @param string $state        State
28
     */
29
    public function __construct($clientId, $clientSecret, array $scopes = [], $redirectUri = null, $state = null)
30
    {
31
        $this->setClientId($clientId)
32
            ->setClientSecret($clientSecret)
33
            ->setScopes($scopes)
34
            ->setRedirectUri($redirectUri)
35
            ->setState($state);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function setClientId($clientId)
42
    {
43
        $this->clientId = strval($clientId);
44
45
        return $this;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getClientId()
52
    {
53
        return $this->clientId;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function setClientSecret($clientSecret)
60
    {
61
        $this->clientSecret = strval($clientSecret);
62
63
        return $this;
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getClientSecret()
70
    {
71
        return $this->clientSecret;
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function setScopes(array $scopes)
78
    {
79
        $this->scopes = $scopes;
80
81
        return $this;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function getScopes()
88
    {
89
        return $this->scopes;
90
    }
91
92
    /**
93
     * {@inheritdoc}
94
     */
95
    public function setRedirectUri($redirectUri)
96
    {
97
        $this->redirectUri = strval($redirectUri);
98
99
        return $this;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105
    public function getRedirectUri()
106
    {
107
        return $this->redirectUri;
108
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function setState($state)
114
    {
115
        $this->state = strval($state);
116
117
        return $this;
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function getState()
124
    {
125
        return $this->state;
126
    }
127
128
    /**
129
     * Config http request
130
     *
131
     * @param RequestInterface $request Http request
132
     *
133
     * @return RequestInterface
134
     */
135
    protected function request(RequestInterface $request)
136
    {
137
        return $request->withHeader('Accept', 'application/json')
138
            ->withHeader('User-Agent', 'RadPHP-OAuth');
139
    }
140
}
141