Z0200   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 97
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 97
loc 97
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\Contribuicoes;
4
5
use NFePHP\EFD\Common\Element;
6
use NFePHP\EFD\Common\ElementInterface;
7
use \stdClass;
8
9 View Code Duplication
class Z0200 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 = '0200';
12
    const LEVEL = 3;
13
    const PARENT = '0000';
14
15
    protected $parameters = [
16
        'COD_ITEM' => [
17
            'type' => 'string',
18
            'regex' => '^.{0,60}$',
19
            'required' => false,
20
            'info' => 'Código do item',
21
            'format' => ''
22
        ],
23
        'DESCR_ITEM' => [
24
            'type' => 'string',
25
            'regex' => '^(.*)$',
26
            'required' => false,
27
            'info' => 'Descrição do item',
28
            'format' => ''
29
        ],
30
        'COD_BARRA' => [
31
            'type' => 'string',
32
            'regex' => '^(.*)$',
33
            'required' => false,
34
            'info' => 'Representação alfanumérico do código de barra do produto, se houver.',
35
            'format' => ''
36
        ],
37
        'COD_ANT_ITEM' => [
38
            'type' => 'string',
39
            'regex' => '^.{0,60}$',
40
            'required' => false,
41
            'info' => 'Código anterior do item com relação à última informação apresentada.',
42
            'format' => ''
43
        ],
44
        'UNID_INV' => [
45
            'type' => 'string',
46
            'regex' => '^.{0,6}$',
47
            'required' => false,
48
            'info' => 'Unidade de medida utilizada na quantificação de estoques.',
49
            'format' => ''
50
        ],
51
        'TIPO_ITEM' => [
52
            'type' => 'numeric',
53
            'regex' => '^(00|01|02|03|04|05|06|07|08|09|10|99)$',
54
            'required' => false,
55
            'info' => 'Tipo do item – Atividades Industriais, Comerciais e Serviços:',
56
            'format' => ''
57
        ],
58
        'COD_NCM' => [
59
            'type' => 'string',
60
            'regex' => '^.{0,8}$',
61
            'required' => false,
62
            'info' => 'Código da Nomenclatura Comum do Mercosul',
63
            'format' => ''
64
        ],
65
        'EX_IPI' => [
66
            'type' => 'string',
67
            'regex' => '^.{0,3}$',
68
            'required' => false,
69
            'info' => 'Código EX, conforme a TIPI',
70
            'format' => ''
71
        ],
72
        'COD_GEN' => [
73
            'type' => 'numeric',
74
            'regex' => '^(\d{2})$',
75
            'required' => false,
76
            'info' => 'Código do gênero do item, conforme a Tabela 4.2.1.',
77
            'format' => ''
78
        ],
79
        'COD_LST' => [
80
            'type' => 'numeric',
81
            'regex' => '^(\d{0,4})$',
82
            'required' => false,
83
            'info' => 'Código do serviço conforme lista do Anexo I da Lei Complementar Federal nº 116/03.',
84
            'format' => ''
85
        ],
86
        'ALIQ_ICMS' => [
87
            'type' => 'numeric',
88
            'regex' => '^\d+(\.\d*)?|\.\d+$',
89
            'required' => false,
90
            'info' => 'Alíquota de ICMS aplicável ao item nas operações internas',
91
            'format' => '6v2'
92
        ],
93
94
    ];
95
96
    /**
97
     * Constructor
98
     * @param \stdClass $std
99
     */
100
    public function __construct(\stdClass $std)
101
    {
102
        parent::__construct(self::REG);
103
        $this->std = $this->standarize($std);
104
    }
105
}
106