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
11:11 queued 02:01
created

ClientFilter::timeout()   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\Exception\ClientException;
6
7
/**
8
 * Class ClientFilter
9
 *
10
 * @package AlibabaCloud\Client\Filter
11
 */
12
class ClientFilter
13
{
14
    /**
15
     * @param $regionId
16
     *
17
     * @return string
18
     *
19
     * @throws ClientException
20
     */
21 132
    public static function regionId($regionId)
22
    {
23 132
        if (!is_string($regionId)) {
24 4
            throw new ClientException(
25 4
                'Region ID must be a string',
26
                \ALIBABA_CLOUD_INVALID_ARGUMENT
27 4
            );
28
        }
29
30 128
        if ($regionId === '') {
31 4
            throw new ClientException(
32 4
                'Region ID cannot be empty',
33
                \ALIBABA_CLOUD_INVALID_ARGUMENT
34 4
            );
35
        }
36
37 124
        return $regionId;
38
    }
39
40
    /**
41
     * @param $clientName
42
     *
43
     * @return string
44
     *
45
     * @throws ClientException
46
     */
47 174
    public static function clientName($clientName)
48
    {
49 174
        if (!is_string($clientName)) {
50 5
            throw new ClientException(
51 5
                'Client Name must be a string',
52
                \ALIBABA_CLOUD_INVALID_ARGUMENT
53 5
            );
54
        }
55
56 169
        if ($clientName === '') {
57 5
            throw new ClientException(
58 5
                'Client Name cannot be empty',
59
                \ALIBABA_CLOUD_INVALID_ARGUMENT
60 5
            );
61
        }
62
63 164
        return strtolower($clientName);
64
    }
65
66
    /**
67
     * @param $connectTimeout
68
     *
69
     * @return mixed
70
     * @throws ClientException
71
     */
72 49
    public static function connectTimeout($connectTimeout)
73
    {
74 49
        if ($connectTimeout === '') {
75 1
            throw new ClientException(
76 1
                'Connect Timeout cannot be empty',
77
                \ALIBABA_CLOUD_INVALID_ARGUMENT
78 1
            );
79
        }
80
81 48
        return $connectTimeout;
82
    }
83
84
    /**
85
     * @param $timeout
86
     *
87
     * @return mixed
88
     * @throws ClientException
89
     */
90 50
    public static function timeout($timeout)
91
    {
92 50
        if ($timeout === '') {
93 1
            throw new ClientException(
94 1
                'Timeout cannot be empty',
95
                \ALIBABA_CLOUD_INVALID_ARGUMENT
96 1
            );
97
        }
98
99 49
        return $timeout;
100
    }
101
}
102