PluginProbe
Packeta / 2.3.2
Packeta v2.3.2
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Core / Entity / Address.php

Address.php in Packeta 2.3.2, at src/Packetery/Core/Entity/Address.php

210 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Address.
4 *
5 * @package Packetery\Entity
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Core\Entity;
11
12 /**
13 * Class Address.
14 *
15 * @package Packetery\Entity
16 */
17 class Address {
18
19 /**
20 * Customer street for address delivery.
21 *
22 * @var string|null
23 */
24 private $street;
25
26 /**
27 * Customer city for address delivery.
28 *
29 * @var string|null
30 */
31 private $city;
32
33 /**
34 * Customer zip for address delivery.
35 *
36 * @var string|null
37 */
38 private $zip;
39
40 /**
41 * Customer house number.
42 *
43 * @var string|null
44 */
45 private $houseNumber;
46
47 /**
48 * Longitude.
49 *
50 * @var string|null
51 */
52 private $longitude;
53
54 /**
55 * Latitude.
56 *
57 * @var string|null
58 */
59 private $latitude;
60
61 /**
62 * County.
63 *
64 * @var string|null
65 */
66 private $county;
67
68 /**
69 * Address constructor.
70 *
71 * @param string|null $street Street.
72 * @param string|null $city City.
73 * @param string|null $zip Zip.
74 */
75 public function __construct( ?string $street, ?string $city, ?string $zip ) {
76 $this->street = $street;
77 $this->city = $city;
78 $this->zip = $zip;
79 }
80
81 /**
82 * Gets full address.
83 *
84 * @return string
85 */
86 public function getFullAddress(): string {
87 return sprintf(
88 '%s%s, %s %s',
89 $this->street,
90 ( $this->houseNumber !== null ? ' ' . $this->houseNumber : '' ),
91 $this->city,
92 $this->zip
93 );
94 }
95
96 /**
97 * Gets street.
98 *
99 * @return string|null
100 */
101 public function getStreet(): ?string {
102 return $this->street;
103 }
104
105 /**
106 * Gets city.
107 *
108 * @return string|null
109 */
110 public function getCity(): ?string {
111 return $this->city;
112 }
113
114 /**
115 * Gets zip.
116 *
117 * @return string|null
118 */
119 public function getZip(): ?string {
120 return $this->zip;
121 }
122
123 /**
124 * Gets house number.
125 *
126 * @return string|null
127 */
128 public function getHouseNumber(): ?string {
129 return $this->houseNumber;
130 }
131
132 /**
133 * Sets house number.
134 *
135 * @param string|null $houseNumber House number.
136 */
137 public function setHouseNumber( ?string $houseNumber ): void {
138 $this->houseNumber = $houseNumber;
139 }
140
141 /**
142 * Gets longitude.
143 *
144 * @return string|null
145 */
146 public function getLongitude(): ?string {
147 return $this->longitude;
148 }
149
150 /**
151 * Sets longitude.
152 *
153 * @param string|null $longitude Longitude.
154 *
155 * @return void
156 */
157 public function setLongitude( ?string $longitude ): void {
158 $this->longitude = $longitude;
159 }
160
161 /**
162 * Gets latitude.
163 *
164 * @return string|null
165 */
166 public function getLatitude(): ?string {
167 return $this->latitude;
168 }
169
170 /**
171 * Sets latitude.
172 *
173 * @param string|null $latitude Latitude.
174 *
175 * @return void
176 */
177 public function setLatitude( ?string $latitude ): void {
178 $this->latitude = $latitude;
179 }
180
181 /**
182 * Gets county.
183 *
184 * @return string|null
185 */
186 public function getCounty(): ?string {
187 return $this->county;
188 }
189
190 /**
191 * Sets county.
192 *
193 * @param string|null $county County.
194 *
195 * @return void
196 */
197 public function setCounty( ?string $county ): void {
198 $this->county = $county;
199 }
200
201 /**
202 * Export.
203 *
204 * @return array<string, string|null>
205 */
206 public function export(): array {
207 return get_object_vars( $this );
208 }
209 }
210