C597::__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
/**
10
 * REGISTRO C597:OUTRAS   OBRIGAÇÕES   TRIBUTÁRIAS,   AJUSTES   E   INFORMAÇÕES   DE   VALORES PROVENIENTES DE
11
 * DOCUMENTO FISCAL
12
 * @package NFePHP\EFD\Elements\ICMSIPI
13
 */
14 View Code Duplication
class C597 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 = 'C597';
17
    const LEVEL = 4;
18
    const PARENT = 'C595';
19
    
20
    protected $parameters = [
21
        'COD_AJ' => [
22
            'type'     => 'string',
23
            'regex'    => '^[0-9]{10}$',
24
            'required' => true,
25
            'info'     => 'Código do ajustes/benefício/incentivo, conforme tabela indicada no item 5.3.',
26
            'format'   => ''
27
        ],
28
        'DESCR_COMPL_AJ' => [
29
            'type'     => 'string',
30
            'regex'    => '^[0-9]{0}$',
31
            'required' => true,
32
            'info'     => 'Descrição complementar do ajuste do documento fiscal',
33
            'format'   => ''
34
        ],
35
        'COD_ITEM' => [
36
            'type'     => 'string',
37
            'regex'    => '^[0-9]{60}$',
38
            'required' => true,
39
            'info'     => 'Código do item (campo 02 do Registro 0200)',
40
            'format'   => ''
41
        ],
42
        'VL_BC_ICMS' => [
43
            'type'     => 'numeric',
44
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
45
            'required' => true,
46
            'info'     => 'Base de cálculo do ICMS ou do ICMS ST',
47
            'format'   => '15v2'
48
        ],
49
        'ALIQ_ICMS' => [
50
            'type'     => 'numeric',
51
            'regex'    => '^[0-9]{6}$',
52
            'required' => true,
53
            'info'     => 'Alíquota do ICMS',
54
            'format'   => ''
55
        ],
56
        'VL_ICMS' => [
57
            'type'     => 'numeric',
58
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
59
            'required' => true,
60
            'info'     => 'Valor do ICMS ou do ICMS ST',
61
            'format'   => '15v2'
62
        ],
63
        'VL_OUTROS' => [
64
            'type'     => 'numeric',
65
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
66
            'required' => true,
67
            'info'     => 'Outros valores',
68
            'format'   => '15v2'
69
        ]
70
    ];
71
    
72
    /**
73
     * Constructor
74
     * @param \stdClass $std
75
     */
76
    public function __construct(\stdClass $std)
77
    {
78
        parent::__construct(self::REG);
79
        $this->std = $this->standarize($std);
80
    }
81
}
82