Z0100   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 110
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 110
loc 110
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
 * Elemento 0100 do Bloco 0
11
 * REGISTRO 0100: DADOS DO CONTABILISTA
12
 * Registro utilizado para identificação do contabilista responsável pela
13
 * escrituração fiscal do estabelecimento, mesmo que o contabilista seja
14
 * funcionário da empresa ou prestador de serviço.
15
 *
16
 * NOTA: usada a letra Z no nome da Classe pois os nomes não podem ser exclusivamente
17
 * numeréricos e também para não confundir os com elementos do bloco B
18
 */
19 View Code Duplication
class Z0100 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...
20
{
21
    const REG = '0100';
22
    const LEVEL = 2;
23
    const PARENT = '0015|0005';
24
    
25
    protected $parameters = [
26
        'NOME' => [
27
            'type'     => 'string',
28
            'regex'    => '^.{3,100}$',
29
            'required' => true,
30
            'info'     => 'Nome do contabilista',
31
            'format'   => ''
32
        ],
33
        'CPF' => [
34
            'type'     => 'string',
35
            'regex'    => '^[0-9]{11}$',
36
            'required' => true,
37
            'info'     => 'Número de inscrição do contabilista no CPF',
38
            'format'   => ''
39
        ],
40
        'CRC' => [
41
            'type'     => 'string',
42
            'regex'    => '^.{8,15}$',
43
            'required' => true,
44
            'info'     => 'Número   de   inscrição   do   contabilista   no   Conselho Regional de Contabilidade',
45
            'format'   => ''
46
        ],
47
        'CNPJ' => [
48
            'type'     => 'string',
49
            'regex'    => '^[0-9]{14}$',
50
            'required' => false,
51
            'info'     => 'Número  de  inscrição  do  escritório  de  contabilidade  no CNPJ, se houver.',
52
            'format'   => ''
53
        ],
54
        'CEP' => [
55
            'type'     => 'string',
56
            'regex'    => '^[0-9]{8}$',
57
            'required' => false,
58
            'info'     => 'Código de Endereçamento Posta.l',
59
            'format'   => ''
60
        ],
61
        'END' => [
62
            'type'     => 'string',
63
            'regex'    => '^.{3,60}$',
64
            'required' => false,
65
            'info'     => 'Logradouro e endereço do imóvel.',
66
            'format'   => ''
67
        ],
68
        'NUM' => [
69
            'type'     => 'string',
70
            'regex'    => '^.{1,10}$',
71
            'required' => false,
72
            'info'     => 'Número do imóvel.',
73
            'format'   => ''
74
        ],
75
        'COMPL' => [
76
            'type'     => 'string',
77
            'regex'    => '^.{1,60}$',
78
            'required' => false,
79
            'info'     => 'Dados complementares do endereço.',
80
            'format'   => ''
81
        ],
82
        'BAIRRO' => [
83
            'type'     => 'string',
84
            'regex'    => '^.{3,60}$',
85
            'required' => false,
86
            'info'     => 'Bairro em que o imóvel está situado.',
87
            'format'   => ''
88
        ],
89
        'FONE' => [
90
            'type'     => 'string',
91
            'regex'    => '^[0-9]{8,11}$',
92
            'required' => false,
93
            'info'     => 'Número do telefone (DDD+FONE).',
94
            'format'   => ''
95
        ],
96
        'FAX' => [
97
            'type'     => 'string',
98
            'regex'    => '^[0-9]{8,11}$',
99
            'required' => false,
100
            'info'     => 'Número do fax.',
101
            'format'   => ''
102
        ],
103
        'EMAIL' => [
104
            'type'     => 'string',
105
            'regex'    => 'email',
106
            'required' => true,
107
            'info'     => 'Endereço do correio eletrônico.',
108
            'format'   => ''
109
        ],
110
        'COD_MUN' => [
111
            'type'     => 'integer',
112
            'regex'    => '^[0-9]{7}$',
113
            'required' => true,
114
            'info'     => 'Código do município, conforme tabela IBGE.',
115
            'format'   => ''
116
        ]
117
    ];
118
119
    /**
120
     * Constructor
121
     * @param \stdClass $std
122
     */
123
    public function __construct(\stdClass $std)
124
    {
125
        parent::__construct(self::REG);
126
        $this->std = $this->standarize($std);
127
    }
128
}
129