C191   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 98
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 98
loc 98
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 C191 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 = 'C191';
12
    const LEVEL = 4;
13
    const PARENT = 'C190';
14
15
    protected $parameters = [
16
        'CNPJ_CPF_PART' => [
17
            'type' => 'string',
18
            'regex' => '^[0-9]{14}$',
19
            'required' => false,
20
            'info' => 'CNPJ/CPF do Participante a que se referem as operações consolidadas neste 
21
            registro (pessoa jurídica ou pessoa física vendedora/remetente)',
22
            'format' => ''
23
        ],
24
        'CST_PIS' => [
25
            'type' => 'numeric',
26
            'regex' => '^((5[0-6])|(6[0-6])|(7[0-5])|98|99)$',
27
            'required' => false,
28
            'info' => 'Código da Situação Tributária referente ao PIS/PASEP',
29
            'format' => ''
30
        ],
31
        'CFOP' => [
32
            'type' => 'numeric',
33
            'regex' => '^(\d{4})$',
34
            'required' => false,
35
            'info' => 'Código fiscal de operação e prestação',
36
            'format' => ''
37
        ],
38
        'VL_ITEM' => [
39
            'type' => 'numeric',
40
            'regex' => '^\d+(\.\d*)?|\.\d+$',
41
            'required' => false,
42
            'info' => 'Valor do item',
43
            'format' => '15v2'
44
        ],
45
        'VL_DESC' => [
46
            'type' => 'numeric',
47
            'regex' => '^\d+(\.\d*)?|\.\d+$',
48
            'required' => false,
49
            'info' => 'Valor do desconto comercial / Exclusão',
50
            'format' => '15v2'
51
        ],
52
        'VL_BC_PIS' => [
53
            'type' => 'numeric',
54
            'regex' => '^\d+(\.\d*)?|\.\d+$',
55
            'required' => false,
56
            'info' => 'Valor da base de cálculo do PIS/PASEP',
57
            'format' => '15v2'
58
        ],
59
        'ALIQ_PIS' => [
60
            'type' => 'numeric',
61
            'regex' => '^\d+(\.\d*)?|\.\d+$',
62
            'required' => false,
63
            'info' => 'Alíquota do PIS/PASEP (em percentual)',
64
            'format' => '8v4'
65
        ],
66
        'QUANT_BC_PIS' => [
67
            'type' => 'numeric',
68
            'regex' => '^\d+(\.\d*)?|\.\d+$',
69
            'required' => false,
70
            'info' => 'Quantidade – Base de cálculo PIS/PASEP',
71
            'format' => '15v3'
72
        ],
73
        'ALIQ_PIS_QUANT' => [
74
            'type' => 'numeric',
75
            'regex' => '^\d+(\.\d*)?|\.\d+$',
76
            'required' => false,
77
            'info' => 'Alíquota do PIS/PASEP (em reais)',
78
            'format' => '15v4'
79
        ],
80
        'VL_PIS' => [
81
            'type' => 'numeric',
82
            'regex' => '^\d+(\.\d*)?|\.\d+$',
83
            'required' => false,
84
            'info' => 'Valor do PIS/PASEP',
85
            'format' => '15v2'
86
        ],
87
        'COD_CTA' => [
88
            'type' => 'string',
89
            'regex' => '^.{0,255}$',
90
            'required' => false,
91
            'info' => 'Código da conta analítica contábil debitada/creditada',
92
            'format' => ''
93
        ],
94
95
    ];
96
97
    /**
98
     * Constructor
99
     * @param \stdClass $std
100
     */
101
    public function __construct(\stdClass $std)
102
    {
103
        parent::__construct(self::REG);
104
        $this->std = $this->standarize($std);
105
    }
106
}
107