1
|
|
|
<?php |
2
|
|
|
namespace MrPrompt\ShipmentCommon\Base; |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* Address |
6
|
|
|
* |
7
|
|
|
* @author Thiago Paes <[email protected]> |
8
|
|
|
*/ |
9
|
|
|
class Address |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* City |
13
|
|
|
* |
14
|
|
|
* @var string |
15
|
|
|
*/ |
16
|
|
|
private $city; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* State |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
private $state; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Postal Code - CEP |
27
|
|
|
* |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $postalCode; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Address |
34
|
|
|
* |
35
|
|
|
* @var string |
36
|
|
|
*/ |
37
|
|
|
private $address; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Address Number |
41
|
|
|
* |
42
|
|
|
* @var int |
43
|
|
|
*/ |
44
|
|
|
private $number; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* District |
48
|
|
|
* |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
private $district; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Complement |
55
|
|
|
* |
56
|
|
|
* @var string |
57
|
|
|
*/ |
58
|
|
|
private $complement; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Constructor |
62
|
|
|
* |
63
|
|
|
* @param string $city |
64
|
|
|
* @param string $state |
65
|
|
|
* @param string $postalCode |
66
|
|
|
* @param string $address |
67
|
|
|
* @param string $number |
68
|
|
|
* @param string $district |
69
|
|
|
* @param string $complement |
70
|
|
|
*/ |
71
|
17 |
|
public function __construct( |
72
|
|
|
string $city = '', |
73
|
|
|
string $state = '', |
74
|
|
|
string $postalCode = '', |
75
|
|
|
string $address = '', |
76
|
|
|
string $number = '', |
77
|
|
|
string $district = '', |
78
|
|
|
string $complement = '' |
79
|
|
|
) { |
80
|
17 |
|
$this->city = $city; |
81
|
17 |
|
$this->state = $state; |
82
|
17 |
|
$this->postalCode = $postalCode; |
83
|
17 |
|
$this->address = $address; |
84
|
17 |
|
$this->number = $number; |
|
|
|
|
85
|
17 |
|
$this->district = $district; |
86
|
17 |
|
$this->complement = $complement; |
87
|
17 |
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Return the city |
91
|
|
|
* |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
1 |
|
public function getCity(): string |
95
|
|
|
{ |
96
|
1 |
|
return $this->city; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Set the city |
101
|
|
|
* |
102
|
|
|
* @param string $city |
103
|
|
|
*/ |
104
|
2 |
|
public function setCity(string $city) |
105
|
|
|
{ |
106
|
2 |
|
$this->city = $city; |
107
|
2 |
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Get the state |
111
|
|
|
* |
112
|
|
|
* @return string |
113
|
|
|
*/ |
114
|
1 |
|
public function getState(): string |
115
|
|
|
{ |
116
|
1 |
|
return $this->state; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Set the state |
121
|
|
|
* |
122
|
|
|
* @param string $state |
123
|
|
|
*/ |
124
|
2 |
|
public function setState(string $state) |
125
|
|
|
{ |
126
|
2 |
|
$this->state = $state; |
127
|
2 |
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Get the postal code |
131
|
|
|
* |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
1 |
|
public function getPostalCode(): string |
135
|
|
|
{ |
136
|
1 |
|
return $this->postalCode; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Set the postal code |
141
|
|
|
* |
142
|
|
|
* @param string $postalCode |
143
|
|
|
*/ |
144
|
1 |
|
public function setPostalCode(string $postalCode) |
145
|
|
|
{ |
146
|
1 |
|
$this->postalCode = $postalCode; |
147
|
1 |
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return the $address |
151
|
|
|
*/ |
152
|
1 |
|
public function getAddress() |
153
|
|
|
{ |
154
|
1 |
|
return $this->address; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @param string $address |
159
|
|
|
*/ |
160
|
2 |
|
public function setAddress(string $address) |
161
|
|
|
{ |
162
|
2 |
|
$this->address = $address; |
163
|
2 |
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @return the $number |
167
|
|
|
*/ |
168
|
1 |
|
public function getNumber(): string |
169
|
|
|
{ |
170
|
1 |
|
return $this->number; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @param string $number |
175
|
|
|
*/ |
176
|
1 |
|
public function setNumber(string $number) |
177
|
|
|
{ |
178
|
1 |
|
$this->number = $number; |
|
|
|
|
179
|
1 |
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return the $district |
183
|
|
|
*/ |
184
|
1 |
|
public function getDistrict(): string |
185
|
|
|
{ |
186
|
1 |
|
return $this->district; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param string $district |
191
|
|
|
*/ |
192
|
1 |
|
public function setDistrict(string $district) |
193
|
|
|
{ |
194
|
1 |
|
$this->district = $district; |
195
|
1 |
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return the $complement |
199
|
|
|
*/ |
200
|
1 |
|
public function getComplement(): string |
201
|
|
|
{ |
202
|
1 |
|
return $this->complement; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* @param string $complement |
207
|
|
|
*/ |
208
|
1 |
|
public function setComplement(string $complement) |
209
|
|
|
{ |
210
|
1 |
|
$this->complement = $complement; |
211
|
1 |
|
} |
212
|
|
|
} |
213
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.