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 (#71)
by Yong
05:29
created

RequestTrait::roa()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AlibabaCloud\Client\Traits;
4
5
use AlibabaCloud\Client\AlibabaCloud;
6
use AlibabaCloud\Client\Exception\ClientException;
7
use AlibabaCloud\Client\Request\RoaRequest;
8
use AlibabaCloud\Client\Request\RpcRequest;
9
use AlibabaCloud\Client\Request\UserAgent;
10
11
/**
12
 * Trait RequestTrait
13
 *
14
 * @package   AlibabaCloud\Client\Traits
15
 *
16
 * @mixin     AlibabaCloud
17
 */
18
trait RequestTrait
19
{
20
    /**
21
     * @param string $name
22
     * @param string $value
23
     *
24
     * @throws ClientException
25
     */
26 6
    public static function appendUserAgent($name, $value)
27
    {
28 6
        if (!$name) {
29 1
            throw new ClientException(
30 1
                'The argument $name cannot be empty',
31
                \ALIBABA_CLOUD_INVALID_ARGUMENT
32 1
            );
33
        }
34
35 5
        if (!$value) {
36 1
            throw new ClientException(
37 1
                'The argument $value cannot be empty',
38
                \ALIBABA_CLOUD_INVALID_ARGUMENT
39 1
            );
40
        }
41
42 4
        UserAgent::append($name, $value);
43 4
    }
44
45
    /**
46
     * @param array $userAgent
47
     */
48 2
    public static function withUserAgent(array $userAgent)
49
    {
50 2
        UserAgent::with($userAgent);
51 2
    }
52
53
    /**
54
     * @deprecated
55
     * @codeCoverageIgnore
56
     *
57
     * @param array $options
58
     *
59
     * @return RpcRequest
60
     * @throws ClientException
61
     */
62
    public static function rpcRequest(array $options = [])
63
    {
64
        return self::rpc($options);
65
    }
66
67
    /**
68
     * @deprecated
69
     * @codeCoverageIgnore
70
     *
71
     * @param array $options
72
     *
73
     * @return RoaRequest
74
     * @throws ClientException
75
     */
76
    public static function roaRequest(array $options = [])
77
    {
78
        return self::roa($options);
79
    }
80
81
    /**
82
     * @param array $options
83
     *
84
     * @return RpcRequest
85
     * @throws ClientException
86
     */
87 5
    public static function rpc(array $options = [])
88
    {
89 5
        return new RpcRequest($options);
90
    }
91
92
    /**
93
     * @param array $options
94
     *
95
     * @return RoaRequest
96
     * @throws ClientException
97
     */
98 3
    public static function roa(array $options = [])
99
    {
100 3
        return new RoaRequest($options);
101
    }
102
}
103