DeviceServer   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 98
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 98
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A fromArray() 0 13 1
A id() 0 4 1
A created() 0 4 1
A updated() 0 4 1
A ip() 0 4 1
A description() 0 4 1
A status() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Link0\Bunq\Domain;
4
5
use DateTimeImmutable;
6
use DateTimeInterface;
7
use DateTimeZone;
8
9
final class DeviceServer
10
{
11
    /**
12
     * @var int
13
     */
14
    private $id;
15
16
    /**
17
     * @var DateTimeInterface
18
     */
19
    private $created;
20
21
    /**
22
     * @var DateTimeInterface
23
     */
24
    private $updated;
25
26
    /**
27
     * @var string
28
     */
29
    private $ip;
30
31
    /**
32
     * @var string
33
     */
34
    private $description;
35
36
    /**
37
     * @var string
38
     */
39
    private $status;
40
41
    /**
42
     * @param array $structure
43
     * @return DeviceServer
44
     */
45
    public static function fromArray(array $structure)
46
    {
47
        $timezone = new DateTimeZone('UTC');
48
49
        $deviceServer = new static();
50
        $deviceServer->id = $structure['id'];
51
        $deviceServer->created = new DateTimeImmutable($structure['created'], $timezone);
52
        $deviceServer->updated = new DateTimeImmutable($structure['updated'], $timezone);
53
        $deviceServer->ip = $structure['ip'];
54
        $deviceServer->description = $structure['description'];
55
        $deviceServer->status = $structure['status'];
56
        return $deviceServer;
57
    }
58
59
    /**
60
     * @return int
61
     */
62
    public function id(): int
63
    {
64
        return $this->id;
65
    }
66
67
    /**
68
     * @return DateTimeInterface
69
     */
70
    public function created(): DateTimeInterface
71
    {
72
        return $this->created;
73
    }
74
75
    /**
76
     * @return DateTimeInterface
77
     */
78
    public function updated(): DateTimeInterface
79
    {
80
        return $this->updated;
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function ip(): string
87
    {
88
        return $this->ip;
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function description(): string
95
    {
96
        return $this->description;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function status(): string
103
    {
104
        return $this->status;
105
    }
106
}
107