Server   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 91.67%

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 2
dl 0
loc 82
ccs 22
cts 24
cp 0.9167
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A makeFromServerJson() 0 3 1
A getId() 0 3 1
A getState() 0 3 1
A getImage() 0 3 1
A getPublicIp() 0 3 1
A getPrivateIp() 0 3 1
A getCommercialType() 0 3 1
A getVolumes() 0 3 1
1
<?php
2
3
namespace ChrisArmitage\ScalewayApi\Domain;
4
5
class Server
6
{
7
    protected $id;
8
    protected $state;
9
10
    /**
11
     * @var Image
12
     */
13
    protected $image;
14
    protected $publicIp;
15
    protected $privateIp;
16
    protected $commercialType;
17
    protected $volumes = [];
18
19 1
    protected function __construct($server) {
20 1
        $this->id = $server->id;
21 1
        $this->state = $server->state;
22 1
        $this->image = Image::makeFromImageJson($server->image);
23 1
        $this->publicIp = Ip::makeFromIpJson($server->public_ip);
24 1
        $this->privateIp = Ip::makeFromIpAddress($server->private_ip);
25 1
        $this->commercialType = $server->commercial_type;
26 1
    }
27
28
    /**
29
     * @param $serverJson
30
     * @return static
31
     */
32 1
    static public function makeFromServerJson($serverJson) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
33 1
        return new static($serverJson);
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39 1
    public function getId() {
40 1
        return $this->id;
41
    }
42
43
    /**
44
     * @return string
45
     */
46 1
    public function getState() {
47 1
        return $this->state;
48
    }
49
50
    /**
51
     * @return Image
52
     */
53 1
    public function getImage() {
54 1
        return $this->image;
55
    }
56
57
    /**
58
     * @return Ip
59
     */
60 1
    public function getPublicIp() {
61 1
        return $this->publicIp;
62
    }
63
64
    /**
65
     * @return Ip
66
     */
67 1
    public function getPrivateIp() {
68 1
        return $this->privateIp;
69
    }
70
71
    /**
72
     * @return mixed
73
     */
74 1
    public function getCommercialType() {
75 1
        return $this->commercialType;
76
    }
77
78
    /**
79
     * @return array
80
     */
81
    public function getVolumes() {
82
        return $this->volumes;
83
    }
84
85
86
}