P110   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 48
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 48
loc 48
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 P110 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 = 'P110';
12
    const LEVEL = 4;
13
    const PARENT = 'P100';
14
15
    protected $parameters = [
16
        'NUM_CAMPO' => [
17
            'type' => 'string',
18
            'regex' => '^.{2}$',
19
            'required' => false,
20
            'info' => 'Informar o número do campo do registro “P100”, objeto de detalhamento neste registro. ',
21
            'format' => ''
22
        ],
23
        'COD_DET' => [
24
            'type' => 'string',
25
            'regex' => '^.{8}$',
26
            'required' => false,
27
            'info' => 'Código do tipo de detalhamento, conforme Tabela 5.1.2 ',
28
            'format' => ''
29
        ],
30
        'DET_VALOR' => [
31
            'type' => 'numeric',
32
            'regex' => '^\d+(\.\d*)?|\.\d+$',
33
            'required' => false,
34
            'info' => 'Valor detalhado referente ao campo 02 deste registro ',
35
            'format' => '15v2'
36
        ],
37
        'INF_COMPL' => [
38
            'type' => 'string',
39
            'regex' => '^(.*)$',
40
            'required' => false,
41
            'info' => 'Informação complementar do detalhamento. ',
42
            'format' => ''
43
        ],
44
45
    ];
46
47
    /**
48
     * Constructor
49
     * @param \stdClass $std
50
     */
51
    public function __construct(\stdClass $std)
52
    {
53
        parent::__construct(self::REG);
54
        $this->std = $this->standarize($std);
55
    }
56
}
57