C350   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 96
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 96
loc 96
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
/**
10
 * REGISTRO C350: NOTA FISCAL DE VENDA A CONSUMIDOR (CÓDIGO 02)
11
 * Este registro deve ser apresentado pelos contribuintes que utilizam notas fiscais de venda ao consumidor, não
12
 * emitidas por ECF. As notas fiscais canceladas não devem ser informadas.
13
 * @package NFePHP\EFD\Elements\ICMSIPI
14
 */
15
16 View Code Duplication
class C350 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...
17
{
18
    const REG = 'C350';
19
    const LEVEL = 2;
20
    const PARENT = '';
21
22
    protected $parameters = [
23
        'SER' => [
24
            'type' => 'string',
25
            'regex' => '^.{0,3}$',
26
            'required' => false,
27
            'info' => 'Série do documento fiscal',
28
            'format' => ''
29
        ],
30
        'SUB_SER' => [
31
            'type' => 'string',
32
            'regex' => '^.{0,3}$',
33
            'required' => false,
34
            'info' => 'Subsérie do documento fiscal',
35
            'format' => ''
36
        ],
37
        'NUM_DOC' => [
38
            'type' => 'numeric',
39
            'regex' => '^(\d{0,6})$',
40
            'required' => false,
41
            'info' => 'Número do documento fiscal',
42
            'format' => ''
43
        ],
44
        'DT_DOC' => [
45
            'type' => 'string',
46
            'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$',
47
            'required' => false,
48
            'info' => 'Data da emissão do documento fiscal',
49
            'format' => ''
50
        ],
51
        'CNPJ_CPF' => [
52
            'type' => 'string',
53
            'regex' => '^[0-9]{14}$',
54
            'required' => false,
55
            'info' => 'CNPJ ou CPF do destinatário',
56
            'format' => ''
57
        ],
58
        'VL_MERC' => [
59
            'type' => 'numeric',
60
            'regex' => '^\d+(\.\d*)?|\.\d+$',
61
            'required' => false,
62
            'info' => 'Valor das mercadorias constantes no documento fiscal',
63
            'format' => '15v2'
64
        ],
65
        'VL_DOC' => [
66
            'type' => 'numeric',
67
            'regex' => '^\d+(\.\d*)?|\.\d+$',
68
            'required' => false,
69
            'info' => 'Valor total do documento fiscal',
70
            'format' => '15v2'
71
        ],
72
        'VL_DESC' => [
73
            'type' => 'numeric',
74
            'regex' => '^\d+(\.\d*)?|\.\d+$',
75
            'required' => false,
76
            'info' => 'Valor total do desconto',
77
            'format' => '15v2'
78
        ],
79
        'VL_PIS' => [
80
            'type' => 'numeric',
81
            'regex' => '^\d+(\.\d*)?|\.\d+$',
82
            'required' => false,
83
            'info' => 'Valor total do PIS',
84
            'format' => '15v2'
85
        ],
86
        'VL_COFINS' => [
87
            'type' => 'numeric',
88
            'regex' => '^\d+(\.\d*)?|\.\d+$',
89
            'required' => false,
90
            'info' => 'Valor total da COFINS',
91
            'format' => '15v2'
92
        ],
93
        'COD_CTA' => [
94
            'type' => 'string',
95
            'regex' => '^.{0,50}$',
96
            'required' => false,
97
            'info' => 'Código da conta analítica contábil debitada/creditada',
98
            'format' => ''
99
        ],
100
    ];
101
102
    /**
103
     * Constructor
104
     * @param \stdClass $std
105
     */
106
    public function __construct(\stdClass $std)
107
    {
108
        parent::__construct(self::REG);
109
        $this->std = $this->standarize($std);
110
    }
111
}
112