D162::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
9 View Code Duplication
class D162 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...
10
{
11
    const REG = 'D162';
12
    const LEVEL = 4;
13
    const PARENT = '';
14
15
    protected $parameters = [
16
        'COD_MOD' => [
17
            'type'     => 'string',
18
            'regex'    => '^[0-9]{2}$',
19
            'required' => true,
20
            'info'     => 'Código do modelo do documento fiscal, conforme a tabela 4.1.1',
21
            'format'   => ''
22
        ],
23
        'SER' => [
24
            'type'     => 'string',
25
            'regex'    => '^[0-9]{4}$',
26
            'required' => true,
27
            'info'     => 'Série do documento fiscal',
28
            'format'   => ''
29
        ],
30
        'NUM_DOC' => [
31
            'type'     => 'numeric',
32
            'regex'    => '^[0-9]{9}$',
33
            'required' => true,
34
            'info'     => 'Número do documento fiscal',
35
            'format'   => ''
36
        ],
37
        'DT_DOC' => [
38
            'type'     => 'numeric',
39
            'regex'    => '',
40
            'required' => true,
41
            'info'     => 'Data da emissão do documento fiscal',
42
            'format'   => ''
43
        ],
44
        'VL_DOC' => [
45
            'type'     => 'numeric',
46
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
47
            'required' => true,
48
            'info'     => 'Valor total do documento fiscal',
49
            'format'   => '15v2'
50
        ],
51
        'VL_MERC' => [
52
            'type'     => 'numeric',
53
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
54
            'required' => true,
55
            'info'     => 'Valor das mercadorias constantes no documento fiscal',
56
            'format'   => '15v2'
57
        ],
58
        'QTD_VOL' => [
59
            'type'     => 'numeric',
60
            'regex'    => '',
61
            'required' => true,
62
            'info'     => 'Quantidade de volumes transportados',
63
            'format'   => ''
64
        ],
65
        'PESO_BRT' => [
66
            'type'     => 'numeric',
67
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
68
            'required' => true,
69
            'info'     => 'Peso bruto dos volumes transportados (em kg)',
70
            'format'   => '15v2'
71
        ],
72
        'PESO_LIQ' => [
73
            'type'     => 'numeric',
74
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
75
            'required' => true,
76
            'info'     => 'Peso líquido dos volumes transportados (em kg)',
77
            'format'   => '15v2'
78
        ]
79
    ];
80
    
81
    /**
82
     * Constructor
83
     * @param \stdClass $std
84
     */
85
    public function __construct(\stdClass $std)
86
    {
87
        parent::__construct(self::REG);
88
        $this->std = $this->standarize($std);
89
    }
90
}
91