Passed
Push — master ( 8eaf12...701337 )
by Carlos C
01:07 queued 13s
created

CodigoPostal::hasEstimuloFrontera()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\SatCatalogos\CFDI;
6
7
use PhpCfdi\SatCatalogos\Common\AbstractEntryIdentifiable;
8
use PhpCfdi\SatCatalogos\Common\EntryIdentifiable;
9
use PhpCfdi\SatCatalogos\Exceptions\SatCatalogosLogicException;
10
11
class CodigoPostal extends AbstractEntryIdentifiable implements EntryIdentifiable
12
{
13
    /** @var string */
14
    private $estado;
15
16
    /** @var string */
17
    private $municipio;
18
19
    /** @var string */
20
    private $localidad;
21
22
    /** @var int */
23
    private $estimuloFrontera;
24
25
    /** @var HusoHorario */
26
    private $husoHorario;
27
28 7
    public function __construct(
29
        string $id,
30
        string $estado,
31
        string $municipio,
32
        string $localidad,
33
        int $estimuloFrontera,
34
        HusoHorario $husoHorario,
35
        int $vigenteDesde,
36
        int $vigenteHasta
37
    ) {
38 7
        parent::__construct($id, $id, $vigenteDesde, $vigenteHasta);
39 7
        if ('' === $estado) {
40 1
            throw new SatCatalogosLogicException('El campo estado no puede ser una cadena de caracteres vacía');
41
        }
42 6
        $this->estado = $estado;
43 6
        $this->municipio = $municipio;
44 6
        $this->localidad = $localidad;
45 6
        $this->estimuloFrontera = $estimuloFrontera;
46 6
        $this->husoHorario = $husoHorario;
47
    }
48
49 2
    public function estado(): string
50
    {
51 2
        return $this->estado;
52
    }
53
54 2
    public function municipio(): string
55
    {
56 2
        return $this->municipio;
57
    }
58
59 2
    public function localidad(): string
60
    {
61 2
        return $this->localidad;
62
    }
63
64 4
    public function estimuloFrontera(): int
65
    {
66 4
        return $this->estimuloFrontera;
67
    }
68
69 3
    public function hasEstimuloFrontera(): bool
70
    {
71 3
        return 0 !== $this->estimuloFrontera;
72
    }
73
74 1
    public function husoHorario(): HusoHorario
75
    {
76 1
        return $this->husoHorario;
77
    }
78
}
79