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

Port::getAlias()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.4285
ccs 9
cts 9
cp 1
cc 2
eloc 15
nc 2
nop 0
crap 2
1
<?php declare(strict_types=1);
2
3
namespace OpenStack\Networking\v2\Models;
4
5
use OpenStack\Common\Resource\Alias;
6
use OpenStack\Common\Resource\OperatorResource;
7
use OpenStack\Common\Resource\Creatable;
8
use OpenStack\Common\Resource\Deletable;
9
use OpenStack\Common\Resource\HasWaiterTrait;
10
use OpenStack\Common\Resource\Listable;
11
use OpenStack\Common\Resource\Retrievable;
12
use OpenStack\Common\Resource\Updateable;
13
14
/**
15
 * @property \OpenStack\Networking\v2\Api $api
16
 */
17
class Port extends OperatorResource implements Creatable, Updateable, Deletable, Listable, Retrievable
18
{
19
    use HasWaiterTrait;
20
21
    /**
22
     * The port status. Value is ACTIVE or DOWN.
23
     *
24
     * @var string
25
     */
26
    public $status;
27
28
    /**
29
     * The port name.
30
     *
31
     * @var string
32
     */
33
    public $name;
34
35
    /**
36
     * A set of zero or more allowed address pairs. An address pair consists of an IP address and MAC address.
37
     *
38
     * @var []string
39
     */
40
    public $allowedAddressPairs;
41
42
    /**
43
     * The administrative state of the port, which is up (true) or down (false).
44
     *
45
     * @var bool
46
     */
47
    public $adminStateUp;
48
49
    /**
50
     * The UUID of the attached network.
51
     *
52
     * @var string
53
     */
54
    public $networkId;
55
56
    /**
57
     * The UUID of the tenant who owns the network. Only administrative users can specify a tenant UUID other than
58
     * their own.
59
     *
60
     * @var string
61
     */
62
    public $tenantId;
63
64
    /**
65
     * A set of zero or more extra DHCP option pairs. An option pair consists of an option value and name.
66
     *
67
     * @var array
68
     */
69
    public $extraDhcpOpts;
70
71
    /**
72
     * The UUID of the entity that uses this port. For example, a DHCP agent.
73
     *
74
     * @var string
75
     */
76
    public $deviceOwner;
77
78
    /**
79
     * The MAC address of the port.
80
     *
81
     * @var string
82
     */
83
    public $macAddress;
84
85
    /**
86
     * The IP addresses for the port. Includes the IP address and UUID of the subnet.
87
     *
88
     * @var array
89
     */
90
    public $fixedIps;
91
92
    /**
93
     * The UUID of the port.
94
     *
95
     * @var string
96
     */
97
    public $id;
98
99
    /**
100
     * The UUIDs of any attached security groups.
101
     *
102
     * @var array
103
     */
104
    public $securityGroups;
105
106
    /**
107
     * The UUID of the device that uses this port. For example, a virtual server.
108
     *
109
     * @var string
110
     */
111
    public $deviceId;
112
113
    /**
114
     * The port security status. The status is enabled (true) or disabled (false).
115
     *
116
     * @var bool
117
     */
118
    public $portSecurityEnabled;
119
120
    protected $resourceKey = 'port';
121 1
122
    /**
123 1
     * @inheritdoc
124 1
     */
125
    protected static function getAlias(): Alias
126
    {
127 1
        $alias = parent::getAlias();
128
129 1
        if (!$alias->hasAliases(self::class)) {
130 1
            $alias
131
                ->add(self::class, 'admin_state_up', 'adminStateUp')
132
                ->add(self::class, 'display_name', 'displayName')
133 1
                ->add(self::class, 'network_id', 'networkId')
134
                ->add(self::class, 'tenant_id', 'tenantId')
135 1
                ->add(self::class, 'device_owner', 'deviceOwner')
136 1
                ->add(self::class, 'mac_address', 'macAddress')
137
                ->add(self::class, 'port_id', 'portId')
138 1
                ->add(self::class, 'security_groups', 'securityGroups')
139
                ->add(self::class, 'device_id', 'deviceId')
140 1
                ->add(self::class, 'fixed_ips', 'fixedIps');
141 1
        }
142
143
        return $alias;
144
    }
145
146
    /**
147
     * {@inheritDoc}
148
     */
149
    public function create(array $userOptions): Creatable
150
    {
151
        $response = $this->execute($this->api->postSinglePort(), $userOptions);
152
        return $this->populateFromResponse($response);
153
    }
154
155
    public function bulkCreate(array $userOptions): array
156
    {
157
        $response = $this->execute($this->api->postMultiplePorts(), ['ports' => $userOptions]);
158
        return $this->extractMultipleInstances($response);
159
    }
160
161
    public function retrieve()
162
    {
163
        $response = $this->execute($this->api->getPort(), ['id' => (string)$this->id]);
164
        $this->populateFromResponse($response);
165
    }
166
167
    public function update()
168
    {
169
        $response = $this->executeWithState($this->api->putPort());
170
        $this->populateFromResponse($response);
171
    }
172
173
    public function delete()
174
    {
175
        $this->executeWithState($this->api->deletePort());
176
    }
177
}
178