Ip   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 0
loc 35
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A makeFromIpJson() 0 6 3
A makeFromIpAddress() 0 3 1
A getId() 0 3 1
A getAddress() 0 3 1
1
<?php
2
3
namespace ChrisArmitage\ScalewayApi\Domain;
4
5
class Ip
6
{
7
    protected $id;
8
    protected $address;
9
10 2
    protected function __construct($id, $address) {
11 2
        $this->id = $id;
12 2
        $this->address = $address;
13 2
    }
14
15 1
    static public function makeFromIpJson($ipJson) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
16 1
        return new static(
17 1
            isset($ipJson->id) ? $ipJson->id : null,
18 1
            isset($ipJson->address) ? $ipJson->address : null
19 1
        );
20
    }
21
22 1
    static public function makeFromIpAddress($ipAddress) {
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
23 1
        return new static(null, $ipAddress);
24
    }
25
26
    /**
27
     * @return mixed
28
     */
29 2
    public function getId() {
30 2
        return $this->id;
31
    }
32
33
    /**
34
     * @return mixed
35
     */
36 2
    public function getAddress() {
37 2
        return $this->address;
38
    }
39
}