VPC::__get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
// ---------------------------------------------------------------------
4
//
5
//  Copyright (C) 2018-2024 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <https://opensource.org/licenses/MIT>.
9
//
10
// ---------------------------------------------------------------------
11
12
namespace Linode\VPC;
13
14
use Linode\Entity;
15
use Linode\VPC\Repository\VPCSubnetRepository;
16
17
/**
18
 * An object describing a VPC belonging to the Account.
19
 *
20
 * @property int                          $id          The unique ID of the VPC.
21
 * @property string                       $label       The VPC's label, for display purposes only.
22
 *                                                     * Needs to be unique among the Account's VPCs.
23
 *                                                     * Can only contain ASCII letters, numbers, and hyphens (`-`). You can't use two
24
 *                                                     consecutive hyphens (`--`).
25
 * @property string                       $description A written description to help distinguish the VPC.
26
 * @property string                       $region      The Region for the VPC.
27
 * @property VPCSubnet[]                  $subnets     A list of subnets associated with the VPC.
28
 * @property string                       $created     The date-time of VPC creation.
29
 * @property null|string                  $updated     The date-time of the most recent VPC update.
30
 * @property VPCSubnetRepositoryInterface $vpcSubnets  VPC Subnets.
31
 */
32
class VPC extends Entity
33
{
34
    // Available fields.
35
    public const FIELD_ID          = 'id';
36
    public const FIELD_LABEL       = 'label';
37
    public const FIELD_DESCRIPTION = 'description';
38
    public const FIELD_REGION      = 'region';
39
    public const FIELD_SUBNETS     = 'subnets';
40
    public const FIELD_CREATED     = 'created';
41
    public const FIELD_UPDATED     = 'updated';
42
43
    /**
44
     * @codeCoverageIgnore This method was autogenerated.
45
     */
46
    public function __get(string $name): mixed
47
    {
48
        return match ($name) {
49
            'vpcSubnets' => new VPCSubnetRepository($this->client, $this->id),
50
            default      => parent::__get($name),
51
        };
52
    }
53
}
54