Failed Conditions
Push — master ( f7bbe5...2d1803 )
by Sam
11:37
created

HasAddress::setPostcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Traits;
6
7
use Application\Model\Country;
8
use Doctrine\ORM\Mapping as ORM;
9
10
/**
11
 * Common fields to represent an address.
12
 */
13
trait HasAddress
14
{
15
    /**
16
     * @var string
17
     * @ORM\Column(type="string", length=191, options={"default" = ""})
18
     */
19
    private $firstName = '';
20
21
    /**
22
     * @var string
23
     * @ORM\Column(type="string", length=191, options={"default" = ""})
24
     */
25
    private $lastName = '';
26
27
    /**
28
     * @var string
29
     * @ORM\Column(type="string", options={"default" = ""})
30
     */
31
    private $street = '';
32
33
    /**
34
     * @var string
35
     * @ORM\Column(type="string", length=20, options={"default" = ""})
36
     */
37
    private $postcode = '';
38
39
    /**
40
     * @var string
41
     * @ORM\Column(type="string", length=255, options={"default" = ""})
42
     */
43
    private $locality = '';
44
45
    /**
46
     * @var Country
47
     * @ORM\ManyToOne(targetEntity="Country")
48
     * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
49
     */
50
    private $country;
51
52
    /**
53
     * Set first name
54
     *
55
     * @param string $firstName
56
     */
57 13
    public function setFirstName($firstName): void
58
    {
59 13
        $this->firstName = $firstName;
60 13
    }
61
62
    /**
63
     * Get first name
64
     */
65 9
    public function getFirstName(): string
66
    {
67 9
        return (string) $this->firstName;
68
    }
69
70
    /**
71
     * Set last name
72
     *
73
     * @param string $lastName
74
     */
75 13
    public function setLastName($lastName): void
76
    {
77 13
        $this->lastName = $lastName;
78 13
    }
79
80
    /**
81
     * Get last name
82
     */
83 9
    public function getLastName(): string
84
    {
85 9
        return (string) $this->lastName;
86
    }
87
88 4
    public function getStreet(): string
89
    {
90 4
        return $this->street;
91
    }
92
93 12
    public function setStreet(string $street): void
94
    {
95 12
        $this->street = $street;
96 12
    }
97
98 4
    public function getPostcode(): string
99
    {
100 4
        return $this->postcode;
101
    }
102
103 12
    public function setPostcode(string $postcode): void
104
    {
105 12
        $this->postcode = $postcode;
106 12
    }
107
108 4
    public function getLocality(): string
109
    {
110 4
        return $this->locality;
111
    }
112
113 12
    public function setLocality(string $locality): void
114
    {
115 12
        $this->locality = $locality;
116 12
    }
117
118 4
    public function getCountry(): ?Country
119
    {
120 4
        return $this->country;
121
    }
122
123 12
    public function setCountry(?Country $country = null): void
124
    {
125 12
        $this->country = $country;
126 12
    }
127
}
128