Server::getImage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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
}