Address   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 0
dl 0
loc 44
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getStreet() 0 4 1
A getNumber() 0 4 1
A getZipCode() 0 4 1
B sameAs() 0 15 5
1
<?php
2
3
namespace ApiBundle\Tests\Domain\Fixtures;
4
5
use ApiBundle\Domain\ValueObject\ValueObjectInterface;
6
7
class Address implements ValueObjectInterface
8
{
9
    private $street;
10
    private $number;
11
    private $zipcode;
12
13
    public function __construct($street, $number, $zipcode)
14
    {
15
        $this->street = $street;
16
        $this->number = $number;
17
        $this->zipcode = $zipcode;
18
    }
19
20
    public function getStreet()
21
    {
22
        return $this->street;
23
    }
24
25
    public function getNumber()
26
    {
27
        return $this->number;
28
    }
29
30
    public function getZipCode()
31
    {
32
        return $this->zipcode;
33
    }
34
35
    public function sameAs(ValueObjectInterface $other)
36
    {
37
        if (!$other instanceof Address) {
38
            return false;
39
        }
40
41
        if (
42
            $this->getNumber() == $other->getNumber()
43
            && $this->getStreet() == $other->getStreet()
44
            && $this->getZipCode() == $other->getZipCode()
45
        ) {
46
            return true;
47
        }
48
        return false;
49
    }
50
}