M300::__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\Contribuicoes;
4
5
use NFePHP\EFD\Common\Element;
6
use NFePHP\EFD\Common\ElementInterface;
7
use \stdClass;
8
9 View Code Duplication
class M300 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 = 'M300';
12
    const LEVEL = 2;
13
    const PARENT = 'M001';
14
15
    protected $parameters = [
16
        'COD_CONT' => [
17
            'type' => 'string',
18
            'regex' => '^.{0,2}$',
19
            'required' => false,
20
            'info' => 'Código da contribuição social diferida em períodos anteriores, conforme a Tabela ' .
21
                '4.3.5. ',
22
            'format' => ''
23
        ],
24
        'VL_CONT_APUR_DIFER' => [
25
            'type' => 'numeric',
26
            'regex' => '^\d+(\.\d*)?|\.\d+$',
27
            'required' => false,
28
            'info' => 'Valor da Contribuição Apurada, diferida em períodos anteriores. ',
29
            'format' => '15v2'
30
        ],
31
        'NAT_CRED_DESC' => [
32
            'type' => 'string',
33
            'regex' => '^(1|2|3|4)$',
34
            'required' => false,
35
            'info' => 'Natureza do Crédito Diferido, vinculado à receita tributada no mercado interno, a ' .
36
                'descontar ' .
37
                ' 01 – Crédito a Alíquota Básica ' .
38
                ' 02 – Crédito a Alíquota Diferenciada ' .
39
                ' 03 – Crédito a Alíquota por Unidade de Produto ' .
40
                ' 04 – Crédito Presumido da Agroindústria. ',
41
            'format' => ''
42
        ],
43
        'VL_CRED_DESC_DIFER' => [
44
            'type' => 'numeric',
45
            'regex' => '^\d+(\.\d*)?|\.\d+$',
46
            'required' => false,
47
            'info' => 'Valor do Crédito a Descontar vinculado à contribuição diferida. ',
48
            'format' => '15v2'
49
        ],
50
        'VL_CONT_DIFER_ANT' => [
51
            'type' => 'numeric',
52
            'regex' => '^(3)$',
53
            'required' => false,
54
            'info' => 'Valor da Contribuição a Recolher, diferida em períodos anteriores (Campo 03 – Campo ' .
55
                '05) ',
56
            'format' => '15v2'
57
        ],
58
        'PER_APUR' => [
59
            'type' => 'numeric',
60
            'regex' => '^(\d{6})$',
61
            'required' => false,
62
            'info' => 'Período de apuração da contribuição social e dos créditos diferidos (MMAAAA) ',
63
            'format' => ''
64
        ],
65
        'DT_RECEB' => [
66
            'type' => 'string',
67
            'regex' => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$',
68
            'required' => false,
69
            'info' => 'Data de recebimento da receita, objeto de diferimento ',
70
            'format' => ''
71
        ],
72
73
    ];
74
75
    /**
76
     * Constructor
77
     * @param \stdClass $std
78
     */
79
    public function __construct(\stdClass $std)
80
    {
81
        parent::__construct(self::REG);
82
        $this->std = $this->standarize($std);
83
    }
84
}
85