Passed
Push — main ( 91a3be...3a1441 )
by Iain
04:41
created

Address::getRegion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright Iain Cambridge 2020-2023.
7
 *
8
 * Use of this software is governed by the Business Source License included in the LICENSE file and at https://getparthenon.com/docs/next/license.
9
 *
10
 * Change Date: TBD ( 3 years after 2.2.0 release )
11
 *
12
 * On the date above, in accordance with the Business Source License, use of this software will be governed by the open source license specified in the LICENSE file.
13
 */
14
15
namespace Parthenon\Common;
16
17
use Doctrine\ORM\Mapping as ORM;
18
use Symfony\Component\Serializer\Annotation\SerializedName;
19
20
#[ORM\Embeddable]
21
class Address
22
{
23
    #[SerializedName('company_name')]
24
    #[ORM\Column(nullable: true)]
25
    private ?string $companyName = '';
26
27
    #[SerializedName('street_line_one')]
28
    #[ORM\Column(nullable: true)]
29
    private ?string $streetLineOne = '';
30
31
    #[SerializedName('street_line_two')]
32
    #[ORM\Column(nullable: true)]
33
    private ?string $streetLineTwo = '';
34
35
    #[SerializedName('city')]
36
    #[ORM\Column(nullable: true)]
37
    private ?string $city = '';
38
39
    #[SerializedName('region')]
40
    #[ORM\Column(nullable: true)]
41
    private ?string $region = '';
42
43
    #[SerializedName('country')]
44
    #[ORM\Column(nullable: true)]
45
    private ?string $country = '';
46
47
    #[SerializedName('post_code')]
48
    #[ORM\Column(nullable: true)]
49
    private ?string $postcode = '';
50
51
    public function getCompanyName(): ?string
52
    {
53
        return $this->companyName;
54
    }
55
56
    public function setCompanyName(?string $companyName): void
57
    {
58
        $this->companyName = $companyName;
59
    }
60
61
    public function hasCompanyName(): bool
62
    {
63
        return isset($this->companyName) && !empty($this->companyName);
64
    }
65
66
    public function getStreetLineOne(): ?string
67
    {
68
        return $this->streetLineOne;
69
    }
70
71
    public function setStreetLineOne(?string $streetLineOne): void
72
    {
73
        $this->streetLineOne = $streetLineOne;
74
    }
75
76
    public function hasStreetLineOne(): bool
77
    {
78
        return isset($this->streetLineOne) && !empty($this->streetLineOne);
79
    }
80
81
    public function getStreetLineTwo(): ?string
82
    {
83
        return $this->streetLineTwo;
84
    }
85
86
    public function setStreetLineTwo(?string $streetLineTwo): void
87
    {
88
        $this->streetLineTwo = $streetLineTwo;
89
    }
90
91
    public function hasStreetLineTwo(): bool
92
    {
93
        return isset($this->streetLineTwo) && !empty($this->streetLineTwo);
94
    }
95
96
    public function getCity(): ?string
97
    {
98
        return $this->city;
99
    }
100
101
    public function setCity(?string $city): void
102
    {
103
        $this->city = $city;
104
    }
105
106
    public function hasCity(): bool
107
    {
108
        return isset($this->city) && !empty($this->city);
109
    }
110
111
    public function getRegion(): ?string
112
    {
113
        return $this->region;
114
    }
115
116
    public function setRegion(?string $region): void
117
    {
118
        $this->region = $region;
119
    }
120
121
    public function hasRegion(): bool
122
    {
123
        return isset($this->region) && !empty($this->region);
124
    }
125
126
    public function getCountry(): ?string
127
    {
128
        if (!isset($this->country)) {
129
            return '';
130
        }
131
132
        return $this->country;
133
    }
134
135
    public function setCountry(?string $country): void
136
    {
137
        $this->country = $country;
138
    }
139
140
    public function hasCountry(): bool
141
    {
142
        return isset($this->country) && !empty($this->country);
143
    }
144
145
    public function getPostcode(): ?string
146
    {
147
        return $this->postcode;
148
    }
149
150
    public function setPostcode(?string $postcode): void
151
    {
152
        $this->postcode = $postcode;
153
    }
154
155
    public function hasPostcode(): bool
156
    {
157
        return isset($this->postcode) && !empty($this->postcode);
158
    }
159
}
160