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
Push — master ( b027da...71edf5 )
by Yong
09:39
created

HttpFilter   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 102
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 37
dl 0
loc 102
ccs 40
cts 40
cp 1
rs 10
c 0
b 0
f 0
wmc 13

4 Methods

Rating   Name   Duplication   Size   Complexity  
A host() 0 17 3
A scheme() 0 17 3
A body() 0 17 4
A method() 0 17 3
1
<?php
2
3
namespace AlibabaCloud\Client\Filter;
4
5
use AlibabaCloud\Client\Exception\ClientException;
6
7
/**
8
 * Class HttpFilter
9
 *
10
 * @package AlibabaCloud\Client\Filter
11
 */
12
class HttpFilter
13
{
14
    /**
15
     * @param $host
16
     *
17
     * @return string
18
     *
19
     * @throws ClientException
20
     */
21 47
    public static function host($host)
22
    {
23 47
        if (!is_string($host)) {
24 3
            throw new ClientException(
25 3
                'Host must be a string',
26
                \ALIBABA_CLOUD_INVALID_ARGUMENT
27 3
            );
28
        }
29
30 44
        if ($host === '') {
31 3
            throw new ClientException(
32 3
                'Host cannot be empty',
33
                \ALIBABA_CLOUD_INVALID_ARGUMENT
34 3
            );
35
        }
36
37 41
        return $host;
38
    }
39
40
    /**
41
     * @param $scheme
42
     *
43
     * @return string
44
     *
45
     * @throws ClientException
46
     */
47 32
    public static function scheme($scheme)
48
    {
49 32
        if (!is_string($scheme)) {
50 1
            throw new ClientException(
51 1
                'Scheme must be a string',
52
                \ALIBABA_CLOUD_INVALID_ARGUMENT
53 1
            );
54
        }
55
56 31
        if ($scheme === '') {
57 1
            throw new ClientException(
58 1
                'Scheme cannot be empty',
59
                \ALIBABA_CLOUD_INVALID_ARGUMENT
60 1
            );
61
        }
62
63 30
        return $scheme;
64
    }
65
66
    /**
67
     * @param $body
68
     *
69
     * @return mixed
70
     * @throws ClientException
71
     */
72 7
    public static function body($body)
73
    {
74 7
        if (!is_string($body) && !is_numeric($body)) {
75 1
            throw new ClientException(
76 1
                'Body must be a string or int',
77
                \ALIBABA_CLOUD_INVALID_ARGUMENT
78 1
            );
79
        }
80
81 6
        if ($body === '') {
82 1
            throw new ClientException(
83 1
                'Body cannot be empty',
84
                \ALIBABA_CLOUD_INVALID_ARGUMENT
85 1
            );
86
        }
87
88 5
        return $body;
89
    }
90
91
    /**
92
     * @param $method
93
     *
94
     * @return mixed
95
     * @throws ClientException
96
     */
97 73
    public static function method($method)
98
    {
99 73
        if (!is_string($method)) {
100 1
            throw new ClientException(
101 1
                'Method must be a string',
102
                \ALIBABA_CLOUD_INVALID_ARGUMENT
103 1
            );
104
        }
105
106 72
        if ($method === '') {
107 1
            throw new ClientException(
108 1
                'Method cannot be empty',
109
                \ALIBABA_CLOUD_INVALID_ARGUMENT
110 1
            );
111
        }
112
113 71
        return \strtoupper($method);
114
    }
115
}
116