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.

Filter::name()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3

Importance

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