1
|
|
|
<?php |
2
|
|
|
namespace Eduardokum\CorreiosPhp\Entities; |
3
|
|
|
|
4
|
|
|
use Eduardokum\CorreiosPhp\Traits\MagicTrait; |
5
|
|
|
|
6
|
|
|
class Recipient |
7
|
|
|
{ |
8
|
|
|
use MagicTrait; |
9
|
|
|
|
10
|
|
|
private $national = 1; |
11
|
|
|
private $name; |
12
|
|
|
private $phone; |
13
|
|
|
private $cellphone; |
14
|
|
|
private $mail; |
15
|
|
|
private $street; |
16
|
|
|
private $number; |
17
|
|
|
private $complement; |
18
|
|
|
private $district; |
19
|
|
|
private $city; |
20
|
|
|
private $state; |
21
|
|
|
private $cep; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @return $this |
25
|
|
|
*/ |
26
|
|
|
public function national() |
27
|
|
|
{ |
28
|
|
|
$this->national = 1; |
29
|
|
|
return $this; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return $this |
34
|
|
|
*/ |
35
|
|
|
public function international() |
36
|
|
|
{ |
37
|
|
|
$this->national = 0; |
38
|
|
|
return $this; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return boolean |
43
|
|
|
*/ |
44
|
|
|
public function isNational() |
45
|
|
|
{ |
46
|
|
|
return $this->national; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return boolean |
51
|
|
|
*/ |
52
|
|
|
public function isInternational() |
53
|
|
|
{ |
54
|
|
|
return !$this->national; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
|
|
public function getName() |
61
|
|
|
{ |
62
|
|
|
return $this->name; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param mixed $name |
67
|
|
|
* |
68
|
|
|
* @return Recipient |
69
|
|
|
*/ |
70
|
|
|
public function setName($name) |
71
|
|
|
{ |
72
|
|
|
$this->name = substr($name, 0, 50); |
73
|
|
|
|
74
|
|
|
return $this; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return mixed |
79
|
|
|
*/ |
80
|
|
|
public function getPhone() |
81
|
|
|
{ |
82
|
|
|
return $this->phone; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param mixed $phone |
87
|
|
|
* |
88
|
|
|
* @return Recipient |
89
|
|
|
*/ |
90
|
|
|
public function setPhone($phone) |
91
|
|
|
{ |
92
|
|
|
$this->phone = substr($phone, 0, 12); |
93
|
|
|
|
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return mixed |
99
|
|
|
*/ |
100
|
|
|
public function getCellphone() |
101
|
|
|
{ |
102
|
|
|
return $this->cellphone; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @param mixed $cellphone |
107
|
|
|
* |
108
|
|
|
* @return Recipient |
109
|
|
|
*/ |
110
|
|
|
public function setCellphone($cellphone) |
111
|
|
|
{ |
112
|
|
|
$this->cellphone = substr($cellphone, 0, 12); |
113
|
|
|
|
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return mixed |
119
|
|
|
*/ |
120
|
|
|
public function getMail() |
121
|
|
|
{ |
122
|
|
|
return $this->mail; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param mixed $mail |
127
|
|
|
* |
128
|
|
|
* @return Recipient |
129
|
|
|
*/ |
130
|
|
|
public function setMail($mail) |
131
|
|
|
{ |
132
|
|
|
$this->mail = substr($mail, 0, 50); |
133
|
|
|
|
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return mixed |
139
|
|
|
*/ |
140
|
|
|
public function getStreet() |
141
|
|
|
{ |
142
|
|
|
return $this->street; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param mixed $street |
147
|
|
|
* |
148
|
|
|
* @return Recipient |
149
|
|
|
*/ |
150
|
|
|
public function setStreet($street) |
151
|
|
|
{ |
152
|
|
|
$this->street = substr($street, 0, 50); |
153
|
|
|
|
154
|
|
|
return $this; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @return mixed |
159
|
|
|
*/ |
160
|
|
|
public function getNumber() |
161
|
|
|
{ |
162
|
|
|
return $this->number; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @param mixed $number |
167
|
|
|
* |
168
|
|
|
* @return Recipient |
169
|
|
|
*/ |
170
|
|
|
public function setNumber($number) |
171
|
|
|
{ |
172
|
|
|
$this->number = $number; |
173
|
|
|
|
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* @return mixed |
179
|
|
|
*/ |
180
|
|
|
public function getComplement() |
181
|
|
|
{ |
182
|
|
|
return $this->complement; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @param mixed $complement |
187
|
|
|
* |
188
|
|
|
* @return Recipient |
189
|
|
|
*/ |
190
|
|
|
public function setComplement($complement) |
191
|
|
|
{ |
192
|
|
|
$this->complement = substr($complement, 0, 30); |
193
|
|
|
|
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* @return mixed |
199
|
|
|
*/ |
200
|
|
|
public function getDistrict() |
201
|
|
|
{ |
202
|
|
|
return $this->district; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* @param mixed $district |
207
|
|
|
* |
208
|
|
|
* @return Recipient |
209
|
|
|
*/ |
210
|
|
|
public function setDistrict($district) |
211
|
|
|
{ |
212
|
|
|
$this->district = substr($district, 0, 30); |
213
|
|
|
|
214
|
|
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @return mixed |
219
|
|
|
*/ |
220
|
|
|
public function getCity() |
221
|
|
|
{ |
222
|
|
|
return $this->city; |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* @param mixed $city |
227
|
|
|
* |
228
|
|
|
* @return Recipient |
229
|
|
|
*/ |
230
|
|
|
public function setCity($city) |
231
|
|
|
{ |
232
|
|
|
$this->city = substr($city, 0, 30); |
233
|
|
|
|
234
|
|
|
return $this; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @return mixed |
239
|
|
|
*/ |
240
|
|
|
public function getState() |
241
|
|
|
{ |
242
|
|
|
return $this->state; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @param mixed $state |
247
|
|
|
* |
248
|
|
|
* @return Recipient |
249
|
|
|
*/ |
250
|
|
|
public function setState($state) |
251
|
|
|
{ |
252
|
|
|
$this->state = substr($state, 0, 2); |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @return mixed |
259
|
|
|
*/ |
260
|
|
|
public function getCep() |
261
|
|
|
{ |
262
|
|
|
return $this->cep; |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @param mixed $cep |
267
|
|
|
* |
268
|
|
|
* @return Recipient |
269
|
|
|
*/ |
270
|
|
|
public function setCep($cep) |
271
|
|
|
{ |
272
|
|
|
$this->cep = $cep; |
273
|
|
|
|
274
|
|
|
return $this; |
275
|
|
|
} |
276
|
|
|
} |
277
|
|
|
|