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
07:52 queued 02:47
created

ClientFilter::connectTimeout()   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
        return $times;
84
    }
85
86
    /**
87
     * @param $connectTimeout
88
     *
89
     * @return mixed
90
     * @throws ClientException
91
     */
92 67
    public static function connectTimeout($connectTimeout)
93
    {
94 67
        if ($connectTimeout === '') {
95 2
            throw new ClientException(
96 2
                'Connect Timeout cannot be empty',
97
                SDK::INVALID_ARGUMENT
98 2
            );
99
        }
100
101 65
        return $connectTimeout;
102
    }
103
104
    /**
105
     * @param $timeout
106
     *
107
     * @return mixed
108
     * @throws ClientException
109
     */
110 68
    public static function timeout($timeout)
111
    {
112 68
        if ($timeout === '') {
113 2
            throw new ClientException(
114 2
                'Timeout cannot be empty',
115
                SDK::INVALID_ARGUMENT
116 2
            );
117
        }
118
119 66
        return $timeout;
120
    }
121
122
    /**
123
     * @param int $Milliseconds
124
     *
125
     * @return mixed
126
     * @throws ClientException
127
     */
128 4
    public static function milliseconds($Milliseconds)
129
    {
130 4
        if (!is_int($Milliseconds)) {
0 ignored issues
show
introduced by
The condition is_int($Milliseconds) is always true.
Loading history...
131 2
            throw new ClientException(
132 2
                'Milliseconds must be int',
133
                SDK::INVALID_ARGUMENT
134 2
            );
135
        }
136
137 2
        return $Milliseconds;
138
    }
139
}
140