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.
Test Failed
Pull Request — master (#198)
by leo
17:52 queued 05:19
created

EndpointUserConfig::key()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace AlibabaCloud\Client\Regions;
4
5
/**
6
 * Class EndpointUserConfig
7
 *
8
 * @package AlibabaCloud\Client\Regions
9
 */
10
class EndpointUserConfig
11
{
12
    /**
13
     * @var array user customized EndpointData
14
     */
15
    private static $hosts = [];
16
17
    /**
18
     * Add host based on product name and region.
19
     *
20
     * @param string $product
21
     * @param string $regionId
22
     * @param string $host
23
     */
24
    public static function addHost($product, $regionId, $host)
25
    {
26
        if (empty($product) || empty($regionId) || empty($host)) {
27
            return;
28
        }
29
        $key = self::key($product, $regionId);
30
31
        self::$hosts[$key] = $host;
32
    }
33
34
    /**
35
     * Get host based on product name and region.
36
     *
37
     * @param string $product
38
     * @param string $regionId
39
     *
40
     * @return string
41
     */
42
    public static function getHost($product, $regionId)
43
    {
44
        $key = self::key($product, $regionId);
45
        return isset(self::$hosts[$key]) ? self::$hosts[$key] : "";
46
    }
47
48
    /**
49
     * Delete host based on product name and region.
50
     *
51
     * @param string $product
52
     * @param string $regionId
53
     */
54
    public static function deleteHost($product, $regionId)
55
    {
56
        $key = self::key($product, $regionId);
57
        if (isset(self::$hosts[$key])) {
58
            unset(self::$hosts[$key]);
59
        }
60
    }
61
62
    /**
63
     * @param string $product
64
     * @param string $regionId
65
     *
66
     * @return string
67
     */
68
    private static function key($product, $regionId)
69
    {
70
        if (empty($product) || empty($regionId)) {
71
            throw new \InvalidArgumentException('InvalidArgument : $product or $regionId is empty');
72
        }
73
        return $product . "_" . $regionId;
74
    }
75
}