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.
Completed
Pull Request — master (#159)
by Roman
06:17
created

Entry   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 2
dl 0
loc 58
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAliases() 0 6 1
A matches() 0 4 2
A getEndpointUrl() 0 10 4
1
<?php declare(strict_types=1);
2
3
namespace OpenStack\Identity\v2\Models;
4
5
use OpenStack\Common\Resource\Alias;
6
use OpenStack\Common\Resource\OperatorResource;
7
8
/**
9
 * Represents an Identity v2 Catalog Entry.
10
 *
11
 * @package OpenStack\Identity\v2\Models
12
 */
13
class Entry extends OperatorResource
14
{
15
    /** @var string */
16
    public $name;
17
18
    /** @var string */
19
    public $type;
20
21
    /** @var []Endpoint */
22
    public $endpoints = [];
23
24
    /**
25
     * @var array
26
     */
27
    protected $aliases = [];
28
29
    /**
30
     * @inheritdoc
31 1
     */
32
    protected function getAliases(): array
33 1
    {
34
        $aliases = parent::getAliases();
35
        $aliases['endpoints'] = new Alias('endpoints', Endpoint::class, true);
36
        return $aliases;
37
    }
38
39
    /**
40
     * Indicates whether this catalog entry matches a certain name and type.
41
     *
42
     * @param string $name
43
     * @param string $type
44 2
     *
45
     * @return bool TRUE if it's a match, FALSE if not
46 2
     */
47 1
    public function matches(string $name, string $type): bool
48 1
    {
49
        return $this->name == $name && $this->type == $type;
50 1
    }
51
52 1
    /**
53
     * Retrieves the catalog entry's URL according to a specific region and URL type
54
     *
55
     * @param string $region
56
     * @param string $urlType
57
     *
58
     * @return string
59
     */
60
    public function getEndpointUrl(string $region, string $urlType): string
61
    {
62
        foreach ($this->endpoints as $endpoint) {
63
            if ($endpoint->supportsRegion($region) && $endpoint->supportsUrlType($urlType)) {
64
                return $endpoint->getUrl($urlType);
65
            }
66
        }
67
68
        return "";
69
    }
70
}
71