LongviewClient   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 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\Longview;
13
14
use Linode\Entity;
15
16
/**
17
 * A LongviewClient is a single monitor set up to track statistics about one of your
18
 * servers.
19
 *
20
 * @property int          $id           This Client's unique ID.
21
 * @property string       $label        This Client's unique label. This is for display purposes only.
22
 * @property string       $api_key      The API key for this Client, used when configuring the Longview
23
 *                                      Client application on your Linode.
24
 *                                      Returns as `[REDACTED]` if you do not have read-write access to this client.
25
 * @property string       $install_code The install code for this Client, used when configuring the Longview
26
 *                                      Client application on your Linode.
27
 *                                      Returns as `[REDACTED]` if you do not have read-write access to this client.
28
 * @property string       $created      When this Longview Client was created.
29
 * @property string       $updated      When this Longview Client was last updated.
30
 * @property LongviewApps $apps         The apps this Client is monitoring on your Linode. This is configured when you
31
 *                                      install the Longview Client application, and is present here for information
32
 *                                      purposes only.
33
 */
34
class LongviewClient extends Entity
35
{
36
    // Available fields.
37
    public const FIELD_ID           = 'id';
38
    public const FIELD_LABEL        = 'label';
39
    public const FIELD_API_KEY      = 'api_key';
40
    public const FIELD_INSTALL_CODE = 'install_code';
41
    public const FIELD_CREATED      = 'created';
42
    public const FIELD_UPDATED      = 'updated';
43
    public const FIELD_APPS         = 'apps';
44
45
    /**
46
     * @codeCoverageIgnore This method was autogenerated.
47
     */
48
    public function __get(string $name): mixed
49
    {
50
        return match ($name) {
51
            self::FIELD_APPS => new LongviewApps($this->client, $this->data[$name]),
52
            default          => parent::__get($name),
53
        };
54
    }
55
}
56