• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

chico-rei / correios-php / 27582377165

15 Jun 2026 11:08PM UTC coverage: 4.589% (-0.04%) from 4.627%
27582377165

push

github

mathmarques
set min version to php 8.2

57 of 1242 relevant lines covered (4.59%)

0.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Response/CepResponse.php
1
<?php
2

3
namespace ChicoRei\Packages\Correios\Response;
4

5
use ChicoRei\Packages\Correios\CorreiosObject;
6
use ChicoRei\Packages\Correios\Model\FaixaCaixaPostal;
7
use InvalidArgumentException;
8

9
class CepResponse extends CorreiosObject
10
{
11
    /**
12
     * CEP: Código de endereçamento postal
13
     */
14
    public ?string $cep = null;
15

16
    /**
17
     * Sigla da UF
18
     */
19
    public ?string $uf = null;
20

21
    /**
22
     * Número da localidade referente ao CEP
23
     */
24
    public ?int $numeroLocalidade = null;
25

26
    /**
27
     * Localidade
28
     */
29
    public ?string $localidade = null;
30

31
    /**
32
     * Logradouro
33
     */
34
    public ?string $logradouro = null;
35

36
    /**
37
     * Tipo de logradouro: avenida, rua, conjunto, fazenda
38
     */
39
    public ?string $tipoLogradouro = null;
40

41
    /**
42
     * Nome do logradouro
43
     */
44
    public ?string $nomeLogradouro = null;
45

46
    /**
47
     * Número do logradouro
48
     */
49
    public ?string $numeroLogradouro = null;
50

51
    /**
52
     * Complemento
53
     */
54
    public ?string $complemento = null;
55

56
    /**
57
     * Abreviatura
58
     */
59
    public ?string $abreviatura = null;
60

61
    /**
62
     * Bairro
63
     */
64
    public ?string $bairro = null;
65

66
    /**
67
     * Número da localidade superior
68
     */
69
    public ?int $numeroLocalidadeSuperior = null;
70

71
    /**
72
     * Nome da localidade superior
73
     */
74
    public ?string $localidadeSuperior = null;
75

76
    /**
77
     * Nome de grandes usuários
78
     */
79
    public ?string $nome = null;
80

81
    /**
82
     * Sigla da unidade
83
     */
84
    public ?string $siglaUnidade = null;
85

86
    /**
87
     * Tipo do CEP.
88
     * 1: Localidade;
89
     * 2: Logradouro;
90
     * 3: CEP Promocional;
91
     * 4: Caixa Postal Comunitária;
92
     * 5: Grande Usuário;
93
     * 6: Unidade Operacional
94
     */
95
    public ?int $tipoCEP = null;
96

97
    /**
98
     * Número do CEP anterior
99
     */
100
    public ?string $cepAnterior = null;
101

102
    /**
103
     * Distrito Postal
104
     */
105
    public ?string $distrito = null;
106

107
    /**
108
     * CEP da unidade operacional
109
     */
110
    public ?string $cepUnidadeOperacional = null;
111

112
    /**
113
     * Lado
114
     */
115
    public ?string $lado = null;
116

117
    /**
118
     * Número inicial
119
     */
120
    public ?int $numeroInicial = null;
121

122
    /**
123
     * Número final
124
     */
125
    public ?int $numeroFinal = null;
126

127
    /**
128
     * Indica que é uma unidade de Clique e Retire
129
     */
130
    public ?string $clique = null;
131

132
    /**
133
     * Faixas de Caixa Postal
134
     * @var FaixaCaixaPostal[]|null
135
     */
136
    public ?array $caixasPostais = null;
137

138
    /**
139
     * Indica que é uma unidade de locker
140
     */
141
    public ?string $locker = null;
142

143
    /**
144
     * Indica que é uma unidade de agência modular
145
     */
146
    public ?string $agenciaModular = null;
147

148
    /**
149
     * Descrição da mensagem
150
     */
151
    public ?string $txMsg = null;
152

153
    /**
154
     * Situação da localidade: 0 = Não codificada, 3 = Em fase de codificação
155
     */
156
    public ?string $inSituacaoLocalidade = null;
157

158
    /**
159
     * Data final de vigência
160
     */
161
    public ?string $dtFinalVigencia = null;
162

163
    public function getCep(): ?string
164
    {
165
        return $this->cep;
×
166
    }
167

168
    public function setCep(?string $cep): CepResponse
169
    {
170
        $this->cep = $cep;
×
171
        return $this;
×
172
    }
173

174
    public function getUf(): ?string
175
    {
176
        return $this->uf;
×
177
    }
178

179
    public function setUf(?string $uf): CepResponse
180
    {
181
        $this->uf = $uf;
×
182
        return $this;
×
183
    }
184

185
    public function getNumeroLocalidade(): ?int
186
    {
187
        return $this->numeroLocalidade;
×
188
    }
189

190
    public function setNumeroLocalidade(?int $numeroLocalidade): CepResponse
191
    {
192
        $this->numeroLocalidade = $numeroLocalidade;
×
193
        return $this;
×
194
    }
195

196
    public function getLocalidade(): ?string
197
    {
198
        return $this->localidade;
×
199
    }
200

201
    public function setLocalidade(?string $localidade): CepResponse
202
    {
203
        $this->localidade = $localidade;
×
204
        return $this;
×
205
    }
206

207
    public function getLogradouro(): ?string
208
    {
209
        return $this->logradouro;
×
210
    }
211

212
    public function setLogradouro(?string $logradouro): CepResponse
213
    {
214
        $this->logradouro = $logradouro;
×
215
        return $this;
×
216
    }
217

218
    public function getTipoLogradouro(): ?string
219
    {
220
        return $this->tipoLogradouro;
×
221
    }
222

223
    public function setTipoLogradouro(?string $tipoLogradouro): CepResponse
224
    {
225
        $this->tipoLogradouro = $tipoLogradouro;
×
226
        return $this;
×
227
    }
228

229
    public function getNomeLogradouro(): ?string
230
    {
231
        return $this->nomeLogradouro;
×
232
    }
233

234
    public function setNomeLogradouro(?string $nomeLogradouro): CepResponse
235
    {
236
        $this->nomeLogradouro = $nomeLogradouro;
×
237
        return $this;
×
238
    }
239

240
    public function getNumeroLogradouro(): ?string
241
    {
242
        return $this->numeroLogradouro;
×
243
    }
244

245
    public function setNumeroLogradouro(?string $numeroLogradouro): CepResponse
246
    {
247
        $this->numeroLogradouro = $numeroLogradouro;
×
248
        return $this;
×
249
    }
250

251
    public function getComplemento(): ?string
252
    {
253
        return $this->complemento;
×
254
    }
255

256
    public function setComplemento(?string $complemento): CepResponse
257
    {
258
        $this->complemento = $complemento;
×
259
        return $this;
×
260
    }
261

262
    public function getAbreviatura(): ?string
263
    {
264
        return $this->abreviatura;
×
265
    }
266

267
    public function setAbreviatura(?string $abreviatura): CepResponse
268
    {
269
        $this->abreviatura = $abreviatura;
×
270
        return $this;
×
271
    }
272

273
    public function getBairro(): ?string
274
    {
275
        return $this->bairro;
×
276
    }
277

278
    public function setBairro(?string $bairro): CepResponse
279
    {
280
        $this->bairro = $bairro;
×
281
        return $this;
×
282
    }
283

284
    public function getNumeroLocalidadeSuperior(): ?int
285
    {
286
        return $this->numeroLocalidadeSuperior;
×
287
    }
288

289
    public function setNumeroLocalidadeSuperior(?int $numeroLocalidadeSuperior): CepResponse
290
    {
291
        $this->numeroLocalidadeSuperior = $numeroLocalidadeSuperior;
×
292
        return $this;
×
293
    }
294

295
    public function getLocalidadeSuperior(): ?string
296
    {
297
        return $this->localidadeSuperior;
×
298
    }
299

300
    public function setLocalidadeSuperior(?string $localidadeSuperior): CepResponse
301
    {
302
        $this->localidadeSuperior = $localidadeSuperior;
×
303
        return $this;
×
304
    }
305

306
    public function getNome(): ?string
307
    {
308
        return $this->nome;
×
309
    }
310

311
    public function setNome(?string $nome): CepResponse
312
    {
313
        $this->nome = $nome;
×
314
        return $this;
×
315
    }
316

317
    public function getSiglaUnidade(): ?string
318
    {
319
        return $this->siglaUnidade;
×
320
    }
321

322
    public function setSiglaUnidade(?string $siglaUnidade): CepResponse
323
    {
324
        $this->siglaUnidade = $siglaUnidade;
×
325
        return $this;
×
326
    }
327

328
    public function getTipoCEP(): ?int
329
    {
330
        return $this->tipoCEP;
×
331
    }
332

333
    public function setTipoCEP(?int $tipoCEP): CepResponse
334
    {
335
        $this->tipoCEP = $tipoCEP;
×
336
        return $this;
×
337
    }
338

339
    public function getCepAnterior(): ?string
340
    {
341
        return $this->cepAnterior;
×
342
    }
343

344
    public function setCepAnterior(?string $cepAnterior): CepResponse
345
    {
346
        $this->cepAnterior = $cepAnterior;
×
347
        return $this;
×
348
    }
349

350
    public function getDistrito(): ?string
351
    {
352
        return $this->distrito;
×
353
    }
354

355
    public function setDistrito(?string $distrito): CepResponse
356
    {
357
        $this->distrito = $distrito;
×
358
        return $this;
×
359
    }
360

361
    public function getCepUnidadeOperacional(): ?string
362
    {
363
        return $this->cepUnidadeOperacional;
×
364
    }
365

366
    public function setCepUnidadeOperacional(?string $cepUnidadeOperacional): CepResponse
367
    {
368
        $this->cepUnidadeOperacional = $cepUnidadeOperacional;
×
369
        return $this;
×
370
    }
371

372
    public function getLado(): ?string
373
    {
374
        return $this->lado;
×
375
    }
376

377
    public function setLado(?string $lado): CepResponse
378
    {
379
        $this->lado = $lado;
×
380
        return $this;
×
381
    }
382

383
    public function getNumeroInicial(): ?int
384
    {
385
        return $this->numeroInicial;
×
386
    }
387

388
    public function setNumeroInicial(?int $numeroInicial): CepResponse
389
    {
390
        $this->numeroInicial = $numeroInicial;
×
391
        return $this;
×
392
    }
393

394
    public function getNumeroFinal(): ?int
395
    {
396
        return $this->numeroFinal;
×
397
    }
398

399
    public function setNumeroFinal(?int $numeroFinal): CepResponse
400
    {
401
        $this->numeroFinal = $numeroFinal;
×
402
        return $this;
×
403
    }
404

405
    public function getClique(): ?string
406
    {
407
        return $this->clique;
×
408
    }
409

410
    public function setClique(?string $clique): CepResponse
411
    {
412
        $this->clique = $clique;
×
413
        return $this;
×
414
    }
415

416
    /**
417
     * @return FaixaCaixaPostal[]|null
418
     */
419
    public function getCaixasPostais(): ?array
420
    {
421
        return $this->caixasPostais;
×
422
    }
423

424
    /**
425
     * @param FaixaCaixaPostal[]|null $caixasPostais
426
     * @return CepResponse
427
     */
428
    public function setCaixasPostais(?array $caixasPostais): CepResponse
429
    {
430
        if (is_array($caixasPostais)) {
×
431
            $this->caixasPostais = [];
×
432

433
            foreach ($caixasPostais as $faixaCaixaPostal) {
×
434
                $this->addCaixaPostal($faixaCaixaPostal);
×
435
            }
436
        } else {
437
            $this->caixasPostais = null;
×
438
        }
439

440
        return $this;
×
441
    }
442

443
    /**
444
     * @param FaixaCaixaPostal|array $faixaCaixaPostal
445
     * @return CepResponse
446
     */
447
    public function addCaixaPostal($faixaCaixaPostal): CepResponse
448
    {
449
        if (! is_array($faixaCaixaPostal) && ! $faixaCaixaPostal instanceof FaixaCaixaPostal) {
×
450
            throw new InvalidArgumentException('The argument must be an instance of FaixaCaixaPostal or an array');
×
451
        }
452

453
        if (!isset($this->caixasPostais)) {
×
454
            $this->caixasPostais = [];
×
455
        }
456

457
        $this->caixasPostais[] = FaixaCaixaPostal::create($faixaCaixaPostal);
×
458

459
        return $this;
×
460
    }
461

462
    public function getLocker(): ?string
463
    {
464
        return $this->locker;
×
465
    }
466

467
    public function setLocker(?string $locker): CepResponse
468
    {
469
        $this->locker = $locker;
×
470
        return $this;
×
471
    }
472

473
    public function getAgenciaModular(): ?string
474
    {
475
        return $this->agenciaModular;
×
476
    }
477

478
    public function setAgenciaModular(?string $agenciaModular): CepResponse
479
    {
480
        $this->agenciaModular = $agenciaModular;
×
481
        return $this;
×
482
    }
483

484
    public function getTxMsg(): ?string
485
    {
486
        return $this->txMsg;
×
487
    }
488

489
    public function setTxMsg(?string $txMsg): CepResponse
490
    {
491
        $this->txMsg = $txMsg;
×
492
        return $this;
×
493
    }
494

495
    public function getInSituacaoLocalidade(): ?string
496
    {
497
        return $this->inSituacaoLocalidade;
×
498
    }
499

500
    public function setInSituacaoLocalidade(?string $inSituacaoLocalidade): CepResponse
501
    {
502
        $this->inSituacaoLocalidade = $inSituacaoLocalidade;
×
503
        return $this;
×
504
    }
505

506
    public function getDtFinalVigencia(): ?string
507
    {
508
        return $this->dtFinalVigencia;
×
509
    }
510

511
    public function setDtFinalVigencia(?string $dtFinalVigencia): CepResponse
512
    {
513
        $this->dtFinalVigencia = $dtFinalVigencia;
×
514
        return $this;
×
515
    }
516

517
    /**
518
     * @inheritdoc
519
     */
520
    public function toArray(): array
521
    {
522
        return [
×
523
            'cep' => $this->getCep(),
×
524
            'uf' => $this->getUf(),
×
525
            'numeroLocalidade' => $this->getNumeroLocalidade(),
×
526
            'localidade' => $this->getLocalidade(),
×
527
            'logradouro' => $this->getLogradouro(),
×
528
            'tipoLogradouro' => $this->getTipoLogradouro(),
×
529
            'nomeLogradouro' => $this->getNomeLogradouro(),
×
530
            'numeroLogradouro' => $this->getNumeroLogradouro(),
×
531
            'complemento' => $this->getComplemento(),
×
532
            'abreviatura' => $this->getAbreviatura(),
×
533
            'bairro' => $this->getBairro(),
×
534
            'numeroLocalidadeSuperior' => $this->getNumeroLocalidadeSuperior(),
×
535
            'localidadeSuperior' => $this->getLocalidadeSuperior(),
×
536
            'nome' => $this->getNome(),
×
537
            'siglaUnidade' => $this->getSiglaUnidade(),
×
538
            'tipoCEP' => $this->getTipoCEP(),
×
539
            'cepAnterior' => $this->getCepAnterior(),
×
540
            'distrito' => $this->getDistrito(),
×
541
            'cepUnidadeOperacional' => $this->getCepUnidadeOperacional(),
×
542
            'lado' => $this->getLado(),
×
543
            'numeroInicial' => $this->getNumeroInicial(),
×
544
            'numeroFinal' => $this->getNumeroFinal(),
×
545
            'clique' => $this->getClique(),
×
546
            'caixasPostais' => $this->getCaixasPostais()
×
547
                ? array_map(function (FaixaCaixaPostal $faixaCaixaPostal) {
×
548
                    return $faixaCaixaPostal->toArray();
×
549
                }, $this->getCaixasPostais())
×
550
                : null,
×
551
            'locker' => $this->getLocker(),
×
552
            'agenciaModular' => $this->getAgenciaModular(),
×
553
            'txMsg' => $this->getTxMsg(),
×
554
            'inSituacaoLocalidade' => $this->getInSituacaoLocalidade(),
×
555
            'dtFinalVigencia' => $this->getDtFinalVigencia(),
×
556
        ];
×
557
    }
558
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc