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
09:51
created

Filter::value()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
eloc 9
nc 3
nop 1
dl 0
loc 17
ccs 10
cts 10
cp 1
crap 4
rs 9.9666
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 Filter
9
 *
10
 * @package AlibabaCloud\Client\Filter
11
 */
12
class Filter
13
{
14
15
    /**
16
     * @param $name
17
     *
18
     * @return string
19
     *
20
     * @throws ClientException
21
     */
22 168
    public static function name($name)
23
    {
24 168
        if (!is_string($name)) {
25 5
            throw new ClientException(
26 5
                'Name must be a string',
27
                \ALIBABA_CLOUD_INVALID_ARGUMENT
28 5
            );
29
        }
30
31 163
        if ($name === '') {
32 5
            throw new ClientException(
33 5
                'Name cannot be empty',
34
                \ALIBABA_CLOUD_INVALID_ARGUMENT
35 5
            );
36
        }
37
38 158
        return $name;
39
    }
40
41
    /**
42
     * @param $value
43
     *
44
     * @return string
45
     *
46
     * @throws ClientException
47
     */
48 12
    public static function value($value)
49
    {
50 12
        if (!is_numeric($value) && !is_string($value)) {
51 3
            throw new ClientException(
52 3
                'Value must be a string or int',
53
                \ALIBABA_CLOUD_INVALID_ARGUMENT
54 3
            );
55
        }
56
57 9
        if ($value === '') {
58 3
            throw new ClientException(
59 3
                'Value cannot be empty',
60
                \ALIBABA_CLOUD_INVALID_ARGUMENT
61 3
            );
62
        }
63
64 6
        return $value;
65
    }
66
}
67