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   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 88
ccs 32
cts 32
cp 1
rs 10
c 0
b 0
f 0
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A clientName() 0 17 3
A regionId() 0 17 3
A connectTimeout() 0 10 2
A timeout() 0 10 2
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