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   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 53
ccs 20
cts 20
cp 1
rs 10
wmc 7

2 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 0 17 3
A value() 0 17 4
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