Passed
Push — master ( 75ecec...113700 )
by Carlos C
01:14 queued 12s
created

NumerosPedimentoAduana   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 28
ccs 12
cts 12
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 1
A obtain() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpCfdi\SatCatalogos\CFDI40;
6
7
use PhpCfdi\SatCatalogos\Common\BaseCatalog;
8
use PhpCfdi\SatCatalogos\Common\BaseCatalogTrait;
9
use PhpCfdi\SatCatalogos\Helpers\ScalarValues;
10
use PhpCfdi\SatCatalogos\Repository;
11
12
class NumerosPedimentoAduana implements BaseCatalog
13
{
14
    use BaseCatalogTrait;
15
16 2
    public function obtain(string $aduana, string $patente, int $ejercicio): NumeroPedimentoAduana
17
    {
18 2
        $data = $this->repository()->queryRowByFields(Repository::CFDI_40_NUMEROS_PEDIMENTO_ADUANA, [
19
            'aduana' => $aduana,
20
            'patente' => $patente,
21
            'ejercicio' => $ejercicio,
22
        ]);
23 2
        return $this->create($data);
24
    }
25
26
    /**
27
     * @param array<string, scalar> $data
28
     * @return NumeroPedimentoAduana
29
     */
30 3
    public function create(array $data): NumeroPedimentoAduana
31
    {
32 3
        $values = new ScalarValues($data);
33 3
        return new NumeroPedimentoAduana(
34 3
            $values->string('aduana'),
35 3
            $values->string('patente'),
36 3
            $values->int('ejercicio'),
37 3
            $values->int('cantidad'),
38 3
            $values->timestamp('vigencia_desde'),
39 3
            $values->timestamp('vigencia_hasta'),
40
        );
41
    }
42
}
43