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 (#143)
by Yong
06:23
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 101
    public static function regionId($regionId)
23
    {
24 101
        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 97
        if ($regionId === '') {
32 4
            throw new ClientException(
33 4
                'Region ID cannot be empty',
34
                SDK::INVALID_ARGUMENT
35 4
            );
36
        }
37
38 93
        return $regionId;
39
    }
40
41
    /**
42
     * @param $clientName
43
     *
44
     * @return string
45
     *
46
     * @throws ClientException
47
     */
48 161
    public static function clientName($clientName)
49
    {
50 161
        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 156
        if ($clientName === '') {
58 5
            throw new ClientException(
59 5
                'Client Name cannot be empty',
60
                SDK::INVALID_ARGUMENT
61 5
            );
62
        }
63
64 151
        return strtolower($clientName);
65
    }
66
67
    /**
68
     * @param $connectTimeout
69
     *
70
     * @return mixed
71
     * @throws ClientException
72
     */
73 60
    public static function connectTimeout($connectTimeout)
74
    {
75 60
        if ($connectTimeout === '') {
76 2
            throw new ClientException(
77 2
                'Connect Timeout cannot be empty',
78
                SDK::INVALID_ARGUMENT
79 2
            );
80
        }
81
82 58
        return $connectTimeout;
83
    }
84
85
    /**
86
     * @param $timeout
87
     *
88
     * @return mixed
89
     * @throws ClientException
90
     */
91 61
    public static function timeout($timeout)
92
    {
93 61
        if ($timeout === '') {
94 2
            throw new ClientException(
95 2
                'Timeout cannot be empty',
96
                SDK::INVALID_ARGUMENT
97 2
            );
98
        }
99
100 59
        return $timeout;
101
    }
102
103
    /**
104
     * @param int $Milliseconds
105
     *
106
     * @return mixed
107
     * @throws ClientException
108
     */
109 4
    public static function milliseconds($Milliseconds)
110
    {
111 4
        if (!is_int($Milliseconds)) {
0 ignored issues
show
introduced by
The condition is_int($Milliseconds) is always true.
Loading history...
112 2
            throw new ClientException(
113 2
                'Milliseconds must be int',
114
                SDK::INVALID_ARGUMENT
115 2
            );
116
        }
117
118 2
        return $Milliseconds;
119
    }
120
}
121