C420   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\ICMSIPI;
4
5
use NFePHP\EFD\Common\Element;
6
use NFePHP\EFD\Common\ElementInterface;
7
use \stdClass;
8
9 View Code Duplication
class C420 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 = 'C420';
12
    const LEVEL = 4;
13
    const PARENT = 'C400';
14
15
    protected $parameters = [
16
        'COD_TOT_PAR' => [
17
            'type' => 'string',
18
            'regex' => '^.{1,7}$',
19
            'required' => true,
20
            'info' => 'Código do totalizador, conforme Tabela 4.4.6',
21
            'format' => ''
22
        ],
23
        'VLR_ACUM_TOT' => [
24
            'type' => 'numeric',
25
            'regex' => '^\d+(\.\d*)?|\.\d+$',
26
            'required' => true,
27
            'info' => 'Valor acumulado no respectiva Redução Z.',
28
            'format' => '15v2'
29
        ],
30
        'NR_TOT' => [
31
            'type' => 'numeric',
32
            'regex' => '^(\d{0,2})$',
33
            'required' => false,
34
            'info' => 'Número do totalizador quando ocorrer mais de uma situação com a mesma carga tributária efetiva.',
35
            'format' => ''
36
        ],
37
        'DESCR_NR_TOT' => [
38
            'type' => 'string',
39
            'regex' => '^(.*)$',
40
            'required' => false,
41
            'info' => 'Descrição da situação tributária relativa ao totalizador parcial, quando houver
42
             mais de um com a mesma carga tributária efetiva.',
43
            'format' => ''
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