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
01:49
created

Hypervisor::getAlias()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 25
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 2
eloc 20
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace OpenStack\Compute\v2\Models;
4
5
use OpenStack\Common\Resource\Alias;
6
use OpenStack\Common\Resource\Listable;
7
use OpenStack\Common\Resource\Retrievable;
8
use OpenStack\Common\Resource\OperatorResource;
9
10
/**
11
 * @property \OpenStack\Compute\v2\Api $api
12
 */
13
class Hypervisor extends OperatorResource implements
14
    Retrievable,
15
    Listable
16
{
17
    /** @var int */
18
    public $id;
19
20
    /** @var string */
21
    public $status;
22
23
    /** @var string */
24
    public $state;
25
26
    /** @var string */
27
    public $hostIp;
28
29
    /** @var int */
30
    public $freeDiskGb;
31
32
    /** @var int */
33
    public $freeRamMb;
34
35
    /** @var string */
36
    public $hypervisorHostname;
37
38
    /** @var string */
39
    public $hypervisorType;
40
41
    /** @var string */
42
    public $hypervisorVersion;
43
44
    /** @var int */
45
    public $localGb;
46
47
    /** @var int */
48
    public $localGbUsed;
49
50
    /** @var int */
51
    public $memoryMb;
52
53
    /** @var int */
54
    public $memoryMbUsed;
55
56
    /** @var int */
57
    public $runningVms;
58
59
    /** @var int */
60
    public $vcpus;
61
62
    /** @var int */
63
    public $vcpusUsed;
64
65
    /** @var array */
66
    public $cpuInfo;
67
68
    /** @var int */
69
    public $currentWorkload;
70
71
    /** @var int */
72
    public $diskAvailableLeast;
73
74
    /** @var array */
75
    public $service;
76
77
    protected $resourceKey = 'hypervisor';
78
    protected $resourcesKey = 'hypervisors';
79
80
    /**
81
     * @inheritdoc
82
     */
83
    protected static function getAlias(): Alias
84
    {
85
        $alias = parent::getAlias();
86
87
        if (!$alias->hasAliases(self::class)) {
88
            $alias
89
                ->add(self::class, 'host_ip', 'hostIp')
90
                ->add(self::class, 'free_disk_gb', 'freeDiskGb')
91
                ->add(self::class, 'free_ram_mb', 'freeRamMb')
92
                ->add(self::class, 'hypervisor_hostname', 'hypervisorHostname')
93
                ->add(self::class, 'hypervisor_type', 'hypervisorType')
94
                ->add(self::class, 'hypervisor_version', 'hypervisorVersion')
95
                ->add(self::class, 'local_gb', 'localGb')
96
                ->add(self::class, 'local_gb_used', 'localGbUsed')
97
                ->add(self::class, 'memory_mb', 'memoryMb')
98
                ->add(self::class, 'memory_mb_used', 'memoryMbUsed')
99
                ->add(self::class, 'running_vms', 'runningVms')
100
                ->add(self::class, 'vcpus_used', 'vcpusUsed')
101
                ->add(self::class, 'cpu_info', 'cpuInfo')
102
                ->add(self::class, 'current_workload', 'currentWorkload')
103
                ->add(self::class, 'disk_available_least', 'diskAvailableLeast');
104
        }
105
106
        return $alias;
107
    }
108
109
    /**
110
     * {@inheritDoc}
111
     */
112
    public function retrieve()
113
    {
114
        $response = $this->execute($this->api->getHypervisor(), ['id' => (string) $this->id]);
115
        $this->populateFromResponse($response);
116
    }
117
}
118