D390   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 90
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 90
loc 90
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 D390 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 = 'D390';
12
    const LEVEL = 4;
13
    const PARENT = '';
14
15
    protected $parameters = [
16
        'CST_ICMS' => [
17
            'type'     => 'numeric',
18
            'regex' => '^(\d{3})$',
19
            'required' => true,
20
            'info'     => 'Código da Situação Tributária, conforme a tabela indicada no item 4.3.1',
21
            'format'   => ''
22
        ],
23
        'CFOP' => [
24
            'type'     => 'numeric',
25
            'regex' => '^(\d{4})$',
26
            'required' => true,
27
            'info'     => 'Código Fiscal de Operação e Prestação',
28
            'format'   => ''
29
        ],
30
        'ALIQ_ICMS' => [
31
            'type'     => 'numeric',
32
            'regex'    => '^[0-9]{6}$',
33
            'required' => true,
34
            'info'     => 'Alíquota do ICMS',
35
            'format'   => ''
36
        ],
37
        'VL_OPR' => [
38
            'type'     => 'numeric',
39
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
40
            'required' => true,
41
            'info'     => 'Valor da operação correspondente à combinação de CST_ICMS, CFOP e alíquota do ICMS,'
42
            .' incluídas as despesas acessórias e acréscimos',
43
            'format'   => '15v2'
44
        ],
45
        'VL_BC_ISSQN' => [
46
            'type'     => 'numeric',
47
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
48
            'required' => true,
49
            'info'     => 'Valor da base de cálculo do ISSQN',
50
            'format'   => '15v2'
51
        ],
52
        'ALIQ_ISSQN' => [
53
            'type'     => 'numeric',
54
            'regex'    => '^[0-9]{6}$',
55
            'required' => true,
56
            'info'     => 'Alíquota do ISSQN',
57
            'format'   => ''
58
        ],
59
        'VL_ISSQN' => [
60
            'type'     => 'numeric',
61
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
62
            'required' => true,
63
            'info'     => 'Valor do ISSQN',
64
            'format'   => '15v2'
65
        ],
66
        'VL_BC_ICMS' => [
67
            'type'     => 'numeric',
68
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
69
            'required' => true,
70
            'info'     => 'Base de cálculo do ICMS acumulada relativa à alíquota informada',
71
            'format'   => '15v2'
72
        ],
73
        'VL_ICMS' => [
74
            'type'     => 'numeric',
75
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
76
            'required' => true,
77
            'info'     => 'Valor do ICMS acumulado relativo à alíquota informada',
78
            'format'   => '15v2'
79
        ],
80
        'COD_OBS' => [
81
            'type'     => 'string',
82
            'regex'    => '^[0-9]{6}$',
83
            'required' => true,
84
            'info'     => 'Código da observação do lançamento fiscal (campo 02 do Registro 0460)',
85
            'format'   => ''
86
        ]
87
    ];
88
89
    /**
90
     * Constructor
91
     * @param \stdClass $std
92
     */
93
    public function __construct(\stdClass $std)
94
    {
95
        parent::__construct(self::REG);
96
        $this->std = $this->standarize($std);
97
    }
98
}
99