Completed
Push — master ( 761feb...2c5bc6 )
by
unknown
10:30
created

C430   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 131
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 131
loc 131
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 C430: INFORMAÇÕES  COMPLEMENTARES  DAS  OPERAÇÕES  DE  SAÍDA  DE  MERCADORIAS SUJEITAS À SUBSTITUIÇÃO
11
 * TRIBUTÁRIA (CÓDIGO 02, 2D e 60)
12
 * @package NFePHP\EFD\Elements\ICMSIPI
13
 */
14 View Code Duplication
class C430 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 = 'C430';
17
    const LEVEL = 4;
18
    const PARENT = 'C370';
19
20
     protected $parameters = [
21
        'COD_MOT_REST_COMPL' => [
22
            'type'     => 'string',
23
            'regex'    => '^[0-9]{5}$',
24
            'required' => true,
25
            'info'     => 'Código do motivo da restituição ou complementação conforme Tabela 5.7',
26
            'format'   => ''
27
        ],
28
        'QUANT_CONV' => [
29
            'type'     => 'numeric',
30
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
31
            'required' => true,
32
            'info'     => 'Quantidade do item',
33
            'format'   => '15v6'
34
        ],
35
        'UNID' => [
36
            'type'     => 'string',
37
            'regex'    => '^[0-9]{0}$',
38
            'required' => true,
39
            'info'     => 'Unidade adotada para informar o campo QUANT_CONV.',
40
            'format'   => ''
41
        ],
42
        'VL_UNIT_ICMS_NA_OPERACAO_CONV' => [
43
            'type'     => 'numeric',
44
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
45
            'required' => true,
46
            'info'     => 'Valor unitário para o ICMS na operação, caso não houvesse a ST, considerando unidade '
47
            .'utilizada para informar o campo QUANT_CONV, aplicando-se a mesma redução da base de cálculo do '
48
            .'ICMS ST na tributação, se houver',
49
            'format'   => '15v6'
50
        ],
51
        'VL_UNIT_ICMS_OP_CONV' => [
52
            'type'     => 'numeric',
53
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
54
            'required' => true,
55
            'info'     => 'Valor unitário correspondente ao ICMS OP utilizado no cálculo do ressarcimento / '
56
            .'restituição, no desfazimento da substituição tributária, calculado conforme a legislação de cada UF, '
57
            .'considerando a unidade utilizada para informar o campo QUANT_CONV.',
58
            'format'   => '15v6'
59
        ],
60
        'VL_UNIT_ICMS_OP_ESTOQUE_CONV' => [
61
            'type'     => 'numeric',
62
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
63
            'required' => true,
64
            'info'     => 'Valor médio unitário do ICMS que o contribuinte teria se creditado referente à operação de '
65
            .'entrada das mercadorias em estoque caso estivesse submetida ao regime comum de tributação, calculado '
66
            .'conforme a legislação de cada UF, considerando a unidade utilizada para informar o campo QUANT_CONV',
67
            'format'   => '15v6'
68
        ],
69
        'VL_UNIT_ICMS_ST_ESTOQUE_CONV' => [
70
            'type'     => 'numeric',
71
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
72
            'required' => true,
73
            'info'     => 'Valor médio unitário do ICMS/ST, incluindo FCP ST, das mercadorias em estoque, '
74
            .'considerando unidade utilizada para informar o campo QUANT_CONV.',
75
            'format'   => '15v6'
76
        ],
77
        'VL_UNIT_FCP_ICMS_ST_ESTOQUE_CONV' => [
78
            'type'     => 'numeric',
79
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
80
            'required' => true,
81
            'info'     => 'Valor médio unitário do FCP ST agregado ao ICMS das mercadorias em estoque, '
82
            .'considerando unidade utilizada para informar o campo QUANT_CONV.',
83
            'format'   => '15v6'
84
        ],
85
        'VL_UNIT_ICMS_ST_CONV_REST' => [
86
            'type'     => 'numeric',
87
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
88
            'required' => true,
89
            'info'     => 'Valor unitário do total do ICMS/ST, incluindo FCP ST, a ser restituído/ressarcido, '
90
            .'calculado conforme a legislação de cada UF, considerando a unidade utilizada para informar o '
91
            .'campo QUANT_CONV.',
92
            'format'   => '15v6'
93
        ],
94
        'VL_UNIT_FCP_ST_CONV_REST' => [
95
            'type'     => 'numeric',
96
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
97
            'required' => true,
98
            'info'     => 'Valor unitário correspondente à parcela de ICMS FCP ST que compõe o campo '
99
            .'VL_UNIT_ICMS_ST_CONV_REST, considerando a unidade utilizada para informar o campo QUANT_CONV.',
100
            'format'   => '15v6'
101
        ],
102
        'VL_UNIT_ICMS_ST_CONV_COMPL' => [
103
            'type'     => 'numeric',
104
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
105
            'required' => true,
106
            'info'     => 'Valor unitário do complemento do ICMS, incluindo FCP ST, considerando a '
107
            .'unidade utilizada para informar o campo QUANT_CONV.',
108
            'format'   => '15v6'
109
        ],
110
        'VL_UNIT_FCP_ST_CONV_COMPL' => [
111
            'type'     => 'numeric',
112
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
113
            'required' => true,
114
            'info'     => 'Valor unitário correspondente à parcela de ICMS FCP ST que compõe o campo '
115
            .'VL_UNIT_ICMS_ST_CONV_COMPL, considerando unidade utilizada para informar o '
116
            .'campo QUANT_CONV.',
117
            'format'   => '15v6'
118
        ],
119
        'CST_ICMS' => [
120
            'type' => 'numeric',
121
            'regex' => '^(\d{3})$',
122
            'required' => true,
123
            'info' => 'Código da Situação Tributária referente ao ICMS',
124
            'format' => ''
125
        ],
126
        'CFOP' => [
127
            'type' => 'numeric',
128
            'regex' => '^(\d{4})$',
129
            'required' => true,
130
            'info' => 'Código Fiscal de Operação e Prestação',
131
            'format' => ''
132
        ],
133
     ];
134
135
    /**
136
     * Constructor
137
     * @param \stdClass $std
138
     */
139
     public function __construct(\stdClass $std)
140
     {
141
         parent::__construct(self::REG);
142
         $this->std = $this->standarize($std);
143
     }
144
}
145