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
Pull Request — master (#145)
by Yong
05:10
created

ClientFilter::milliseconds()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AlibabaCloud\Client\Filter;
4
5
use AlibabaCloud\Client\SDK;
6
use AlibabaCloud\Client\Exception\ClientException;
7
8
/**
9
 * Class ClientFilter
10
 *
11
 * @package AlibabaCloud\Client\Filter
12
 */
13
class ClientFilter
14
{
15
    /**
16
     * @param $regionId
17
     *
18
     * @return string
19
     *
20
     * @throws ClientException
21
     */
22 108
    public static function regionId($regionId)
23
    {
24 108
        if (!is_string($regionId)) {
25 4
            throw new ClientException(
26 4
                'Region ID must be a string',
27
                SDK::INVALID_ARGUMENT
28 4
            );
29
        }
30
31 104
        if ($regionId === '') {
32 4
            throw new ClientException(
33 4
                'Region ID cannot be empty',
34
                SDK::INVALID_ARGUMENT
35 4
            );
36
        }
37
38 100
        return $regionId;
39
    }
40
41
    /**
42
     * @param $clientName
43
     *
44
     * @return string
45
     *
46
     * @throws ClientException
47
     */
48 168
    public static function clientName($clientName)
49
    {
50 168
        if (!is_string($clientName)) {
51 5
            throw new ClientException(
52 5
                'Client Name must be a string',
53
                SDK::INVALID_ARGUMENT
54 5
            );
55
        }
56
57 163
        if ($clientName === '') {
58 5
            throw new ClientException(
59 5
                'Client Name cannot be empty',
60
                SDK::INVALID_ARGUMENT
61 5
            );
62
        }
63
64 158
        return strtolower($clientName);
65
    }
66
67
    /**
68
     * @param $times
69
     *
70
     * @return string
71
     *
72
     * @throws ClientException
73
     */
74 3
    public static function retry($times)
75
    {
76 3
        if (!is_int($times)) {
77
            throw new ClientException(
78
                'Retry must be a int',
79
                SDK::INVALID_ARGUMENT
80
            );
81
        }
82
83 3
        if ($times === '') {
0 ignored issues
show
introduced by
The condition $times === '' is always false.
Loading history...
84
            throw new ClientException(
85
                'Retry cannot be empty',
86
                SDK::INVALID_ARGUMENT
87
            );
88
        }
89
90 3
        return strtolower($times);
91
    }
92
93
    /**
94
     * @param $connectTimeout
95
     *
96
     * @return mixed
97
     * @throws ClientException
98
     */
99 67
    public static function connectTimeout($connectTimeout)
100
    {
101 67
        if ($connectTimeout === '') {
102 2
            throw new ClientException(
103 2
                'Connect Timeout cannot be empty',
104
                SDK::INVALID_ARGUMENT
105 2
            );
106
        }
107
108 65
        return $connectTimeout;
109
    }
110
111
    /**
112
     * @param $timeout
113
     *
114
     * @return mixed
115
     * @throws ClientException
116
     */
117 68
    public static function timeout($timeout)
118
    {
119 68
        if ($timeout === '') {
120 2
            throw new ClientException(
121 2
                'Timeout cannot be empty',
122
                SDK::INVALID_ARGUMENT
123 2
            );
124
        }
125
126 66
        return $timeout;
127
    }
128
129
    /**
130
     * @param int $Milliseconds
131
     *
132
     * @return mixed
133
     * @throws ClientException
134
     */
135 4
    public static function milliseconds($Milliseconds)
136
    {
137 4
        if (!is_int($Milliseconds)) {
0 ignored issues
show
introduced by
The condition is_int($Milliseconds) is always true.
Loading history...
138 2
            throw new ClientException(
139 2
                'Milliseconds must be int',
140
                SDK::INVALID_ARGUMENT
141 2
            );
142
        }
143
144 2
        return $Milliseconds;
145
    }
146
}
147