Passed
Push — master ( f0f514...a1b81d )
by Artem
01:46
created

Transfer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 5 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\Account;
13
14
use Linode\Entity;
15
16
/**
17
 * An object representing your network utilization for the current month, in
18
 * Gigabytes.
19
 *
20
 * Certain Regions have separate utilization quotas and rates. For Region-specific
21
 * network utilization data, see `region_transfers`.
22
 *
23
 * @property int              $quota            The amount of network usage allowed this billing cycle.
24
 * @property int              $used             The amount of network usage you have used this billing cycle.
25
 * @property int              $billable         The amount of your transfer pool that is billable this billing cycle.
26
 * @property RegionTransfer[] $region_transfers
27
 */
28
class Transfer extends Entity
29
{
30
    // Available fields.
31
    public const FIELD_QUOTA            = 'quota';
32
    public const FIELD_USED             = 'used';
33
    public const FIELD_BILLABLE         = 'billable';
34
    public const FIELD_REGION_TRANSFERS = 'region_transfers';
35
36
    /**
37
     * @codeCoverageIgnore This method was autogenerated.
38
     */
39
    public function __get(string $name): mixed
40
    {
41
        return match ($name) {
42
            self::FIELD_REGION_TRANSFERS => array_map(fn ($data) => new RegionTransfer($this->client, $data), $this->data[$name]),
43
            default                      => parent::__get($name),
44
        };
45
    }
46
}
47