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.
Passed
Push — master ( 307cce...27531d )
by Jamie
04:17 queued 15s
created

Endpoint   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 9
c 2
b 0
f 1
lcom 2
cbo 2
dl 0
loc 82
ccs 26
cts 26
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A supportsRegion() 0 4 1
A supportsUrlType() 0 14 4
A getUrl() 0 18 4
1
<?php
2
3
namespace OpenStack\Identity\v2\Models;
4
5
use OpenStack\Common\HydratorStrategyTrait;
6
use OpenStack\Common\Resource\AbstractResource;
7
8
/**
9
 * Represents an Identity v2 catalog entry endpoint.
10
 *
11
 * @package OpenStack\Identity\v2\Models
12
 */
13
class Endpoint extends AbstractResource
14
{
15
    use HydratorStrategyTrait;
16
17
    /** @var string */
18
    public $adminUrl;
19
20
    /** @var string */
21
    public $region;
22
23
    /** @var string */
24
    public $internalUrl;
25
26
    /** @var string */
27
    public $publicUrl;
28
29
    protected $aliases = [
30
        'adminURL'    => 'adminUrl',
31
        'internalURL' => 'internalUrl',
32
        'publicURL'   => 'publicUrl',
33
    ];
34
35
    /**
36
     * Indicates whether a given region is supported
37
     *
38
     * @param string $region
39
     *
40
     * @return bool
41
     */
42 1
    public function supportsRegion($region)
43
    {
44 1
        return $this->region == $region;
45
    }
46
47
    /**
48
     * Indicates whether a given URL type is supported
49
     *
50
     * @param string $urlType
51
     *
52
     * @return bool
53
     */
54 1
    public function supportsUrlType($urlType)
55
    {
56 1
        $supported = false;
57
58 1
        switch (strtolower($urlType)) {
59 1
            case 'internalurl':
60 1
            case 'publicurl':
61 1
            case 'adminurl':
62 1
                $supported = true;
63 1
                break;
64 1
        }
65
66 1
        return $supported;
67
    }
68
69
    /**
70
     * Retrieves a URL for the endpoint based on a specific type.
71
     *
72
     * @param string $urlType Either "internalURL", "publicURL" or "adminURL" (case insensitive)
73
     *
74
     * @return bool|string
75
     */
76 3
    public function getUrl($urlType)
77
    {
78 3
        $url = false;
79
80 3
        switch (strtolower($urlType)) {
81 3
            case 'internalurl':
82 1
                $url = $this->internalUrl;
83 1
                break;
84 2
            case 'publicurl':
85 1
                $url = $this->publicUrl;
86 1
                break;
87 1
            case 'adminurl':
88 1
                $url = $this->adminUrl;
89 1
                break;
90 3
        }
91
92 3
        return $url;
93
    }
94
}
95