Total Complexity | 9 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class NumeroPedimentoAduana implements EntryWithVigencias |
||
12 | { |
||
13 | use EntryWithVigenciasTrait; |
||
14 | |||
15 | /** @var string */ |
||
16 | private $aduana; |
||
17 | |||
18 | /** @var string */ |
||
19 | private $patente; |
||
20 | |||
21 | /** @var int */ |
||
22 | private $ejercicio; |
||
23 | |||
24 | /** @var int */ |
||
25 | private $cantidad; |
||
26 | |||
27 | 8 | public function __construct( |
|
28 | string $aduana, |
||
29 | string $patente, |
||
30 | int $ejercicio, |
||
31 | int $cantidad, |
||
32 | int $vigenteDesde, |
||
33 | int $vigenteHasta |
||
34 | ) { |
||
35 | 8 | if ('' === $aduana) { |
|
36 | 1 | throw new SatCatalogosLogicException('El campo aduana no puede ser una cadena de caracteres vacía'); |
|
37 | } |
||
38 | 7 | if ('' === $patente) { |
|
39 | 1 | throw new SatCatalogosLogicException('El campo patente no puede ser una cadena de caracteres vacía'); |
|
40 | } |
||
41 | 6 | if ($ejercicio < 0) { |
|
42 | 1 | throw new SatCatalogosLogicException('El campo ejercicio no puede ser menor a cero'); |
|
43 | } |
||
44 | 5 | if ($cantidad < 0) { |
|
45 | 1 | throw new SatCatalogosLogicException('El campo cantidad no puede ser menor a cero'); |
|
46 | } |
||
47 | 4 | $this->aduana = $aduana; |
|
48 | 4 | $this->patente = $patente; |
|
49 | 4 | $this->ejercicio = $ejercicio; |
|
50 | 4 | $this->cantidad = $cantidad; |
|
51 | 4 | $this->setUpVigencias($vigenteDesde, $vigenteHasta); |
|
52 | } |
||
53 | |||
54 | 3 | public function aduana(): string |
|
55 | { |
||
56 | 3 | return $this->aduana; |
|
57 | } |
||
58 | |||
59 | 3 | public function patente(): string |
|
60 | { |
||
61 | 3 | return $this->patente; |
|
62 | } |
||
63 | |||
64 | 3 | public function ejercicio(): int |
|
65 | { |
||
66 | 3 | return $this->ejercicio; |
|
67 | } |
||
68 | |||
69 | 4 | public function cantidad(): int |
|
72 | } |
||
73 | } |
||
74 |