I010   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 34
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace NFePHP\ECD\Elements;
4
5
use NFePHP\ECD\Common\Element;
6
use NFePHP\ECD\Common\ElementInterface;
7
use \stdClass;
8
9
/**
10
 * Elemento I010 do Bloco I OBRIGATÓRIO [1:1]
11
 * REGISTRO I010: IDENTIFICAÇÃO DA ESCRITURAÇÃO CONTÁBIL
12
 */
13
class I010 extends Element implements ElementInterface
14
{
15
    const REG = 'I010';
16
    const LEVEL = 2;
17
    const PARENT = '';
18
19
    protected $parameters = [
20
        'ind_esc'    => [
21
            'type'     => 'string',
22
            'regex'    => '^[G|R|A|B|Z]{1}$',
23
            'required' => true,
24
            'info'     => 'Indicador da forma de escrituração contábi.',
25
            'format'   => ''
26
        ],
27
        'cod_ver_lc' => [
28
            'type'     => 'string',
29
            'regex'    => '^(8.00)$',
30
            'required' => true,
31
            'info'     => 'Código da versao do layout contabil.',
32
            'format'   => ''
33
        ]
34
    ];
35
36
    /**
37
     * Constructor
38
     * @param \stdClass $std
39
     */
40
    public function __construct(\stdClass $std)
41
    {
42
        parent::__construct(self::REG);
43
        $this->std = $this->standarize($std);
44
        $this->postValidation();
0 ignored issues
show
Unused Code introduced by
The call to the method NFePHP\ECD\Elements\I010::postValidation() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
45
    }
46
}
47