C165::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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
 * REGISTRO C165: OPERAÇÕES COM COMBUSTÍVEIS (CÓDIGO 01).
11
 * Este registro deve ser apresentado pelas empresas do segmento de combustíveis (distribuidoras, refinarias,
12
 * revendedoras) em operações de saída. Postos de combustíveis não devem apresentar este registro.
13
 * @package NFePHP\EFD\Elements\ICMSIPI
14
 */
15 View Code Duplication
class C165 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...
16
{
17
    const REG = 'C165';
18
    const LEVEL = 3;
19
    const PARENT = 'C100';
20
21
    protected $parameters = [
22
        'COD_PART' => [
23
            'type' => 'string',
24
            'regex' => '^[A-z0-9]{1,60}$',
25
            'required' => false,
26
            'info' => 'Código do participante',
27
            'format' => ''
28
        ],
29
        'VEIC_ID' => [
30
            'type' => 'string',
31
            'regex' => '^[A-Z]{3}[\d]{1}[\dA-Z]{1}[\d]{2}$',
32
            'required' => false,
33
            'info' => 'Placa de identificação do veículo automotor',
34
            'format' => ''
35
        ],
36
        'COD_AUT' => [
37
            'type' => 'string',
38
            'regex' => '^(.*)$',
39
            'required' => false,
40
            'info' => 'Código da autorização fornecido pela SEFAZ (combustíveis)',
41
            'format' => ''
42
        ],
43
        'NR_PASSE' => [
44
            'type' => 'string',
45
            'regex' => '^(.*)$',
46
            'required' => false,
47
            'info' => 'Código da autorização fornecido pela SEFAZ (combustíveis)',
48
            'format' => ''
49
        ],
50
        'HORA' => [
51
            'type' => 'numeric',
52
            'regex' => '^(?:[01]\d|2[0123])(?:[012345]\d)(?:[012345]\d)$',
53
            'required' => false,
54
            'info' => 'Código da autorização fornecido pela SEFAZ (combustíveis)',
55
            'format' => ''
56
        ],
57
        'TEMPER' => [
58
            'type' => 'numeric',
59
            'regex' => '^\d+(\.\d*)?|\.\d+$',
60
            'required' => false,
61
            'info' => 'Temperatura em graus Celsius utilizada para '.
62
                      'quantificação do volume de combustível',
63
            'format' => '3v2'
64
        ],
65
        'QTD_VOL' => [
66
            'type' => 'numeric',
67
            'regex' => '^\d+$',
68
            'required' => false,
69
            'info' => 'Quantidade de volumes transportados',
70
            'format' => ''
71
        ],
72
        'PESO_BRT' => [
73
            'type' => 'numeric',
74
            'regex' => '^\d+(\.\d*)?|\.\d+$',
75
            'required' => false,
76
            'info' => 'Peso bruto dos volumes transportados (em Kg)',
77
            'format' => '10v2'
78
        ],
79
        'PESO_LIQ' => [
80
            'type' => 'numeric',
81
            'regex' => '^\d+(\.\d*)?|\.\d+$',
82
            'required' => false,
83
            'info' => 'Peso líquido dos volumes transportados (em Kg)',
84
            'format' => '10v2'
85
        ],
86
        'NOM_MOT' => [
87
            'type' => 'string',
88
            'regex' => '^.{1,60}$',
89
            'required' => false,
90
            'info' => 'Nome do motorista',
91
            'format' => ''
92
        ],
93
        'CPF' => [
94
            'type' => 'string',
95
            'regex' => '^[0-9]{11}$',
96
            'required' => false,
97
            'info' => 'CPF do motorista',
98
            'format' => ''
99
        ],
100
        'UF_ID' => [
101
            'type' => 'string',
102
            'regex' => '^[A-z]{2}$',
103
            'required' => false,
104
            'info' => 'Sigla da UF da placa do veículo',
105
            'format' => ''
106
        ],
107
    ];
108
109
    /**
110
     * Constructor
111
     * @param \stdClass $std
112
     */
113
    public function __construct(\stdClass $std)
114
    {
115
        parent::__construct(self::REG);
116
        $this->std = $this->standarize($std);
117
    }
118
}
119