C120::__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 C120: COMPLEMENTO DE DOCUMENTO - OPERAÇÕES DE IMPORTAÇÃO (CÓDIGOS 01 e 55)
11
 * Este registro tem por objetivo informar detalhes das operações de importação, que estejam sendo documentadas pela
12
 * nota fiscal escriturada no registro C100, quando o campo IND_OPER for igual a “0” (zero),
13
 * indicando operação de entrada.
14
 * @package NFePHP\EFD\Elements\ICMSIPI
15
 */
16 View Code Duplication
class C120 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...
17
{
18
    const REG = 'C120';
19
    const LEVEL = 3;
20
    const PARENT = 'C100';
21
22
    protected $parameters = [
23
        'COD_DOC_IMP' => [
24
            'type' => 'string',
25
            'regex' => '^(0|1)+$',
26
            'required' => true,
27
            'info' => 'Documento de importação',
28
            'format' => ''
29
        ],
30
        'NUM_DOC_IMP' => [
31
            'type' => 'string',
32
            'regex' => '^([0-9]{10,12})+$',
33
            'required' => true,
34
            'info' => 'Número do documento de Importação',
35
            'format' => ''
36
        ],
37
        'PIS_IMP' => [
38
            'type' => 'numeric',
39
            'regex' => '^\d+(\.\d*)?|\.\d+$',
40
            'required' => false,
41
            'info' => 'Valor pago de PIS na importação',
42
            'format' => '15v2'
43
        ],
44
        'COFINS_IMP' => [
45
            'type' => 'numeric',
46
            'regex' => '^\d+(\.\d*)?|\.\d+$',
47
            'required' => false,
48
            'info' => 'Valor pago de COFINS na importação',
49
            'format' => '15v2'
50
        ],
51
        'NUM_ACDRAW' => [
52
            'type' => 'string',
53
            'regex' => '^([0-9]{1,20})$',
54
            'required' => false,
55
            'info' => 'Número do Ato Concessório do regime Drawback',
56
            'format' => ''
57
        ],
58
    ];
59
60
    /**
61
     * Constructor
62
     * @param \stdClass $std
63
     */
64
    public function __construct(\stdClass $std)
65
    {
66
        parent::__construct(self::REG);
67
        $this->std = $this->standarize($std);
68
    }
69
}
70