LinodeStats   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 11
dl 0
loc 19
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 7 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\LinodeInstances;
13
14
use Linode\Entity;
15
16
/**
17
 * CPU, IO, IPv4, and IPv6 statistics. Graph data, if available, is in "[timestamp,
18
 * reading]" array format. Timestamp is a UNIX timestamp in EST.
19
 *
20
 * @property string       $title The title for this data set.
21
 * @property float[][]    $cpu   Percentage of CPU used.
22
 * @property IOStats      $io    Input/Output statistics.
23
 * @property NetworkStats $netv4 IPv4 statistics.
24
 * @property NetworkStats $netv6 IPv6 statistics.
25
 */
26
class LinodeStats extends Entity
27
{
28
    // Available fields.
29
    public const FIELD_TITLE = 'title';
30
    public const FIELD_CPU   = 'cpu';
31
    public const FIELD_IO    = 'io';
32
    public const FIELD_NETV4 = 'netv4';
33
    public const FIELD_NETV6 = 'netv6';
34
35
    /**
36
     * @codeCoverageIgnore This method was autogenerated.
37
     */
38
    public function __get(string $name): mixed
39
    {
40
        return match ($name) {
41
            self::FIELD_IO    => new IOStats($this->client, $this->data[$name]),
42
            self::FIELD_NETV4,
43
            self::FIELD_NETV6 => new NetworkStats($this->client, $this->data[$name]),
44
            default           => parent::__get($name),
45
        };
46
    }
47
}
48