Passed
Push — master ( bfa63a...41a424 )
by Artem
01:47
created

Maintenance::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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