Z1900   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 107
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 107
loc 107
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 Z1900 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 = '1900';
12
    const LEVEL = 2;
13
    const PARENT = '1001';
14
15
    protected $parameters = [
16
        'CNPJ' => [
17
            'type' => 'string',
18
            'regex' => '^[0-9]{14}$',
19
            'required' => false,
20
            'info' => 'CNPJ do estabelecimento da pessoa jurídica, emitente dos documentos geradores de receita ',
21
            'format' => ''
22
        ],
23
        'COD_MOD' => [
24
            'type' => 'string',
25
            'regex' => '^(98|99)$',
26
            'required' => false,
27
            'info' => 'Código do modelo do documento fiscal conforme a Tabela 4.1.1, ou ' .
28
                ' 98 – Nota Fiscal de Prestação de Serviços (ISSQN) 99 – Outros Documentos ',
29
            'format' => ''
30
        ],
31
        'SER' => [
32
            'type' => 'string',
33
            'regex' => '^.{0,4}$',
34
            'required' => false,
35
            'info' => 'Série do documento fiscal ',
36
            'format' => ''
37
        ],
38
        'SUB_SER' => [
39
            'type' => 'numeric',
40
            'regex' => '^(\d{0,20})$',
41
            'required' => false,
42
            'info' => 'Subserie do documento fiscal ',
43
            'format' => ''
44
        ],
45
        'COD_SIT' => [
46
            'type' => 'numeric',
47
            'regex' => '^(00|02|09)$',
48
            'required' => false,
49
            'info' => 'Código da situação do documento fiscal ' .
50
                ' 00 – Documento regular 02 – Documento cancelado 99 – Outros ',
51
            'format' => ''
52
        ],
53
        'VL_TOT_REC' => [
54
            'type' => 'numeric',
55
            'regex' => '^\d+(\.\d*)?|\.\d+$',
56
            'required' => false,
57
            'info' => 'Valor total da receita, conforme os documentos emitidos no período, representativos da ' .
58
                'venda de bens e serviços ',
59
            'format' => '15v2'
60
        ],
61
        'QUANT_DOC' => [
62
            'type' => 'numeric',
63
            'regex' => '^([0-9]+)$',
64
            'required' => false,
65
            'info' => 'Quantidade total de documentos emitidos no período ',
66
            'format' => ''
67
        ],
68
        'CST_PIS' => [
69
            'type' => 'string',
70
            'regex' => '^((0[1-9])|49|99)$',
71
            'required' => false,
72
            'info' => 'Código da Situação Tributária do PIS/Pasep ',
73
            'format' => ''
74
        ],
75
        'CST_COFINS' => [
76
            'type' => 'string',
77
            'regex' => '^((0[1-9])|49|99)$',
78
            'required' => false,
79
            'info' => 'Código da Situação Tributária da Cofins ',
80
            'format' => ''
81
        ],
82
        'CFOP' => [
83
            'type' => 'numeric',
84
            'regex' => '^(\d{4})$',
85
            'required' => false,
86
            'info' => 'Código fiscal de operação e prestação ',
87
            'format' => ''
88
        ],
89
        'INF_COMPL' => [
90
            'type' => 'string',
91
            'regex' => '^(.*)$',
92
            'required' => false,
93
            'info' => 'Informações complementares ',
94
            'format' => ''
95
        ],
96
        'COD_CTA' => [
97
            'type' => 'string',
98
            'regex' => '^.{0,255}$',
99
            'required' => false,
100
            'info' => 'Código da conta analítica contábil representativa da receita ',
101
            'format' => ''
102
        ],
103
104
    ];
105
106
    /**
107
     * Constructor
108
     * @param \stdClass $std
109
     */
110
    public function __construct(\stdClass $std)
111
    {
112
        parent::__construct(self::REG);
113
        $this->std = $this->standarize($std);
114
    }
115
}
116