E240   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 84
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 84
loc 84
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 View Code Duplication
class E240 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 = 'E240';
12
    const LEVEL = 5;
13
    const PARENT = 'E220';
14
15
    protected $parameters = [
16
        'COD_PART' => [
17
            'type'     => 'string',
18
            'regex'    => '^.{1,60}$',
19
            'required' => true,
20
            'info'     => 'Código do participante (campo 02 do Registro 0150): '
21
            .'- do emitente do documento ou do remetente das mercadorias, no caso de entradas; '
22
            .'- do adquirente, no caso de saídas',
23
            'format'   => ''
24
        ],
25
        'COD_MOD' => [
26
            'type'     => 'string',
27
            'regex'    => '^.{2}$',
28
            'required' => true,
29
            'info'     => 'Código do modelo do documento fiscal, conforme a Tabela 4.1.1',
30
            'format'   => ''
31
        ],
32
        'SER' => [
33
            'type'     => 'string',
34
            'regex'    => '^.{1,4}$',
35
            'required' => false,
36
            'info'     => 'Série do documento fiscal',
37
            'format'   => ''
38
        ],
39
        'SUB' => [
40
            'type'     => 'integer',
41
            'regex'    => '^.{1,3}$',
42
            'required' => false,
43
            'info'     => 'Subsérie do documento fiscal',
44
            'format'   => ''
45
        ],
46
        'NUM_DOC' => [
47
            'type'     => 'integer',
48
            'regex'    => '^([1-9])([0-9]{1,8}|)$',
49
            'required' => true,
50
            'info'     => 'Número do documento fiscal',
51
            'format'   => ''
52
        ],
53
        'DT_DOC' => [
54
            'type'     => 'integer',
55
            'regex'    => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$',
56
            'required' => true,
57
            'info'     => 'Data da emissão do documento fiscal',
58
            'format'   => ''
59
        ],
60
        'COD_ITEM' => [
61
            'type'     => 'string',
62
            'regex'    => '^.{1,60}$',
63
            'required' => false,
64
            'info'     => 'Código do item (campo 02 do Registro 0200)',
65
            'format'   => ''
66
        ],
67
        'VL_AJ_ITEM' => [
68
            'type'     => 'numeric',
69
            'regex'    => '^\d+(\.\d*)?|\.\d+$',
70
            'required' => true,
71
            'info'     => 'Valor do ajuste para a operação/item',
72
            'format'   => '15v2'
73
        ],
74
        'CHV_DOCE' => [
75
            'type'     => 'string',
76
            'regex'    => '^.{44}$',
77
            'required' => false,
78
            'info'     => 'Chave do Documento Eletrônico',
79
            'format'   => ''
80
        ]
81
    ];
82
83
    /**
84
     * Constructor
85
     * @param \stdClass $std
86
     */
87
    public function __construct(\stdClass $std)
88
    {
89
        parent::__construct(self::REG);
90
        $this->std = $this->standarize($std);
91
    }
92
}
93