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::getAliases()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 1
cts 1
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1
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