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

ApiFilter::version()   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 ApiFilter
9
 *
10
 * @package AlibabaCloud\Client\Filter
11
 */
12
class ApiFilter
13
{
14
    /**
15
     * @param $serviceCode
16
     *
17
     * @return mixed
18
     * @throws ClientException
19
     */
20 9
    public static function serviceCode($serviceCode)
21
    {
22 9
        if (!is_string($serviceCode)) {
23 1
            throw new ClientException(
24 1
                'Service Code must be a string',
25
                \ALIBABA_CLOUD_INVALID_ARGUMENT
26 1
            );
27
        }
28
29 8
        if ($serviceCode === '') {
30 1
            throw new ClientException(
31 1
                'Service Code cannot be empty',
32
                \ALIBABA_CLOUD_INVALID_ARGUMENT
33 1
            );
34
        }
35
36 7
        return $serviceCode;
37
    }
38
39
    /**
40
     * @param $endpointType
41
     *
42
     * @return mixed
43
     * @throws ClientException
44
     */
45 8
    public static function endpointType($endpointType)
46
    {
47 8
        if (!is_string($endpointType)) {
48 1
            throw new ClientException(
49 1
                'Endpoint Type must be a string',
50
                \ALIBABA_CLOUD_INVALID_ARGUMENT
51 1
            );
52
        }
53
54 7
        if ($endpointType === '') {
55 1
            throw new ClientException(
56 1
                'Endpoint Type cannot be empty',
57
                \ALIBABA_CLOUD_INVALID_ARGUMENT
58 1
            );
59
        }
60
61 6
        return $endpointType;
62
    }
63
64
    /**
65
     * @param $action
66
     *
67
     * @return mixed
68
     * @throws ClientException
69
     */
70 85
    public static function action($action)
71
    {
72 85
        if (!is_string($action)) {
73 1
            throw new ClientException(
74 1
                'Action must be a string',
75
                \ALIBABA_CLOUD_INVALID_ARGUMENT
76 1
            );
77
        }
78
79 84
        if ($action === '') {
80 1
            throw new ClientException(
81 1
                'Action cannot be empty',
82
                \ALIBABA_CLOUD_INVALID_ARGUMENT
83 1
            );
84
        }
85
86 83
        return $action;
87
    }
88
89
    /**
90
     * @param $version
91
     *
92
     * @return mixed
93
     * @throws ClientException
94
     */
95 88
    public static function version($version)
96
    {
97 88
        if (!is_string($version)) {
98 1
            throw new ClientException(
99 1
                'Version must be a string',
100
                \ALIBABA_CLOUD_INVALID_ARGUMENT
101 1
            );
102
        }
103
104 87
        if ($version === '') {
105 1
            throw new ClientException(
106 1
                'Version cannot be empty',
107
                \ALIBABA_CLOUD_INVALID_ARGUMENT
108 1
            );
109
        }
110
111 86
        return $version;
112
    }
113
114
    /**
115
     * @param $format
116
     *
117
     * @return mixed
118
     * @throws ClientException
119
     */
120 15
    public static function format($format)
121
    {
122 15
        if (!is_string($format)) {
123 2
            throw new ClientException(
124 2
                'Format must be a string',
125
                \ALIBABA_CLOUD_INVALID_ARGUMENT
126 2
            );
127
        }
128
129 13
        if ($format === '') {
130 2
            throw new ClientException(
131 2
                'Format cannot be empty',
132
                \ALIBABA_CLOUD_INVALID_ARGUMENT
133 2
            );
134
        }
135
136 11
        return $format;
137
    }
138
139
    /**
140
     * @param $product
141
     *
142
     * @return string
143
     *
144
     * @throws ClientException
145
     */
146 114
    public static function product($product)
147
    {
148 114
        if (!is_string($product)) {
149 6
            throw new ClientException(
150 6
                'Product must be a string',
151
                \ALIBABA_CLOUD_INVALID_ARGUMENT
152 6
            );
153
        }
154
155 108
        if ($product === '') {
156 3
            throw new ClientException(
157 3
                'Product cannot be empty',
158
                \ALIBABA_CLOUD_INVALID_ARGUMENT
159 3
            );
160
        }
161
162 105
        return $product;
163
    }
164
165
    /**
166
     * @param $pattern
167
     *
168
     * @return string
169
     *
170
     * @throws ClientException
171
     */
172 10
    public static function pattern($pattern)
173
    {
174 10
        if (!is_string($pattern)) {
175 1
            throw new ClientException(
176 1
                'Pattern must be a string',
177
                \ALIBABA_CLOUD_INVALID_ARGUMENT
178 1
            );
179
        }
180
181 9
        if ($pattern === '') {
182 1
            throw new ClientException(
183 1
                'Pattern cannot be empty',
184
                \ALIBABA_CLOUD_INVALID_ARGUMENT
185 1
            );
186
        }
187
188 8
        return $pattern;
189
    }
190
}
191