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.
Passed
Pull Request — master (#73)
by Yong
09:51
created

CredentialFilter::privateKeyFile()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 9
nc 3
nop 1
dl 0
loc 17
ccs 10
cts 10
cp 1
crap 3
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
namespace AlibabaCloud\Client\Filter;
4
5
use AlibabaCloud\Client\Exception\ClientException;
6
7
/**
8
 * Class CredentialFilter
9
 *
10
 * @package AlibabaCloud\Client\Filter
11
 */
12
class CredentialFilter
13
{
14
    /**
15
     * @param $bearerToken
16
     *
17
     * @return mixed
18
     * @throws ClientException
19
     */
20 27
    public static function bearerToken($bearerToken)
21
    {
22 27
        if (!is_string($bearerToken)) {
23 2
            throw new ClientException(
24 2
                'Bearer Token must be a string',
25
                \ALIBABA_CLOUD_INVALID_ARGUMENT
26 2
            );
27
        }
28
29 25
        if ($bearerToken === '') {
30 2
            throw new ClientException(
31 2
                'Bearer Token cannot be empty',
32
                \ALIBABA_CLOUD_INVALID_ARGUMENT
33 2
            );
34
        }
35
36 23
        return $bearerToken;
37
    }
38
39
    /**
40
     * @param $publicKeyId
41
     *
42
     * @return mixed
43
     * @throws ClientException
44
     */
45 27
    public static function publicKeyId($publicKeyId)
46
    {
47 27
        if (!is_string($publicKeyId)) {
48 2
            throw new ClientException(
49 2
                'Public Key ID must be a string',
50
                \ALIBABA_CLOUD_INVALID_ARGUMENT
51 2
            );
52
        }
53
54 25
        if ($publicKeyId === '') {
55 2
            throw new ClientException(
56 2
                'Public Key ID cannot be empty',
57
                \ALIBABA_CLOUD_INVALID_ARGUMENT
58 2
            );
59
        }
60
61 23
        return $publicKeyId;
62
    }
63
64
    /**
65
     * @param $privateKeyFile
66
     *
67
     * @return mixed
68
     * @throws ClientException
69
     */
70 23
    public static function privateKeyFile($privateKeyFile)
71
    {
72 23
        if (!is_string($privateKeyFile)) {
73 2
            throw new ClientException(
74 2
                'Private Key File must be a string',
75
                \ALIBABA_CLOUD_INVALID_ARGUMENT
76 2
            );
77
        }
78
79 21
        if ($privateKeyFile === '') {
80 2
            throw new ClientException(
81 2
                'Private Key File cannot be empty',
82
                \ALIBABA_CLOUD_INVALID_ARGUMENT
83 2
            );
84
        }
85
86 19
        return $privateKeyFile;
87
    }
88
89
    /**
90
     * @param $roleName
91
     *
92
     * @return string
93
     *
94
     * @throws ClientException
95
     */
96 30
    public static function roleName($roleName)
97
    {
98 30
        if (!is_string($roleName)) {
99 2
            throw new ClientException(
100 2
                'Role Name must be a string',
101
                \ALIBABA_CLOUD_INVALID_ARGUMENT
102 2
            );
103
        }
104
105 28
        if ($roleName === '') {
106 2
            throw new ClientException(
107 2
                'Role Name cannot be empty',
108
                \ALIBABA_CLOUD_INVALID_ARGUMENT
109 2
            );
110
        }
111
112 26
        return $roleName;
113
    }
114
115
    /**
116
     * @param $accessKeyId
117
     * @param $accessKeySecret
118
     *
119
     * @throws ClientException
120
     */
121 144
    public static function AccessKey($accessKeyId, $accessKeySecret)
122
    {
123 144
        if (!is_string($accessKeyId)) {
124 6
            throw new ClientException(
125 6
                'AccessKey ID must be a string',
126
                \ALIBABA_CLOUD_INVALID_ARGUMENT
127 6
            );
128
        }
129
130 138
        if ($accessKeyId === '') {
131 6
            throw new ClientException(
132 6
                'AccessKey ID cannot be empty',
133
                \ALIBABA_CLOUD_INVALID_ARGUMENT
134 6
            );
135
        }
136
137 132
        if (!is_string($accessKeySecret)) {
138 6
            throw new ClientException(
139 6
                'AccessKey Secret must be a string',
140
                \ALIBABA_CLOUD_INVALID_ARGUMENT
141 6
            );
142
        }
143
144 126
        if ($accessKeySecret === '') {
145 6
            throw new ClientException(
146 6
                'AccessKey Secret cannot be empty',
147
                \ALIBABA_CLOUD_INVALID_ARGUMENT
148 6
            );
149
        }
150 120
    }
151
}
152