C390   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 78
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 78
loc 78
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
/**
10
 * REGISTRO C390: REGISTRO ANALÍTICO DAS NOTAS FISCAIS DE VENDA A
11
 * CONSUMIDOR (CÓDIGO 02)
12
 * Este registro tem por objetivo informar as notas fiscais de venda ao consumidor, não emitidas por ECF, e deve ser
13
 * apresentado de forma agrupada na combinação CST_ICMS, CFOP e Alíquota de ICMS.
14
 * @package NFePHP\EFD\Elements\ICMSIPI
15
 */
16 View Code Duplication
class C390 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...
17
{
18
    const REG = 'C390';
19
    const LEVEL = 3;
20
    const PARENT = '';
21
22
    protected $parameters = [
23
        'CST_ICMS' => [
24
            'type' => 'numeric',
25
            'regex' => '^(\d{3})$',
26
            'required' => false,
27
            'info' => 'Código da Situação Tributária, conforme a Tabela indicada no item 4.3.1',
28
            'format' => ''
29
        ],
30
        'CFOP' => [
31
            'type' => 'numeric',
32
            'regex' => '^(5)(\d{3})$',
33
            'required' => false,
34
            'info' => 'Código Fiscal de Operação e Prestação',
35
            'format' => ''
36
        ],
37
        'ALIQ_ICMS' => [
38
            'type' => 'numeric',
39
            'regex' => '^\d+(\.\d*)?|\.\d+$',
40
            'required' => false,
41
            'info' => 'Alíquota do ICMS',
42
            'format' => '6v2'
43
        ],
44
        'VL_OPR' => [
45
            'type' => 'numeric',
46
            'regex' => '^\d+(\.\d*)?|\.\d+$',
47
            'required' => false,
48
            'info' => 'Valor total acumulado das operações correspondentes à combinação de CST_ICMS, 
49
            CFOP e alíquota do ICMS, incluídas as despesas acessórias e acréscimos.',
50
            'format' => '15v2'
51
        ],
52
        'VL_BC_ICMS' => [
53
            'type' => 'numeric',
54
            'regex' => '^\d+(\.\d*)?|\.\d+$',
55
            'required' => false,
56
            'info' => 'Valor acumulado da base de cálculo do ICMS, referente à combinação de CST_ICMS, 
57
            CFOP, e alíquota do ICMS.',
58
            'format' => '15v2'
59
        ],
60
        'VL_ICMS' => [
61
            'type' => 'numeric',
62
            'regex' => '^\d+(\.\d*)?|\.\d+$',
63
            'required' => false,
64
            'info' => 'Valor acumulado do ICMS, referente à combinação de CST_ICMS, CFOP e alíquota do ICMS.',
65
            'format' => '15v2'
66
        ],
67
        'VL_RED_BC' => [
68
            'type' => 'numeric',
69
            'regex' => '^\d+(\.\d*)?|\.\d+$',
70
            'required' => false,
71
            'info' => 'Valor não tributado em função da redução da base de cálculo do ICMS, referente à 
72
            combinação de CST_ICMS, CFOP, e alíquota do ICMS.',
73
            'format' => '15v2'
74
        ],
75
        'COD_OBS' => [
76
            'type' => 'string',
77
            'regex' => '^.{0,6}$',
78
            'required' => false,
79
            'info' => 'Código da observação do lançamento fiscal (campo 02 do Registro 0460)',
80
            'format' => ''
81
        ],
82
    ];
83
84
    /**
85
     * Constructor
86
     * @param \stdClass $std
87
     */
88
    public function __construct(\stdClass $std)
89
    {
90
        parent::__construct(self::REG);
91
        $this->std = $this->standarize($std);
92
    }
93
}
94