C880   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

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