Completed
Push — master ( 6b4d01...deddd6 )
by Daniel
03:16
created

Address::sameAs()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
rs 8.8571
cc 5
eloc 9
nc 3
nop 1
1
<?php
2
3
namespace Application\Tests\Domain\Fixtures;
4
5
use Application\Domain\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
}