D130   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 114
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 114
loc 114
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 D130 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 = 'D130';
12
    const LEVEL = 3;
13
    const PARENT = '';
14
15
    protected $parameters = [
16
        'COD_PART_CONSG' => [
17
            'type'     => 'string',
18
            'regex'    => '^[0-9]{60}$',
19
            'required' => true,
20
            'info'     => 'Código do participante (campo 02 do Registro 0150):'
21
            . '- consignatário, se houver',
22
            'format'   => ''
23
        ],
24
        'COD_PART_RED' => [
25
            'type'     => 'string',
26
            'regex'    => '^[0-9]{60}$',
27
            'required' => true,
28
            'info'     => 'Código do participante (campo 02 do Registro 0150):'
29
            . '- redespachado, se houver',
30
            'format'   => ''
31
        ],
32
        'IND_FRT_RED' => [
33
            'type'     => 'string',
34
            'regex'    => '^[0-9]{1}$',
35
            'required' => true,
36
            'info'     => 'Indicador do tipo do frete da operação de redespacho: 0 - Sem redespacho;'
37
            . '1 - Por conta do emitente'
38
            . '2 - Por conta do destinatário 9 - Outros.',
39
            'format'   => ''
40
        ],
41
        'COD_MUN_ORIG' => [
42
            'type'     => 'numeric',
43
            'regex'    => '',
44
            'required' => true,
45
            'info'     => 'Código do município de origem do serviço, conforme a tabela IBGE',
46
            'format'   => ''
47
        ],
48
        'COD_MUN_DEST' => [
49
            'type'     => 'numeric',
50
            'regex'    => '',
51
            'required' => true,
52
            'info'     => 'Código do município de destino, conforme a tabela IBGE',
53
            'format'   => ''
54
        ],
55
        'VEIC_ID' => [
56
            'type'     => 'string',
57
            'regex'    => '^[0-9]{7}$',
58
            'required' => true,
59
            'info'     => 'Placa de identificação do veículo',
60
            'format'   => ''
61
        ],
62
        'VL_LIQ_FRT' => [
63
            'type'     => 'numeric',
64
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
65
            'required' => true,
66
            'info'     => 'Valor líquido do frete',
67
            'format'   => '15v2'
68
        ],
69
        'VL_SEC_CAT' => [
70
            'type'     => 'numeric',
71
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
72
            'required' => true,
73
            'info'     => 'Soma de valores de Sec/Cat (serviços de coleta/custo adicional de transporte)',
74
            'format'   => '15v2'
75
        ],
76
        'VL_DESP' => [
77
            'type'     => 'numeric',
78
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
79
            'required' => true,
80
            'info'     => 'Soma de valores de despacho',
81
            'format'   => '15v2'
82
        ],
83
        'VL_PEDG' => [
84
            'type'     => 'numeric',
85
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
86
            'required' => true,
87
            'info'     => 'Soma dos valores de pedágio',
88
            'format'   => '15v2'
89
        ],
90
        'VL_OUT' => [
91
            'type'     => 'numeric',
92
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
93
            'required' => true,
94
            'info'     => 'Outros valores',
95
            'format'   => '15v2'
96
        ],
97
        'VL_FRT' => [
98
            'type'     => 'numeric',
99
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
100
            'required' => true,
101
            'info'     => 'Valor total do frete',
102
            'format'   => '15v2'
103
        ],
104
        'UF_ID' => [
105
            'type'     => 'string',
106
            'regex'    => '^[0-9]{2}$',
107
            'required' => true,
108
            'info'     => 'Sigla da UF da placa do veículo',
109
            'format'   => ''
110
        ]
111
    ];
112
113
    /**
114
     * Constructor
115
     * @param \stdClass $std
116
     */
117
    public function __construct(\stdClass $std)
118
    {
119
        parent::__construct(self::REG);
120
        $this->std = $this->standarize($std);
121
    }
122
}
123