Passed
Push — master ( 0676a7...01ab94 )
by Artem
11:54
created

ManagedContact   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 18
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\Managed;
13
14
use Linode\Entity;
15
16
/**
17
 * Information about someone Linode's special forces may contact in case an issue is
18
 * detected with a manager service.
19
 *
20
 * @property int    $id      This Contact's unique ID.
21
 * @property string $name    The name of this Contact.
22
 * @property string $email   The address to email this Contact to alert them of issues.
23
 * @property Phone  $phone   Information about how to reach this Contact by phone.
24
 * @property string $group   A grouping for this Contact. This is for display purposes only.
25
 * @property string $updated When this Contact was last updated.
26
 */
27
class ManagedContact extends Entity
28
{
29
    // Available fields.
30
    public const FIELD_ID      = 'id';
31
    public const FIELD_NAME    = 'name';
32
    public const FIELD_EMAIL   = 'email';
33
    public const FIELD_PHONE   = 'phone';
34
    public const FIELD_GROUP   = 'group';
35
    public const FIELD_UPDATED = 'updated';
36
37
    /**
38
     * @codeCoverageIgnore This method was autogenerated.
39
     */
40
    public function __get(string $name): mixed
41
    {
42
        return match ($name) {
43
            self::FIELD_PHONE => new Phone($this->client, $this->data[$name]),
44
            default           => parent::__get($name),
45
        };
46
    }
47
}
48