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 ( a3174d...5adad1 )
by François
02:55
created

Client   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 15
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 92
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A setClientId() 0 7 2
A getClientId() 0 4 1
A setResponseType() 0 7 2
A getResponseType() 0 4 1
A setRedirectUri() 0 7 2
A getRedirectUri() 0 4 1
A setScope() 0 7 2
A getScope() 0 4 1
A setSecret() 0 8 1
A getSecret() 0 4 1
1
<?php
2
3
/**
4
 *  Copyright 2015 François Kooman <[email protected]>.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace fkooman\RemoteStorage\OAuth;
20
21
use InvalidArgumentException;
22
23
class Client
24
{
25
    /** @var string */
26
    private $clientId;
27
28
    /** @var string */
29
    private $responseType;
30
31
    /** @var string */
32
    private $redirectUri;
33
34
    /** @var string */
35
    private $scope;
36
37
    /** @var string */
38
    private $secret;
39
40
    public function __construct($clientId, $responseType, $redirectUri, $scope, $secret)
41
    {
42
        $this->setClientId($clientId);
43
        $this->setResponseType($responseType);
44
        $this->setRedirectUri($redirectUri);
45
        $this->setScope($scope);
46
        $this->setSecret($secret);
47
    }
48
49
    public function setClientId($clientId)
50
    {
51
        if (false === InputValidation::clientId($clientId)) {
52
            throw new InvalidArgumentException('invalid client_id');
53
        }
54
        $this->clientId = $clientId;
55
    }
56
57
    public function getClientId()
58
    {
59
        return $this->clientId;
60
    }
61
62
    public function setResponseType($responseType)
63
    {
64
        if (false === InputValidation::responseType($responseType)) {
65
            throw new InvalidArgumentException('invalid response_type');
66
        }
67
        $this->responseType = $responseType;
68
    }
69
70
    public function getResponseType()
71
    {
72
        return $this->responseType;
73
    }
74
75
    public function setRedirectUri($redirectUri)
76
    {
77
        if (false === InputValidation::redirectUri($redirectUri)) {
78
            throw new InvalidArgumentException('invalid redirect_uri');
79
        }
80
        $this->redirectUri = $redirectUri;
81
    }
82
83
    public function getRedirectUri()
84
    {
85
        return $this->redirectUri;
86
    }
87
88
    public function setScope($scope)
89
    {
90
        if (false === InputValidation::scope($scope)) {
91
            throw new InvalidArgumentException('invalid scope');
92
        }
93
        $this->scope = $scope;
94
    }
95
96
    public function getScope()
97
    {
98
        return $this->scope;
99
    }
100
101
    public function setSecret($secret)
102
    {
103
        //        // XXX: validate secret as well
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
104
//        if(false === InputValidation::secret($secret)) {
105
//            throw new InvalidArgumentException('invalid secret');
106
//        }
107
        $this->secret = $secret;
108
    }
109
110
    public function getSecret()
111
    {
112
        return $this->secret;
113
    }
114
}
115