Completed
Pull Request — master (#464)
by
unknown
14:04
created

C870::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace NFePHP\EFD\Elements\ICMSIPI;
4
5
use NFePHP\EFD\Common\Element;
6
use NFePHP\EFD\Common\ElementInterface;
7
use \stdClass;
8
use function Safe\substr;
9
10
/**
11
 * REGISTRO C870: ITENS DO RESUMO DIÁRIO DOS DOCUMENTOS (CF-E-SAT) (CÓDIGO 59)
12
 * @package NFePHP\EFD\Elements\ICMSIPI
13
 */
14 View Code Duplication
class C870 extends Element implements ElementInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
    const REG = 'C870';
17
    const LEVEL = 3;
18
    const PARENT = 'C800';
19
20
    protected $parameters = [
21
        'COD_ITEM' => [
22
            'type'     => 'string',
23
            'regex'    => '^[0-9]{60}$',
24
            'required' => true,
25
            'info'     => 'Código do item (campo 02 do Registro 0200)',
26
            'format'   => ''
27
        ],
28
        'QTD' => [
29
            'type'     => 'numeric',
30
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
31
            'required' => true,
32
            'info'     => 'Quantidade do item',
33
            'format'   => '15v5'
34
        ],
35
        'UNID' => [
36
            'type'     => 'string',
37
            'regex'    => '^[0-9]{6}$',
38
            'required' => true,
39
            'info'     => 'Unidade do item (Campo 02 do registro 0190)',
40
            'format'   => ''
41
        ],
42
        'CST_ICMS' => [
43
            'type' => 'numeric',
44
            'regex' => '^(\d{1,3})$',
45
            'required' => true,
46
            'info' => 'Código da Situação Tributária, conforme a Tabela indicada no item 4.3.1',
47
            'format' => ''
48
        ],
49
        'CFOP' => [
50
            'type' => 'numeric',
51
            'regex' => '^(\d{1,4})$',
52
            'required' => true,
53
            'info' => 'Código Fiscal de Operação e Prestação do agrupamento de itens',
54
            'format' => ''
55
        ],
56
    ];
57
58
    /**
59
     * Constructor
60
     * @param \stdClass $std
61
     */
62
    public function __construct(\stdClass $std)
63
    {
64
        parent::__construct(self::REG);
65
        $this->std = $this->standarize($std);
66
    }
67
}
68