| 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 0000 do Bloco 0 OBRIGATÓRIO [1:1] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * REGISTRO 0000: ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | class Z0000 extends Element implements ElementInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     const REG = '0000'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |     const LEVEL = 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     const PARENT = ''; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     protected $parameters = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |         'lecd' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |             'regex'    => '^(LECD)$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |             'info'     => 'Texto fixo contendo LECD.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |         'dt_ini'     => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |             'regex'    => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             'info'     => 'Data inicial das informações contidas no arquivo.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         'dt_fin'     => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             'regex'    => '^(0[1-9]|[1-2][0-9]|31(?!(?:0[2469]|11))|30(?!02))(0[1-9]|1[0-2])([12]\d{3})$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             'info'     => 'Data final das informações contidas no arquivo.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         'nome'      => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             'regex'    => '^.{2,100}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             'info'     => 'Nome empresarial da entidade.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         'cnpj'      => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             'regex'    => '^[0-9]{14}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |             'info'     => 'Número de inscrição da entidade no CNPJ.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         'uf'        => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             'regex'    => '^[A-Z]{2}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |             'info'     => 'Sigla da unidade da federação da entidade.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         'ie'        => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             'regex'    => '^[0-9]{2,14}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             'info'     => 'Inscrição Estadual da entidade.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         'cod_mun'    => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             'regex'    => '^[0-9]{7}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |             'info'     => 'Código  do  município  do  domicílio  fiscal  da  ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |             . 'entidade, conforme a tabela IBGE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         'im'        => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             'regex'    => '^[A-Za-z0-9]{1,15}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             'info'     => 'Inscrição Municipal da entidade.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         'ind_sit_esp' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |             'regex'    => '^[0-9]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |             'info'     => 'Indicador de situação especial (conforme tabela publicada pelo Sped).', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         'ind_sit_ini_per' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |             'regex'    => '^[0-9]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             'info'     => 'Indicador de situação no início do período.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         'ind_nire' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |             'regex'    => '^[0-1]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             'info'     => 'Indicador de existência de NIRE', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         'ind_fin_esc' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |             'regex'    => '^[0-1]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |             'info'     => 'Indicador de finalidade da escrituração: 0 - Original 1 – Substituta', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         'cod_hash_sub' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |             'regex'    => '^.{1,40}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |             'info'     => 'Hash da escrituração substituída.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         'ind_grande_porte' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |             'regex'    => '^[0-1]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |             'info'     => 'Indicador de entidade sujeita a auditoria independente:' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |                 . '0 – Empresa não é entidade sujeita a auditoria independente. ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |                 . '1 – Empresa é entidade sujeita a auditoria independente – Ativo ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |                 . 'Total superior a R$ 240.000.000,00 ou Receita Bruta Anual superior R$300.000.000,00.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         'tip_ecd' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |             'regex'    => '^[0-2]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |             'info'     => 'Indicador do tipo de ECD: ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |                 . '0 – ECD de empresa não participante de SCP como sócio ostensivo. ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |                 . '1 – ECD de empresa participante de SCP como sócio ostensivo. ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |                 . '2 – ECD da SCP.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         'cod_scp' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |             'regex'    => '^[0-9]{14}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |             'info'     => 'CNPJ da SCP. Observação: ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |                 . 'Só deve ser preenchido pela própria SCP com o CNPJ da SCP ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |                 . '(Não é preenchido pelo sócio ostensivo)', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |         'ident_mf' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |             'regex'    => '^(S|N)$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |             'info'     => 'Identificação de moeda funcional', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         'ind_esc_cons' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |             'type'     => 'string', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |             'regex'    => '^(S|N)$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |             'info'     => 'Escriturações Contábeis Consolidadas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |         'ind_centralizada' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |             'regex'    => '^[0-1]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |             'info'     => '0 – Escrituração Centralizada 1 – Escrituração Descentralizada', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         'ind_mudanc_pc' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |             'regex'    => '^[0-1]{1}$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |             'required' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |             'info'     => '0 – Não houve mudança no plano de contas. 1 – Houve mudança no plano de contas.', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         'cod_plan_ref' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |             'type'     => 'numeric', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             'regex'    => '^(1|2|3|4|5|6|7|8|9|10)$', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |             'required' => false, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |             'info'     => 'Código do Plano de Contas Referencial que será utilizado ' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |                 . 'para o mapeamento de todas as contas analíticas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |             'format'   => '' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * Constructor | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * @param \stdClass $std | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 189 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 190 |  |  |     public function __construct(\stdClass $std) | 
            
                                                        
            
                                    
            
            
                | 191 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 192 |  |  |         parent::__construct(self::REG); | 
            
                                                        
            
                                    
            
            
                | 193 |  |  |         $this->std = $this->standarize($std); | 
            
                                                        
            
                                    
            
            
                | 194 |  |  |         $this->postValidation(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 195 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 196 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 197 |  |  |  | 
            
                        
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:
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: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: