Notification   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 26
dl 0
loc 38
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\Account;
13
14
use Linode\Entity;
15
use Linode\Linode\LinodeEntity;
16
17
/**
18
 * An important, often time-sensitive item related to your Account.
19
 *
20
 * @property string       $label    A short description of this Notification.
21
 * @property string       $message  A human-readable description of the Notification.
22
 * @property string       $severity The severity of this Notification. This field can be used to decide how
23
 *                                  prominently to display the Notification, what color to make the display text, etc.
24
 * @property string       $when     If this Notification is of an Event that will happen at a fixed, future time, this
25
 *                                  is when the named action will be taken. For example, if a Linode is to be migrated
26
 *                                  in response to a Security Advisory, this field will contain the approximate time
27
 *                                  the Linode will be taken offline for migration.
28
 * @property string       $until    If this Notification has a duration, this will be the ending time for the
29
 *                                  Event/action. For example, if there is scheduled maintenance for one of our
30
 *                                  systems, `until` would be set to the end of the maintenance window.
31
 * @property string       $type     The type of Notification this is.
32
 * @property null|string  $body     A full description of this Notification, in markdown format. Not all Notifications
33
 *                                  include bodies.
34
 * @property LinodeEntity $entity   Detailed information about the Notification.
35
 */
36
class Notification extends Entity
37
{
38
    // Available fields.
39
    public const FIELD_LABEL    = 'label';
40
    public const FIELD_MESSAGE  = 'message';
41
    public const FIELD_SEVERITY = 'severity';
42
    public const FIELD_WHEN     = 'when';
43
    public const FIELD_UNTIL    = 'until';
44
    public const FIELD_TYPE     = 'type';
45
    public const FIELD_BODY     = 'body';
46
    public const FIELD_ENTITY   = 'entity';
47
48
    // `FIELD_SEVERITY` values.
49
    public const SEVERITY_MINOR    = 'minor';
50
    public const SEVERITY_MAJOR    = 'major';
51
    public const SEVERITY_CRITICAL = 'critical';
52
53
    // `FIELD_TYPE` values.
54
    public const TYPE_MIGRATION_SCHEDULED = 'migration_scheduled';
55
    public const TYPE_MIGRATION_IMMINENT  = 'migration_imminent';
56
    public const TYPE_MIGRATION_PENDING   = 'migration_pending';
57
    public const TYPE_REBOOT_SCHEDULED    = 'reboot_scheduled';
58
    public const TYPE_OUTAGE              = 'outage';
59
    public const TYPE_PAYMENT_DUE         = 'payment_due';
60
    public const TYPE_TICKET_IMPORTANT    = 'ticket_important';
61
    public const TYPE_TICKET_ABUSE        = 'ticket_abuse';
62
    public const TYPE_NOTICE              = 'notice';
63
    public const TYPE_MAINTENANCE         = 'maintenance';
64
    public const TYPE_PROMOTION           = 'promotion';
65
66
    /**
67
     * @codeCoverageIgnore This method was autogenerated.
68
     */
69
    public function __get(string $name): mixed
70
    {
71
        return match ($name) {
72
            self::FIELD_ENTITY => new LinodeEntity($this->client, $this->data[$name]),
73
            default            => parent::__get($name),
74
        };
75
    }
76
}
77