Completed
Push — master ( fa86a4...7e37c8 )
by Roberto
14s queued 14s
created

C815   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 103
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 103
loc 103
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\Common\Keys;
6
use NFePHP\EFD\Common\Element;
7
use NFePHP\EFD\Common\ElementInterface;
8
use \stdClass;
9
10
/**
11
 * REGISTRO C815: INFORMAÇÕES  COMPLEMENTARES  DAS  OPERAÇÕES  DE  SAÍDA  DE  MERCADORIAS SUJEITAS À SUBSTITUIÇÃO TRIBUTÁRIA (CF-E-SAT) (CÓDIGO 59)
12
 * @package NFePHP\EFD\Elements\ICMSIPI
13
 */
14 View Code Duplication
class C815 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 = 'C815';
17
    const LEVEL = 3;
18
    const PARENT = 'C800';
19
    
20
    protected $parameters = [
21
        'COD_MOT_REST_COMPL' => [
22
            'type'     => 'string',
23
            'regex'    => '^[0-9]{0}$',
24
            'required' => true,
25
            'info'     => '',
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 utilizada para informar o campo QUANT_CONV, aplicando-se a mesma redução da base de cálculo do ICMS ST na tributação, se houver.',
47
            'format'   => '15v6'
48
        ],
49
        'VL_UNIT_ICMS_OP_CONV' => [
50
            'type'     => 'numeric',
51
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
52
            'required' => true,
53
            'info'     => 'Valor unitário correspondente ao ICMS OP utilizado no cálculo do ressarcimento / restituição, no desfazimento da substituição tributária,'            . 'calculado conforme a legislação de cada UF, considerando a unidade utilizada para informar o campo QUANT_CONV.',
54
            'format'   => '15v6'
55
        ],
56
        'VL_UNIT_ICMS_OP_ESTOQUE_CONV' => [
57
            'type'     => 'numeric',
58
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
59
            'required' => true,
60
            'info'     => 'Valor médio unitário do ICMS que o contribuinte teria se creditado referente à operação de entrada das mercadorias em estoque caso estivesse submetida ao regime comum de tributação, calculado conforme a legislação de cada UF, considerando a unidade utilizada para informar o campo QUANT_CONV',
61
            'format'   => '15v6'
62
        ],
63
        'VL_UNIT_ICMS_ST_ESTOQUE_CONV' => [
64
            'type'     => 'numeric',
65
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
66
            'required' => true,
67
            'info'     => 'Valor médio unitário do ICMS/ST, incluindo FCP ST, das mercadorias em estoque, considerando unidade utilizada para informar o campo QUANT_CONV.',
68
            'format'   => '15v6'
69
        ],
70
        'VL_UNIT_FCP_ICMS_ST_ESTOQUE_CONV' => [
71
            'type'     => 'string',
72
            'regex'    => '^[0-9]{0}$',
73
            'required' => true,
74
            'info'     => '',
75
            'format'   => ''
76
        ],
77
        'VL_UNIT_ICMS_ST_CONV_REST' => [
78
            'type'     => 'numeric',
79
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
80
            'required' => true,
81
            'info'     => 'Valor unitário do total do ICMS/ST, incluindo FCP ST, a ser restituído/ressarcido, calculado conforme a legislação de cada UF, considerando a unidade utilizada para informar o campo QUANT_CONV.',
82
            'format'   => '15v6'
83
        ],
84
        'VL_UNIT_FCP_ST_CONV_REST' => [
85
            'type'     => 'numeric',
86
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
87
            'required' => true,
88
            'info'     => 'Valor unitário correspondente à parcela de ICMS FCP ST que compõe o campo VL_UNIT_ICMS_ST_CONV_REST, considerando a unidade utilizada para informar o campo QUANT_CONV.',
89
            'format'   => '15v6'
90
        ],
91
        'VL_UNIT_ICMS_ST_CONV_COMPL' => [
92
            'type'     => 'numeric',
93
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
94
            'required' => true,
95
            'info'     => 'Valor unitário do complemento do ICMS, incluindo FCP ST, considerando a unidade utilizada para informar o campo QUANT_CONV.',
96
            'format'   => '15v6'
97
        ],
98
        'VL_UNIT_FCP_ST_CONV_COMPL' => [
99
            'type'     => 'numeric',
100
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
101
            'required' => true,
102
            'info'     => 'Valor unitário correspondente à parcela de ICMS FCP ST que compõe o campo VL_UNIT_ICMS_ST_CONV_COMPL, considerando unidade utilizada para informar o campo QUANT_CONV.',
103
            'format'   => '15v6'
104
        ]
105
    ];
106
107
    /**
108
     * Constructor
109
     * @param \stdClass $std
110
     */
111
    public function __construct(\stdClass $std)
112
    {
113
        parent::__construct(self::REG);
114
        $this->std = $this->standarize($std);
115
    }
116
}
117