Maintenance   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 15
c 1
b 0
f 0
dl 0
loc 27
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
use Linode\Linode\LinodeEntity;
16
17
/**
18
 * Information about maintenance affecting an entity.
19
 *
20
 * @property string       $type   The type of maintenance.
21
 * @property string       $status The maintenance status.
22
 *                                Maintenance progresses in the following sequence: pending, started, then
23
 *                                completed.
24
 * @property string       $reason The reason maintenance is being performed.
25
 * @property string       $when   When the maintenance will begin.
26
 *                                Filterable with the following parameters:
27
 *                                * A single value in date-time string format ("%Y-%m-%dT%H:%M:%S"), which returns
28
 *                                only matches to that value.
29
 *                                * A dictionary containing pairs of inequality operator string keys ("+or", "+gt",
30
 *                                "+gte", "+lt", "+lte",
31
 *                                or "+neq") and single date-time string format values ("%Y-%m-%dT%H:%M:%S"). "+or"
32
 *                                accepts an array of values that
33
 *                                may consist of single date-time strings or dictionaries of inequality operator
34
 *                                pairs.
35
 * @property LinodeEntity $entity The entity being affected by maintenance.
36
 */
37
class Maintenance extends Entity
38
{
39
    // Available fields.
40
    public const FIELD_TYPE   = 'type';
41
    public const FIELD_STATUS = 'status';
42
    public const FIELD_REASON = 'reason';
43
    public const FIELD_WHEN   = 'when';
44
    public const FIELD_ENTITY = 'entity';
45
46
    // `FIELD_TYPE` values.
47
    public const TYPE_REBOOT         = 'reboot';
48
    public const TYPE_COLD_MIGRATION = 'cold_migration';
49
    public const TYPE_LIVE_MIGRATION = 'live_migration';
50
51
    // `FIELD_STATUS` values.
52
    public const STATUS_COMPLETED = 'completed';
53
    public const STATUS_PENDING   = 'pending';
54
    public const STATUS_STARTED   = 'started';
55
56
    /**
57
     * @codeCoverageIgnore This method was autogenerated.
58
     */
59
    public function __get(string $name): mixed
60
    {
61
        return match ($name) {
62
            self::FIELD_ENTITY => new LinodeEntity($this->client, $this->data[$name]),
63
            default            => parent::__get($name),
64
        };
65
    }
66
}
67