C880   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 111
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 111
loc 111
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 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...
10
{
11
    const REG = 'C880';
12
    const LEVEL = 4;
13
    const PARENT = 'C800';
14
15
    protected $parameters = [
16
        'COD_ITEM' => [
17
            'type' => 'string',
18
            'regex' => '^.{0,60}$',
19
            'required' => false,
20
            'info' => 'Código do item (campo 02 do Registro 0200)',
21
            'format' => ''
22
        ],
23
        'CFOP' => [
24
            'type' => 'numeric',
25
            'regex' => '^(\d{4})$',
26
            'required' => false,
27
            'info' => 'Código fiscal de operação e prestação',
28
            'format' => ''
29
        ],
30
        'VL_ITEM' => [
31
            'type' => 'numeric',
32
            'regex' => '^\d+(\.\d*)?|\.\d+$',
33
            'required' => false,
34
            'info' => 'Valor total dos itens',
35
            'format' => '15v2'
36
        ],
37
        'VL_DESC' => [
38
            'type' => 'numeric',
39
            'regex' => '^\d+(\.\d*)?|\.\d+$',
40
            'required' => false,
41
            'info' => 'Valor da exclusão/desconto comercial dos itens',
42
            'format' => '15v2'
43
        ],
44
        'CST_PIS' => [
45
            'type' => 'numeric',
46
            'regex' => '^((0[1-9])|49|99)$',
47
            'required' => false,
48
            'info' => 'Código da Situação Tributária referente ao PIS/PASEP',
49
            'format' => ''
50
        ],
51
        'QUANT_BC_PIS' => [
52
            'type' => 'numeric',
53
            'regex' => '^\d+(\.\d*)?|\.\d+$',
54
            'required' => false,
55
            'info' => 'Base de cálculo em quantidade - PIS/PASEP',
56
            'format' => '15v3'
57
        ],
58
        'ALIQ_PIS_QUANT' => [
59
            'type' => 'numeric',
60
            'regex' => '^\d+(\.\d*)?|\.\d+$',
61
            'required' => false,
62
            'info' => 'Alíquota do PIS/PASEP (em reais)',
63
            'format' => '15v4'
64
        ],
65
        'VL_PIS' => [
66
            'type' => 'numeric',
67
            'regex' => '^\d+(\.\d*)?|\.\d+$',
68
            'required' => false,
69
            'info' => 'Valor do PIS/PASEP',
70
            'format' => '15v2'
71
        ],
72
        'CST_COFINS' => [
73
            'type' => 'numeric',
74
            'regex' => '^((0[1-9])|49|99)$',
75
            'required' => false,
76
            'info' => 'Código da Situação Tributária referente a COFINS',
77
            'format' => ''
78
        ],
79
        'QUANT_BC_COFINS' => [
80
            'type' => 'numeric',
81
            'regex' => '^\d+(\.\d*)?|\.\d+$',
82
            'required' => false,
83
            'info' => 'Base de cálculo em quantidade – COFINS',
84
            'format' => '15v3'
85
        ],
86
        'ALIQ_COFINS_QUANT' => [
87
            'type' => 'numeric',
88
            'regex' => '^\d+(\.\d*)?|\.\d+$',
89
            'required' => false,
90
            'info' => 'Alíquota da COFINS (em reais)',
91
            'format' => '15v4'
92
        ],
93
        'VL_COFINS' => [
94
            'type' => 'numeric',
95
            'regex' => '^\d+(\.\d*)?|\.\d+$',
96
            'required' => false,
97
            'info' => 'Valor da COFINS',
98
            'format' => '15v2'
99
        ],
100
        'COD_CTA' => [
101
            'type' => 'string',
102
            'regex' => '^.{0,255}$',
103
            'required' => false,
104
            'info' => 'Código da conta analítica contábil debitada/creditada',
105
            'format' => ''
106
        ],
107
108
    ];
109
110
    /**
111
     * Constructor
112
     * @param \stdClass $std
113
     */
114
    public function __construct(\stdClass $std)
115
    {
116
        parent::__construct(self::REG);
117
        $this->std = $this->standarize($std);
118
    }
119
}
120