Passed
Push — master ( 01ab94...851c5d )
by Artem
01:46
created

StatsDataAvailable   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 4 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\Managed;
13
14
use Linode\Entity;
15
16
/**
17
 * A collection of graph data returned for managed stats.
18
 *
19
 * @property StatsData[] $cpu     CPU usage stats from the last 24 hours.
20
 * @property StatsData[] $disk    Disk usage stats from the last 24 hours.
21
 * @property StatsData[] $swap    Swap usage stats from the last 24 hours.
22
 * @property StatsData[] $net_in  Inbound network traffic stats from the last 24 hours.
23
 * @property StatsData[] $net_out Outbound network traffic stats from the last 24 hours.
24
 */
25
class StatsDataAvailable extends Entity
26
{
27
    // Available fields.
28
    public const FIELD_CPU     = 'cpu';
29
    public const FIELD_DISK    = 'disk';
30
    public const FIELD_SWAP    = 'swap';
31
    public const FIELD_NET_IN  = 'net_in';
32
    public const FIELD_NET_OUT = 'net_out';
33
34
    /**
35
     * @codeCoverageIgnore This method was autogenerated.
36
     */
37
    public function __get(string $name): mixed
38
    {
39
        return match ($name) {
40
            default => array_map(fn ($data) => new StatsData($this->client, $data), $this->data[$name]),
41
        };
42
    }
43
}
44