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 ( ffc9d2...d85606 )
by Yong
03:57
created

HttpTrait   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 126
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0
wmc 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A timeout() 0 5 1
A connectTimeoutMilliseconds() 0 6 1
A timeoutMilliseconds() 0 6 1
A options() 0 7 2
A cert() 0 5 1
A connectTimeout() 0 5 1
A proxy() 0 5 1
A debug() 0 5 1
A verify() 0 5 1
1
<?php
2
3
namespace AlibabaCloud\Client\Traits;
4
5
use AlibabaCloud\Client\Filter\ClientFilter;
6
use AlibabaCloud\Client\Exception\ClientException;
7
8
/**
9
 * Trait HttpTrait
10
 *
11
 * @package AlibabaCloud\Client\Traits
12
 */
13
trait HttpTrait
14
{
15
16
    /**
17
     * @var array
18
     */
19
    public $options = [];
20
21
    /**
22
     * @param int|float $seconds
23
     *
24
     * @return $this
25
     * @throws ClientException
26
     */
27 61
    public function timeout($seconds)
28
    {
29 61
        $this->options['timeout'] = ClientFilter::timeout($seconds);
30
31 59
        return $this;
32
    }
33
34
    /**
35
     * @param int $milliseconds
36
     *
37
     * @return $this
38
     * @throws ClientException
39
     */
40 2
    public function timeoutMilliseconds($milliseconds)
41
    {
42 2
        ClientFilter::milliseconds($milliseconds);
43 1
        $seconds = $milliseconds / 1000;
44
45 1
        return $this->timeout($seconds);
46
    }
47
48
    /**
49
     * @param int|float $seconds
50
     *
51
     * @return $this
52
     * @throws ClientException
53
     */
54 60
    public function connectTimeout($seconds)
55
    {
56 60
        $this->options['connect_timeout'] = ClientFilter::connectTimeout($seconds);
57
58 58
        return $this;
59
    }
60
61
    /**
62
     * @param int $milliseconds
63
     *
64
     * @return $this
65
     * @throws ClientException
66
     */
67 2
    public function connectTimeoutMilliseconds($milliseconds)
68
    {
69 2
        ClientFilter::milliseconds($milliseconds);
70 1
        $seconds = $milliseconds / 1000;
71
72 1
        return $this->connectTimeout($seconds);
73
    }
74
75
    /**
76
     * @param bool $debug
77
     *
78
     * @return $this
79
     */
80 16
    public function debug($debug)
81
    {
82 16
        $this->options['debug'] = $debug;
83
84 16
        return $this;
85
    }
86
87
    /**
88
     * @codeCoverageIgnore
89
     *
90
     * @param array $cert
91
     *
92
     * @return $this
93
     */
94
    public function cert($cert)
95
    {
96
        $this->options['cert'] = $cert;
97
98
        return $this;
99
    }
100
101
    /**
102
     * @codeCoverageIgnore
103
     *
104
     * @param array|string $proxy
105
     *
106
     * @return $this
107
     */
108
    public function proxy($proxy)
109
    {
110
        $this->options['proxy'] = $proxy;
111
112
        return $this;
113
    }
114
115
    /**
116
     * @param mixed $verify
117
     *
118
     * @return $this
119
     */
120 2
    public function verify($verify)
121
    {
122 2
        $this->options['verify'] = $verify;
123
124 2
        return $this;
125
    }
126
127
    /**
128
     * @param array $options
129
     *
130
     * @return $this
131
     */
132 71
    public function options(array $options)
133
    {
134 71
        if ($options !== []) {
135 19
            $this->options = \AlibabaCloud\Client\arrayMerge([$this->options, $options]);
136 19
        }
137
138 71
        return $this;
139
    }
140
}
141