HasAddress::getPostcode()   A
last analyzed

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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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
    #[ORM\Column(type: 'string', length: 191, options: ['default' => ''])]
16
    private string $firstName = '';
17
18
    #[ORM\Column(type: 'string', length: 191, options: ['default' => ''])]
19
    private string $lastName = '';
20
21
    #[ORM\Column(type: 'string', options: ['default' => ''])]
22
    private string $street = '';
23
24
    #[ORM\Column(type: 'string', length: 20, options: ['default' => ''])]
25
    private string $postcode = '';
26
27
    #[ORM\Column(type: 'string', length: 255, options: ['default' => ''])]
28
    private string $locality = '';
29
30
    #[ORM\ManyToOne(targetEntity: Country::class)]
31
    #[ORM\JoinColumn(onDelete: 'SET NULL')]
32
    private ?Country $country = null;
33
34
    /**
35
     * Set first name.
36
     *
37
     * @param string $firstName
38
     */
39 16
    public function setFirstName($firstName): void
40
    {
41 16
        $this->firstName = $firstName;
42
    }
43
44
    /**
45
     * Get first name.
46
     */
47 14
    public function getFirstName(): string
48
    {
49 14
        return (string) $this->firstName;
50
    }
51
52
    /**
53
     * Set last name.
54
     *
55
     * @param string $lastName
56
     */
57 16
    public function setLastName($lastName): void
58
    {
59 16
        $this->lastName = $lastName;
60
    }
61
62
    /**
63
     * Get last name.
64
     */
65 14
    public function getLastName(): string
66
    {
67 14
        return (string) $this->lastName;
68
    }
69
70 5
    public function getStreet(): string
71
    {
72 5
        return $this->street;
73
    }
74
75 15
    public function setStreet(string $street): void
76
    {
77 15
        $this->street = $street;
78
    }
79
80 5
    public function getPostcode(): string
81
    {
82 5
        return $this->postcode;
83
    }
84
85 15
    public function setPostcode(string $postcode): void
86
    {
87 15
        $this->postcode = $postcode;
88
    }
89
90 5
    public function getLocality(): string
91
    {
92 5
        return $this->locality;
93
    }
94
95 15
    public function setLocality(string $locality): void
96
    {
97 15
        $this->locality = $locality;
98
    }
99
100 5
    public function getCountry(): ?Country
101
    {
102 5
        return $this->country;
103
    }
104
105 15
    public function setCountry(?Country $country = null): void
106
    {
107 15
        $this->country = $country;
108
    }
109
}
110