C120   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
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 54
loc 54
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 C120: COMPLEMENTO DE DOCUMENTO - OPERAÇÕES DE IMPORTAÇÃO (CÓDIGOS 01 e 55)
11
 * Este registro tem por objetivo informar detalhes das operações de importação, que estejam sendo documentadas pela
12
 * nota fiscal escriturada no registro C100, quando o campo IND_OPER for igual a “0” (zero),
13
 * indicando operação de entrada.
14
 * @package NFePHP\EFD\Elements\ICMSIPI
15
 */
16 View Code Duplication
class C120 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 = 'C120';
19
    const LEVEL = 3;
20
    const PARENT = 'C100';
21
22
    protected $parameters = [
23
        'COD_DOC_IMP' => [
24
            'type' => 'string',
25
            'regex' => '^(0|1)+$',
26
            'required' => true,
27
            'info' => 'Documento de importação',
28
            'format' => ''
29
        ],
30
        'NUM_DOC_IMP' => [
31
            'type' => 'string',
32
            'regex' => '^([0-9]{10,12})+$',
33
            'required' => true,
34
            'info' => 'Número do documento de Importação',
35
            'format' => ''
36
        ],
37
        'PIS_IMP' => [
38
            'type' => 'numeric',
39
            'regex' => '^\d+(\.\d*)?|\.\d+$',
40
            'required' => false,
41
            'info' => 'Valor pago de PIS na importação',
42
            'format' => '15v2'
43
        ],
44
        'COFINS_IMP' => [
45
            'type' => 'numeric',
46
            'regex' => '^\d+(\.\d*)?|\.\d+$',
47
            'required' => false,
48
            'info' => 'Valor pago de COFINS na importação',
49
            'format' => '15v2'
50
        ],
51
        'NUM_ACDRAW' => [
52
            'type' => 'string',
53
            'regex' => '^([0-9]{1,20})$',
54
            'required' => false,
55
            'info' => 'Número do Ato Concessório do regime Drawback',
56
            'format' => ''
57
        ],
58
    ];
59
60
    /**
61
     * Constructor
62
     * @param \stdClass $std
63
     */
64
    public function __construct(\stdClass $std)
65
    {
66
        parent::__construct(self::REG);
67
        $this->std = $this->standarize($std);
68
    }
69
}
70