Address   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 80
c 0
b 0
f 0
wmc 7
lcom 1
cbo 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A street() 0 4 1
A zipcode() 0 4 1
A city() 0 4 1
A equals() 0 7 3
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Metadata\Tests\Fixtures;
13
14
use Cubiche\Domain\Model\Entity;
15
use Cubiche\Domain\System\StringLiteral;
16
use Cubiche\Core\Metadata\Tests\Fixtures\Annotations as Cubiche;
17
18
/**
19
 * Address class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 * @Cubiche\Entity
23
 */
24
class Address extends Entity
25
{
26
    /**
27
     * @var IdInterface
28
     * @Cubiche\Id
29
     */
30
    protected $id;
31
32
    /**
33
     * @var StringLiteral
34
     * @Cubiche\Field(type="StringLiteral")
35
     */
36
    protected $street;
37
38
    /**
39
     * @var StringLiteral
40
     * @Cubiche\Field(type="StringLiteral", name="zip")
41
     */
42
    protected $zipcode;
43
44
    /**
45
     * @var StringLiteral
46
     * @Cubiche\Field(type="StringLiteral")
47
     */
48
    protected $city;
49
50
    /**
51
     * Address constructor.
52
     *
53
     * @param AddressId $id
54
     * @param string    $street
55
     * @param string    $zipcode
56
     * @param string    $city
57
     */
58
    public function __construct(AddressId $id, $street, $zipcode, $city)
59
    {
60
        parent::__construct($id);
61
62
        $this->street = StringLiteral::fromNative($street);
63
        $this->zipcode = StringLiteral::fromNative($zipcode);
64
        $this->city = StringLiteral::fromNative($city);
65
    }
66
67
    /**
68
     * @return StringLiteral
69
     */
70
    public function street()
71
    {
72
        return $this->street;
73
    }
74
75
    /**
76
     * @return StringLiteral
77
     */
78
    public function zipcode()
79
    {
80
        return $this->zipcode;
81
    }
82
83
    /**
84
     * @return StringLiteral
85
     */
86
    public function city()
87
    {
88
        return $this->city;
89
    }
90
91
    /**
92
     * @param Address $other
93
     *
94
     * @return bool
95
     */
96
    public function equals($other)
97
    {
98
        return $this->street() == $other->street() &&
99
            $this->zipcode() == $other->zipcode() &&
100
            $this->city() == $other->city()
101
        ;
102
    }
103
}
104