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
Push — master ( 407913...68b4fb )
by Yong
04:17
created

ApiFilter::endpointSuffix()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 9
c 0
b 0
f 0
nc 3
nop 1
dl 0
loc 17
ccs 0
cts 0
cp 0
crap 12
rs 9.9666
1
<?php
2
3
namespace AlibabaCloud\Client\Filter;
4
5
use AlibabaCloud\Client\SDK;
6
use AlibabaCloud\Client\Exception\ClientException;
7
8
/**
9
 * Class ApiFilter
10
 *
11
 * @package AlibabaCloud\Client\Filter
12
 */
13
class ApiFilter
14
{
15
    /**
16
     * @param $serviceCode
17
     *
18
     * @return mixed
19
     * @throws ClientException
20
     */
21 11
    public static function serviceCode($serviceCode)
22
    {
23 11
        if (!is_string($serviceCode)) {
24 1
            throw new ClientException(
25 1
                'Service Code must be a string',
26
                SDK::INVALID_ARGUMENT
27 1
            );
28
        }
29
30 10
        if ($serviceCode === '') {
31 1
            throw new ClientException(
32 1
                'Service Code cannot be empty',
33
                SDK::INVALID_ARGUMENT
34 1
            );
35
        }
36
37 9
        return $serviceCode;
38
    }
39
40
    /**
41
     * @param $endpointType
42
     *
43
     * @return mixed
44
     * @throws ClientException
45
     */
46 9
    public static function endpointType($endpointType)
47
    {
48 9
        if (!is_string($endpointType)) {
49 1
            throw new ClientException(
50 1
                'Endpoint Type must be a string',
51
                SDK::INVALID_ARGUMENT
52 1
            );
53
        }
54
55 8
        if ($endpointType === '') {
56 1
            throw new ClientException(
57 1
                'Endpoint Type cannot be empty',
58
                SDK::INVALID_ARGUMENT
59 1
            );
60
        }
61
62 7
        return $endpointType;
63
    }
64
65
    /**
66
     * @param $action
67
     *
68
     * @return mixed
69
     * @throws ClientException
70
     */
71 70
    public static function action($action)
72
    {
73 70
        if (!is_string($action)) {
74 1
            throw new ClientException(
75 1
                'Action must be a string',
76
                SDK::INVALID_ARGUMENT
77 1
            );
78
        }
79
80 69
        if ($action === '') {
81 1
            throw new ClientException(
82 1
                'Action cannot be empty',
83
                SDK::INVALID_ARGUMENT
84 1
            );
85
        }
86
87 68
        return $action;
88
    }
89
90
    /**
91
     * @codeCoverageIgnore
92
     *
93
     * @param string $endpointSuffix
94
     *
95
     * @return mixed
96
     * @throws ClientException
97
     */
98
    public static function endpointSuffix($endpointSuffix)
99
    {
100
        if (!is_string($endpointSuffix)) {
0 ignored issues
show
introduced by
The condition is_string($endpointSuffix) is always true.
Loading history...
101
            throw new ClientException(
102
                'Endpoint Suffix must be a string',
103
                SDK::INVALID_ARGUMENT
104
            );
105
        }
106
107
        if ($endpointSuffix === '') {
108
            throw new ClientException(
109
                'Endpoint Suffix cannot be empty',
110
                SDK::INVALID_ARGUMENT
111
            );
112
        }
113
114
        return $endpointSuffix;
115
    }
116
117
    /**
118
     * @codeCoverageIgnore
119
     *
120
     * @param string $network
121
     *
122
     * @return mixed
123
     * @throws ClientException
124
     */
125
    public static function network($network)
126
    {
127
        if (!is_string($network)) {
0 ignored issues
show
introduced by
The condition is_string($network) is always true.
Loading history...
128
            throw new ClientException(
129
                'Network Suffix must be a string',
130
                SDK::INVALID_ARGUMENT
131
            );
132
        }
133
134
        if ($network === '') {
135
            throw new ClientException(
136
                'Network Suffix cannot be empty',
137
                SDK::INVALID_ARGUMENT
138
            );
139
        }
140
141
        return $network;
142
    }
143
144
    /**
145
     * @param string $version
146
     *
147
     * @return mixed
148
     * @throws ClientException
149
     */
150 74
    public static function version($version)
151
    {
152 74
        if (!is_string($version)) {
0 ignored issues
show
introduced by
The condition is_string($version) is always true.
Loading history...
153 1
            throw new ClientException(
154 1
                'Version must be a string',
155
                SDK::INVALID_ARGUMENT
156 1
            );
157
        }
158
159 73
        if ($version === '') {
160 1
            throw new ClientException(
161 1
                'Version cannot be empty',
162
                SDK::INVALID_ARGUMENT
163 1
            );
164
        }
165
166 72
        return $version;
167
    }
168
169
    /**
170
     * @param $format
171
     *
172
     * @return mixed
173
     * @throws ClientException
174
     */
175 14
    public static function format($format)
176
    {
177 14
        if (!is_string($format)) {
178 1
            throw new ClientException(
179 1
                'Format must be a string',
180
                SDK::INVALID_ARGUMENT
181 1
            );
182
        }
183
184 13
        if ($format === '') {
185 1
            throw new ClientException(
186 1
                'Format cannot be empty',
187
                SDK::INVALID_ARGUMENT
188 1
            );
189
        }
190
191 12
        return \strtoupper($format);
192
    }
193
194
    /**
195
     * @param $product
196
     *
197
     * @return string
198
     *
199
     * @throws ClientException
200
     */
201 104
    public static function product($product)
202
    {
203 104
        if (!is_string($product)) {
204 6
            throw new ClientException(
205 6
                'Product must be a string',
206
                SDK::INVALID_ARGUMENT
207 6
            );
208
        }
209
210 98
        if ($product === '') {
211 3
            throw new ClientException(
212 3
                'Product cannot be empty',
213
                SDK::INVALID_ARGUMENT
214 3
            );
215
        }
216
217 95
        return $product;
218
    }
219
220
    /**
221
     * @param $pattern
222
     *
223
     * @return string
224
     *
225
     * @throws ClientException
226
     */
227 10
    public static function pattern($pattern)
228
    {
229 10
        if (!is_string($pattern)) {
230 1
            throw new ClientException(
231 1
                'Pattern must be a string',
232
                SDK::INVALID_ARGUMENT
233 1
            );
234
        }
235
236 9
        if ($pattern === '') {
237 1
            throw new ClientException(
238 1
                'Pattern cannot be empty',
239
                SDK::INVALID_ARGUMENT
240 1
            );
241
        }
242
243 8
        return $pattern;
244
    }
245
}
246