How to use __get method of child class

Best Atoum code snippet using child.__get

NfsTipoComplexoAbrasf.php

Source:NfsTipoComplexoAbrasf.php Github

copy

Full Screen

...89 */90 public function tcIdentificacaoNfse(DOMElement $nodoPai, IdentificacaoNfse $dadosNFE)91 {92 //Numero tsNumeroNfse 1-193 $this->criaNodo($nodoPai, "Numero", $dadosNFE->__get("Numero"));94 //Cnpj tsCnpj 1-1DDDD95 96 $CpfCnpj= $this->documentoXML->createElement('CpfCnpj'); 97 $this->tcCpfCnpj($CpfCnpj,$dadosNFE->__get('CpfCnpj'));98 $this->vinculaElementofilho($nodoPai, $CpfCnpj);99 100 //InscricaoMunicipal tsInscricaoMunicipal 0-1101 $this->criaNodo($nodoPai, "InscricaoMunicipal", $dadosNFE->__get("InscricaoMunicipal"));102 //CodigoMunicipio tsCodigoMunicipioIbge103 $this->criaNodo($nodoPai, "CodigoMunicipio", $dadosNFE->__get("CodigoMunicipio"));104 }105 106 107 108 /**109 * Método responsável por montar object DOM da estrutura XML do tcCancelamentoNfse, segundo modelo da ABRASF110 *111 * @name tcCancelamentoNfse112 * @access private113 * @param object $CompNfse114 * @param array $dadosNFE115 * @return boolean116 */117 public function tcCancelamentoNfse(DOMElement $nfseCancelamento, PedidoCancelamento $dadosNFE)118 {119 120 //Criação do atributo versao para o nodo NfseCancelamento121 $versao = $this->documentoXML->createAttribute('versao');122 $versao_text = $this->documentoXML->createTextNode("2.01");123 $versao->appendChild($versao_text);124 $nfseCancelamento->appendChild($versao);125 126 127 $objConfirmacao = $dadosNFE->__get("ConfirmacaoCancelamento");128 129 //Se não estiver setado o Id do RPS130 if(!$objConfirmacao->__get('Id')){131 $Id = "NfseCancelamento_".uniqid();132 $objConfirmacao->__set('Id', $Id);133 $dadosNFE->__set("ConfirmacaoCancelamento", $objConfirmacao);134 } 135 136 137 //Montagem do Nodo Confirmacao, filho de NfseCancelamento138 //Criação do Confirmacao...filho do elemento NfseCancelamento139 $confirmacao= $this->documentoXML->createElement('Confirmacao');140 $nfseCancelamento->appendChild($confirmacao);141 $this->tcConfirmacaoCancelamento($confirmacao, $dadosNFE);142 143 if($this->assinaXML)144 {145 // Assina confirmação do cancelamento | Assina o nodo Confirmacao pelo ID dele 1-2146 $assinaturaNfe=$this->nfeAssinaturaDigital->assinaElementoDOM($this->documentoXML, $objConfirmacao->__get("Id"));147 $nfseCancelamento->appendChild($assinaturaNfe);148 }149 150 return $nfseCancelamento;151 }152 153 154 155 /**156 * Método responsável por montar object DOM da estrutura XML do tcDadosContrucaoCivil, segundo modelo da ABRASF157 *158 * @name tcConfirmacaoCancelamento159 * @access private160 * @param object $confirmacao161 * @param array $dadosNFE162 * @return boolean163 */164 public function tcConfirmacaoCancelamento(DOMElement $confirmacao, PedidoCancelamento $dadosNFE)165 { 166 167 $objConfirmacao = $dadosNFE->__get("ConfirmacaoCancelamento");168 169 //Criação do atributo Id para o nodo Confirmacao170 $attId = $this->documentoXML->createAttribute('Id');171 $attIdText = $this->documentoXML->createTextNode($objConfirmacao->__get("Id"));172 $attId->appendChild($attIdText);173 $confirmacao->appendChild($attId);174 175 //Montagem do Nodo Pedido, filho de Confirmacao176 //Criação do Pedido...filho do elemento Confirmacao... este nodo é uma cópia do pedido de entrada177 $pedido= $this->documentoXML->createElement('Pedido');178 $confirmacao->appendChild($pedido);179 $nfseCancelamento=$this->tcPedidoCancelamento($pedido, $dadosNFE);180 181 //Criação do DataHoraCancelamento...filho do elemento Confirmacao...182 $this->criaNodo($confirmacao, 'DataHora', $objConfirmacao->__get("DataHora"));183 184 return $confirmacao;185 }186 187 188 189 /**190 * Método responsável por montar object DOM da estrutura XML do tcDadosContrucaoCivil, segundo modelo da ABRASF191 *192 * @name tcPedidoCancelamento193 * @access private194 * @param object $CompNfse195 * @param array $dadosNFE196 * @return boolean197 */198 public function tcPedidoCancelamento(DOMElement $pedido, PedidoCancelamento $dadosNFE)199 {200 //InfPedidoCancelamento tcInfPedidoCancelamento 1-1201 $infPedidoCancelamento= $this->documentoXML->createElement('InfPedidoCancelamento');202 $pedido->appendChild($infPedidoCancelamento);203 204 //Se não estiver setado o Id do RPS205 if(!$dadosNFE->__get('Id')){206 $Id = "InfPedido_".uniqid();207 $dadosNFE->__set('Id', $Id);208 }209 210 // Id tsIdTag (Identificador da TAG a ser assinada)211 $idInfNfse = $this->documentoXML->createAttribute('Id');212 $idInfNfse_text = $this->documentoXML->createTextNode($dadosNFE->__get("Id"));213 $idInfNfse->appendChild($idInfNfse_text);214 $infPedidoCancelamento->appendChild($idInfNfse); 215 216 217 //IdentificacaoNfse tcIdentificacaoNfse 1-1218 $identificacaoNfse= $this->documentoXML->createElement('IdentificacaoNfse');219 $infPedidoCancelamento->appendChild($identificacaoNfse);220 $this->tcIdentificacaoNfse($identificacaoNfse, $dadosNFE->__get("IdentificacaoNfse"));221 222 //CodigoCancelamento tsCodigoCancelamentoNfse 1-1223 $this->criaNodo($infPedidoCancelamento, "CodigoCancelamento", $dadosNFE->__get("CodigoCancelamento"));224 225 226 return $pedido;227 } 228 229 230 231 232 /**233 * Método responsável por montar object DOM da estrutura XML do tcDadosContrucaoCivil, segundo modelo da ABRASF234 *235 * @name tcDadosContrucaoCivil236 * @access private237 * @param object $CompNfse238 * @param array $dadosNFE239 * @return boolean240 */241 private function tcDadosContrucaoCivil(DOMElement $CompNfse, ConstrucaoCivil $dadosNFE)242 {243 //CodigoObra tsCodigoObra 1-1244 $this->criaNodo($CompNfse, 'CodigoObra', $dadosNFE->__get('CodigoObra'));245 246 //Art tsArt 1-1247 $this->criaNodo($CompNfse, 'Art', $dadosNFE->__get('Art'));248 } 249 250 251 /**252 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcCompNfse, segundo modelo da ABRASF253 *254 * @name tcCompNfse255 * @access public256 * @param object $ListaNfse257 * @param array $dadosNFE258 * @return boolean259 */260 public function tcCompNfse(DOMElement $compNfse, Nfse $dadosNFE)261 {262 // Nfse tcNfse 1-1263 $Nfse= $this->documentoXML->createElement('Nfse');264 $compNfse->appendChild($Nfse);265 { //Criação do atributo xmlns para nodo EnviarLoteRpsResposta266 $versao = $this->documentoXML->createAttribute('versao');267 $versao_text = $this->documentoXML->createTextNode("2.01");268 $versao->appendChild($versao_text);269 $Nfse->appendChild($versao);270 }271 $this->tcNfse($Nfse, $dadosNFE);272 273274 // NfseCancelamento tcCancelamentoNfse 0-1275 if($dadosNFE->__get("NfseCancelamento") instanceof PedidoCancelamento)276 { 277 //Criação do NfseCancelamento...filho do elemento RetCancelamento278 $nfseCancelamento= $this->documentoXML->createElement('NfseCancelamento');279 $compNfse->appendChild($nfseCancelamento);280 $this->tcCancelamentoNfse($nfseCancelamento,$dadosNFE->__get("NfseCancelamento"));281 }282 283284 // NfseSubstituicao tcSubstituicaoNfse 0-1285 if($dadosNFE->__get("NfseSubstituidora") instanceof Nfse)286 {287 288 $nfseSubstituidora = $dadosNFE->__get("NfseSubstituidora");289 //Se não estiver setado o Id do RPS290 if(!$nfseSubstituidora->__get('Id')){291 $Id = "NfseSubstiudora_".uniqid();292 $nfseSubstituidora->__set('Id', $Id);293 }294 295 //SubstituicaoNfse tcInfSubstituicaoNfse 1-1296 $nfseSubstituicao= $this->documentoXML->createElement('NfseSubstituicao');297 $versao = $this->documentoXML->createAttribute('versao');298 $versao_text = $this->documentoXML->createTextNode("2.01");299 $versao->appendChild($versao_text); 300 $nfseSubstituicao->appendChild($versao); 301 $compNfse->appendChild($nfseSubstituicao);302 303 $nfseSubstituicaoNfse= $this->documentoXML->createElement('SubstituicaoNfse');304 $nfseSubstituicao->appendChild($nfseSubstituicaoNfse); 305 306 $nfseNfseSubstituidora= $this->documentoXML->createElement('NfseSubstituidora');307 $nfseSubstituicaoNfse->appendChild($nfseNfseSubstituidora);308 309 310 $numeroNfseSubstituidora = $nfseSubstituidora->__get("Numero");311 $numeroSubstituidora_text = $this->documentoXML->createTextNode($numeroNfseSubstituidora);312 $nfseNfseSubstituidora->appendChild($numeroSubstituidora_text);313 314 $idInfSubs = $this->documentoXML->createAttribute('Id');315 $idInfSubs_text = $this->documentoXML->createTextNode($nfseSubstituidora->__get('Id'));316 $idInfSubs->appendChild($idInfSubs_text); 317 $nfseSubstituicaoNfse->appendChild($idInfSubs);318 319 320 if($this->assinaXML)321 {322 // Signature Dsig:Signature 1-2323 $assinaturaNfe=$this->nfeAssinaturaDigital->assinaElementoDOM($this->documentoXML, $nfseSubstituidora->__get('Id'));324 //echo $assinaturaNfe;325 $nfseSubstituicao->appendChild($assinaturaNfe);326 } 327 }328 }329 330 /**331 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcNfse, segundo modelo da ABRASF332 *333 * @name tcNfse334 * @access private335 * @param object $CompNfse336 * @param array $dadosNFE337 * @return boolean338 */339 private function tcNfse(DOMElement $CompNfse, Nfse $dadosNFE)340 { 341 // InfNfse tcInfNfse 1-1342 $InfNfse= $this->documentoXML->createElement('InfNfse');343 $CompNfse->appendChild($InfNfse);344 345 //Se não estiver setado o Id do RPS346 if(!$dadosNFE->__get('Id')){347 $Id = "Nfse_".uniqid();348 $dadosNFE->__set('Id', $Id);349 } 350 351 // Id tsIdTag (Identificador da TAG a ser assinada)352 $idInfNfse = $this->documentoXML->createAttribute('Id');353 $idInfNfse_text = $this->documentoXML->createTextNode($dadosNFE->__get("Id"));354 $idInfNfse->appendChild($idInfNfse_text);355 $InfNfse->appendChild($idInfNfse);356 357 $this->tcInfNfse($InfNfse, $dadosNFE);358 359 if($this->assinaXML)360 {361 // Signature Dsig:Signature 1-2362 $assinaturaNfe=$this->nfeAssinaturaDigital->assinaElementoDOM($this->documentoXML, $dadosNFE->__get("Id"));363 //echo $assinaturaNfe;364 $CompNfse->appendChild($assinaturaNfe);365 }366 } 367 368 369 /**370 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcInfNfse, segundo modelo da ABRASF371 *372 * @name tcInfNfse373 * @access private374 * @param object $CompNfse375 * @param array $dadosNFE376 * @return boolean377 */378 private function tcInfNfse(DOMElement $InfNfse, Nfse $dadosNFE)379 {380 // Numero tsNumeroNfse 1-1381 $this->criaNodo($InfNfse, 'Numero', $dadosNFE->__get("Numero"));382 383 // CodigoVerificacao tsCodigoVerificacao 1-1384 $this->criaNodo($InfNfse, 'CodigoVerificacao', $dadosNFE->__get("CodigoVerificacao"));385 386 // DataEmissao Datetime 1-1387 $this->criaNodo($InfNfse, 'DataEmissao', $dadosNFE->__get("DataEmissao"));388 389 //NfseSubstituida tsNumeroNfse 0-1390 if( $dadosNFE->__get("NfseSubstituida") instanceof Nfse)391 {392 $NfsSubst = $dadosNFE->__get("NfseSubstituida"); 393 // DataEmissao Datetime 1-1394 $this->criaNodo($InfNfse, 'NfseSubstituida', $NfsSubst->__get("Numero")); 395 }396 397 // OutrasInformacoes tsOutrasInformacoes 0-1398 $this->criaNodo($InfNfse, 'OutrasInformacoes', $dadosNFE->__get("OutrasInformacoes")); 399 400 // IdentificacaoRps tcIdentificacaoRps 0-1401 $ValoresNfse= $this->documentoXML->createElement('ValoresNfse');402 $this->vinculaElementofilho($InfNfse, $ValoresNfse);403 $this->tcValoresNfse($ValoresNfse, $dadosNFE);404 405 // ValorCredito TsValor 0-1406 $this->criaNodo($InfNfse, 'ValorCredito', $dadosNFE->__get("ValorCredito"));407 408 // PrestadorServico tcDadosPrestador 1-1409 //Criação do Nodo Pai410 $DadosPrestador= $this->documentoXML->createElement('PrestadorServico');411 $this->vinculaElementofilho($InfNfse, $DadosPrestador);412 $this->tcDadosPrestador($DadosPrestador, $dadosNFE->__get("PrestadorServico")); 413 414 // OrgaoGerador tcIdentificacaoOrgaoGerador 1-1415 //Criação do Nodo Pai416 $OrgaoGerador= $this->documentoXML->createElement('OrgaoGerador');417 $this->vinculaElementofilho($InfNfse, $OrgaoGerador);418 $this->tcIdentificacaoOrgaoGerador($OrgaoGerador, $dadosNFE->__get("OrgaoGerador"));419 420 //DeclaracaoPrestacaoServico tsNumeroNfse 0-1 421 $DeclaracaoPrestacaoServico= $this->documentoXML->createElement('DeclaracaoPrestacaoServico');422 $this->vinculaElementofilho($InfNfse, $DeclaracaoPrestacaoServico);423 $this->tcDeclaracaoPrestacaoServico($DeclaracaoPrestacaoServico, $dadosNFE->__get("DeclaracaoPrestacaoServico"));424 } 425 426 /**427 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcIdentificacaoRps, segundo modelo da ABRASF428 *429 * @name tcIdentificacaoRps430 * @access private431 * @param object $CompNfse432 * @param array $dadosNFE433 * @return boolean434 */435 private function tcIdentificacaoRps(DOMElement $CompNfse, IdentificacaoRps $dadosNFE)436 {437 // Numero tsNumeroRps 1-1438 $this->criaNodo($CompNfse, 'Numero' , $dadosNFE->__get('Numero'));439 440 // Serie tsSerieRps 1-1441 $this->criaNodo($CompNfse, 'Serie' , $dadosNFE->__get('Serie'));442 443 // Tipo tsTipoRps 1-1444 $this->criaNodo($CompNfse, 'Tipo' , $dadosNFE->__get('Tipo'));445 } 446 447 448 /**449 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcInfRps, segundo modelo da ABRASF450 *451 * @name tcInfRps452 * @access public453 * @param object $nodoPai454 * @param array $dados455 * @return boolean456 */457 public function tcInfRps(DOMElement $nodoPai, Rps $dados)458 {459 $InfRpsId = $this->documentoXML->createAttribute('Id');460 $InfRpsId_text = $this->documentoXML->createTextNode($dados->__get('Id'));461 $InfRpsId->appendChild($InfRpsId_text);462 $nodoPai->appendChild($InfRpsId);463 464 $IdentificacaoRps= $this->documentoXML->createElement('IdentificacaoRps');465 $nodoPai->appendChild($IdentificacaoRps);466 //IdentificacaoRps 1-1467 $this->tcIdentificacaoRps($IdentificacaoRps, $dados->__get('IdentificacaoRps'));468 469 //DataEmissao 1-1470 $this->criaNodo($nodoPai,'DataEmissao', $dados->__get('DataEmissao'));471 472 //DataEmissao 1-1473 $this->criaNodo($nodoPai,'Status', $dados->__get('Status')); 474 475 if (($dados->__get('RpsSubstituido'))) {476 $RpsSubstituido = $this->documentoXML->createElement('RpsSubstituido');477 $nodoPai->appendChild($RpsSubstituido);478 $this->tcIdentificacaoRps($RpsSubstituido, $dados->__get('RpsSubstituido'));479 }480 481 } 482 483 484 /**485 * Método responsável por montar um tipo tsValor486 *487 * @name tsValor488 * @access private489 * @param object $CompNfse490 * @param array $dadosNFE491 * @return double492 */ 493 private function tsValor($valor, $decimals=2)494 {495 return number_format($valor, $decimals, ".", "");496 }497 498 499 /**500 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcValores, segundo modelo da ABRASF501 *502 * @name tcValores503 * @access private504 * @param object $CompNfse505 * @param array $dadosNFE506 * @return boolean507 */508 private function tcValores(DOMElement $CompNfse, Servico $dadosValores)509 {510 // ValorServicos tsValor 1-1511 $this->criaNodo($CompNfse, 'ValorServicos' , $this->tsValor( $dadosValores->__get("ValorServicos")));//::formataNumero($dadosNFE["ValorServicos"],2,false,".",""));512 513 // ValorDeducoes tsValor 0-1514 $this->criaNodo($CompNfse, 'ValorDeducoes' , $this->tsValor( $dadosValores->__get("ValorDeducoes")) );//::formataNumero($dadosNFE["ValorDeducoes"],2,false,".","")));515 516 // ValorPis tsValor 0-1517 $this->criaNodo($CompNfse, 'ValorPis' , $this->tsValor( $dadosValores->__get("ValorPis")) );//::formataNumero($dadosNFE["ValorPis"],2,false,".","")));518 519 // ValorCofins tsValor 0-1520 $this->criaNodo($CompNfse, 'ValorCofins' , $this->tsValor( $dadosValores->__get("ValorCofins")) );//::formataNumero($dadosNFE["ValorCofins"],2,false,".","")));521 522 // ValorInss tsValor 0-1523 $this->criaNodo($CompNfse, 'ValorInss' , $this->tsValor( $dadosValores->__get("ValorInss")) );//::formataNumero($dadosNFE["ValorInss"],2,false,".","")));524 525 // ValorIr tsValor 0-1526 $this->criaNodo($CompNfse, 'ValorIr' , $this->tsValor( $dadosValores->__get("ValorIr")) );//::formataNumero($dadosNFE["ValorIr"],2,false,".","")));527 528 // ValorCsll tsValor 0-1529 $this->criaNodo($CompNfse, 'ValorCsll' , $this->tsValor( $dadosValores->__get("ValorCsll")) );//::formataNumero($dadosNFE["ValorCsll"],2,false,".","")));530 531 // OutrasRetencoes tsValor 0-1532 $this->criaNodo($CompNfse, 'OutrasRetencoes' , $this->tsValor( $dadosValores->__get("OutrasRetencoes")) );//::formataNumero($dadosNFE["OutrasRetencoes"],2,false,".","")));533 534 // ValorIss tsValor 0-1535 $this->criaNodo($CompNfse, 'ValorIss' , $this->tsValor( $dadosValores->__get("ValorIss")) );//::formataNumero($dadosNFE["ValorIss"],2,false,".","")));536 537 // Aliquota tsAliquota 0-1538 $this->criaNodo($CompNfse, 'Aliquota' , $this->tsValor( $dadosValores->__get("Aliquota")) );//::formataNumero($dadosNFE["Aliquota"],4,false,".","")));539 540 // DescontoIncondicionado tsValor 0-1541 $this->criaNodo($CompNfse, 'DescontoIncondicionado' , $this->tsValor( $dadosValores->__get("DescontoIncondicionado")) );//::formataNumero($dadosNFE["DescontoIncondicionado"],2,false,".","")));542 543 // DescontoCondicionado tsValor 0-1544 $this->criaNodo($CompNfse, 'DescontoCondicionado' , $this->tsValor($dadosValores->__get("DescontoCondicionado")) );//::formataNumero($dadosNFE["DescontoCondicionado"],2,false,".",""));545 546 } 547 548 549 550 /**551 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcDadosServico, segundo modelo da ABRASF552 *553 * @name tcDadosServico554 * @access private555 * @param object $CompNfse556 * @param array $dadosNFE557 * @return boolean558 */559 public function tcDadosServico(DOMElement $CompNfse, Servico $dadosNFE)560 {561 $Valores= $this->documentoXML->createElement('Valores');562 $this->vinculaElementofilho($CompNfse, $Valores); 563 $this->tcValores($Valores, $dadosNFE);564 565 // ItemListaServico tsItemListaServico 1-1566 $this->criaNodo($CompNfse, 'IssRetido' , $dadosNFE->__get("IssRetido")); 567 568 // ItemListaServico tsItemListaServico 1-1569 $this->criaNodo($CompNfse, 'ResponsavelRetencao' , $dadosNFE->__get("ResponsavelRetencao"));570 // ItemListaServico tsItemListaServico 1-1571 $this->criaNodo($CompNfse, 'ItemListaServico' , $dadosNFE->__get("ItemListaServico"));572 573 // ItemListaServico tsItemListaServico 1-1574 $this->criaNodo($CompNfse, 'CodigoCnae' , $dadosNFE->__get("CodigoCnae"));575 // ItemListaServico tsItemListaServico 1-1576 $this->criaNodo($CompNfse, 'CodigoTributacaoMunicipio' , $dadosNFE->__get("CodigoTributacaoMunicipio")); 577 // ItemListaServico tsItemListaServico 1-1578 $this->criaNodo($CompNfse, 'Discriminacao' , $dadosNFE->__get("Discriminacao"));579 // ItemListaServico tsItemListaServico 1-1580 $this->criaNodo($CompNfse, 'CodigoMunicipio' , $dadosNFE->__get("CodigoMunicipio"));581 // ItemListaServico tsItemListaServico 1-1582 $this->criaNodo($CompNfse, 'CodigoPais' , $dadosNFE->__get("CodigoPais"));583 // ItemListaServico tsItemListaServico 1-1584 $this->criaNodo($CompNfse, 'ExigibilidadeISS' , $dadosNFE->__get("ExigibilidadeISS"));585 // ItemListaServico tsItemListaServico 1-1586 $this->criaNodo($CompNfse, 'MunicipioIncidencia' , $dadosNFE->__get("MunicipioIncidencia")); 587 588 // ItemListaServico tsItemListaServico 1-1589 $this->criaNodo($CompNfse, 'NumeroProcesso' , $dadosNFE->__get("MunicipioIncidencia")); 590 591 } 592 593 594 /**595 * Método responsável por montar object DOM da estrutura XML do tcIdentificacaoOrgaoGerador, segundo modelo da ABRASF596 *597 * @name tcIdentificacaoOrgaoGerador598 * @access private599 * @param object $CompNfse600 * @param array $dadosNFE601 * @return boolean602 */603 private function tcDeclaracaoPrestacaoServico(DOMElement $DeclaracaoPrestacaoServico, Rps $dados)604 {605 //Se não estiver setado o Id do RPS606 if(!$dados->__get('Id')){607 $Id = "Rps_".uniqid();608 $dados->__set('Id', $Id);609 }610 611 $InfDeclaracaoPrestacaoServico= $this->documentoXML->createElement('InfDeclaracaoPrestacaoServico');612 $this->vinculaElementofilho($DeclaracaoPrestacaoServico, $InfDeclaracaoPrestacaoServico); 613 614 $IdInfDelaracao = "InfDec_".$dados->__get('Id');615 $InfDeclaracaoPrestacaoServicoId = $this->documentoXML->createAttribute('Id');616 $InfDeclaracaoPrestacaoServicoId_text = $this->documentoXML->createTextNode($IdInfDelaracao);617 $InfDeclaracaoPrestacaoServicoId->appendChild($InfDeclaracaoPrestacaoServicoId_text);618 $InfDeclaracaoPrestacaoServico->appendChild($InfDeclaracaoPrestacaoServicoId); 619 620 $Rps= $this->documentoXML->createElement('Rps');621 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $Rps); 622 $this->tcInfRps($Rps, $dados);623 624 //Uf tsUf 1-1625 $this->criaNodo($InfDeclaracaoPrestacaoServico, 'Competencia' , $dados->__get("Competencia")); 626 627 //Servico 1-1628 $Servico = $this->documentoXML->createElement('Servico');629 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $Servico);630 $this->tcDadosServico($Servico, $dados->__get("Servico"));631 632 // IdentificacaoPrestador tcIdentificacaoPrestador 1-1633 $identificacaoPrestador= $this->documentoXML->createElement("Prestador");634 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $identificacaoPrestador);635 $prestador = $dados->__get("Prestador");636 $infPrestador = $prestador->__get("IdentificacaoPrestador");637 $this->tcIdentificacaoPessoa($identificacaoPrestador, $infPrestador); 638 639 //TomadorServico tcDadosTomador 0-1640 if($dados->__get("TomadorServico") instanceof TomadorServico)641 {642 $tomadorServico= $this->documentoXML->createElement("TomadorServico");643 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $tomadorServico);644 $this->tcDadosTomador($tomadorServico, $dados->__get("TomadorServico"));645 } 646 647 //Intermediario tcDadosIntermediario 0-1648 if($dados->__get("Intermediario") instanceof Intermediario)649 {650 $intermediario= $this->documentoXML->createElement("Intermediario");651 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $intermediario); 652 $this->tcDadosIntermediario($intermediario, $dados->__get("Intermediario"));653 }654 655 //ConstrucaoCivil tcDadosContrucaoCivil 0-1656 if($dados->__get("ConstrucaoCivil") instanceof ConstrucaoCivil)657 {658 $construcaoCivil= $this->documentoXML->createElement("ConstrucaoCivil");659 $this->vinculaElementofilho($InfDeclaracaoPrestacaoServico, $construcaoCivil);660 $this->tcDadosContrucaoCivil($construcaoCivil, $dados->__get("ConstrucaoCivil")); 661 } 662 663 //Uf tsUf 1-1664 $this->criaNodo($InfDeclaracaoPrestacaoServico, 'RegimeEspecialTributacao' , $dados->__get("RegimeEspecialTributacao"));665 //Uf tsUf 1-1666 $this->criaNodo($InfDeclaracaoPrestacaoServico, 'OptanteSimplesNacional' , $dados->__get("OptanteSimplesNacional")); 667 //Uf tsUf 1-1668 $this->criaNodo($InfDeclaracaoPrestacaoServico, 'IncentivoFiscal' , $dados->__get("IncentivoFiscal"));669 670 if($this->assinaXML)671 {672 // Signature Dsig:Signature 1-2673 $assinaturaDeclPrest=$this->nfeAssinaturaDigital->assinaElementoDOM($this->documentoXML, $IdInfDelaracao);674 //echo $assinaturaNfe;675 $DeclaracaoPrestacaoServico->appendChild($assinaturaDeclPrest);676 } 677 678 } 679 680 681 682 683 /**684 * Método responsável por montar object DOM da estrutura XML do tcIdentificacaoOrgaoGerador, segundo modelo da ABRASF685 *686 * @name tcIdentificacaoOrgaoGerador687 * @access private688 * @param object $CompNfse689 * @param array $dadosNFE690 * @return boolean691 */692 private function tcIdentificacaoOrgaoGerador(DOMElement $OrgaoGerador, OrgaoGerador $dados)693 {694 //CodigoMunicipio tsCodigoMunicipioIbge 1-1695 $this->criaNodo($OrgaoGerador, 'CodigoMunicipio' , $dados->__get("CodigoMunicipio"));696 697 //Uf tsUf 1-1698 $this->criaNodo($OrgaoGerador, 'Uf' , $dados->__get("Uf"));699 } 700 701 702 /**703 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcValoresNfse704 *705 * @name tcValoresNfse706 * @access private707 * @param object $CompNfse708 * @param array $dadosNFE709 * @return boolean710 */711 private function tcValoresNfse(DOMElement $ValoresNfse, Nfse $dadosNFE)712 {713 // ValorServicos tsValor 1-1714 $this->criaNodo($ValoresNfse, 'BaseCalculo' , $this->tsValor($dadosNFE->__get("BaseCalculo")));715 716 // ValorServicos tsValor 1-1717 $this->criaNodo($ValoresNfse, 'Aliquota' , $this->tsValor( $dadosNFE->__get("Aliquota")));718 // ValorServicos tsValor 1-1719 $this->criaNodo($ValoresNfse, 'ValorIss' , $this->tsValor( $dadosNFE->__get("ValorIss")));720 // ValorServicos tsValor 1-1721 $this->criaNodo($ValoresNfse, 'ValorLiquidoNfse' , $this->tsValor( $dadosNFE->__get("ValorLiquidoNfse"))); 722723 }724 725 726 /**727 * Método responsável por montar object DOM da estrutura XML do tcDadosPrestador tcValores, segundo modelo da ABRASF728 *729 * @name tcDadosPrestador730 * @access private731 * @param object $CompNfse732 * @param array $dadosNFE733 * @return boolean734 */735 private function tcDadosPrestador(DOMElement $tcDadosPrestador, Prestador $dadosPrestador)736 {737 // IdentificacaoPrestador tcIdentificacaoPrestador 1-1738 $identificacaoPrestador= $this->documentoXML->createElement("IdentificacaoPrestador");739 $this->vinculaElementofilho($tcDadosPrestador, $identificacaoPrestador);740 $this->tcIdentificacaoPessoa($identificacaoPrestador, $dadosPrestador->__get("IdentificacaoPrestador"));741 742 // RazaoSocial tsRazaoSocial 1-1743 $this->criaNodo($tcDadosPrestador, 'RazaoSocial' , $dadosPrestador->__get("RazaoSocial"));744 745 // NomeFantasia tsNomeFantasia 0-1746 $this->criaNodo($tcDadosPrestador, 'NomeFantasia' , $dadosPrestador->__get("NomeFantasia"));747 748 // Endereco tcEndereco 1-1749 if($dadosPrestador->__get('Endereco'))750 {751 $Endereco= $this->documentoXML->createElement('Endereco');752 $this->vinculaElementofilho($tcDadosPrestador, $Endereco);753 // Endereco tcEndereco 1-1754 $this->tcEndereco($Endereco, $dadosPrestador->__get('Endereco'));755 }756 // Contato tcContato 0-1757 if($dadosPrestador->__get('Contato'))758 {759 $Contato= $this->documentoXML->createElement('Contato');760 $this->vinculaElementofilho($tcDadosPrestador, $Contato);761 // Endereco tcEndereco 1-1762 $this->tcContato($Contato,$dadosPrestador->__get('Contato'));763 } 764 } 765 766 767 /**768 * Método responsável por montar object DOM da estrutura XML do tcDadosTomador, segundo modelo da ABRASF769 *770 * @name tcDadosTomador771 * @access private772 * @param object $CompNfse773 * @param array $dadosNFE774 * @return boolean775 */776 private function tcDadosTomador(DOMElement $tcDadosTomador, TomadorServico $dadosTomador)777 {778 779 // IdentificacaoTomador tcIdentificacaoPessoa 1-1780 if($dadosTomador->__get("IdentificacaoTomador") instanceof IdentificacaoPessoa)781 {782 $identificacaoTomador= $this->documentoXML->createElement("IdentificacaoTomador");783 $this->vinculaElementofilho($tcDadosTomador, $identificacaoTomador);784 $this->tcIdentificacaoPessoa($identificacaoTomador, $dadosTomador->__get("IdentificacaoTomador"));785 }786 787 // RazaoSocial tsRazaoSocial 1-1788 $this->criaNodo($tcDadosTomador, 'RazaoSocial' , $dadosTomador->__get("RazaoSocial"));789 790 // Endereco tcEndereco 1-1791 if($dadosTomador->__get('Endereco'))792 {793 $Endereco= $this->documentoXML->createElement('Endereco');794 $this->vinculaElementofilho($tcDadosTomador, $Endereco);795 // Endereco tcEndereco 1-1796 $this->tcEndereco($Endereco, $dadosTomador->__get('Endereco'));797 }798 // Contato tcContato 0-1799 if($dadosTomador->__get('Contato'))800 {801 $Contato= $this->documentoXML->createElement('Contato');802 $this->vinculaElementofilho($tcDadosTomador, $Contato);803 // Endereco tcEndereco 1-1804 $this->tcContato($Contato,$dadosTomador->__get('Contato'));805 } 806 } 807 808 809 /**810 * Método responsável por montar object DOM da estrutura XML do tcIdentificacaoIntermediarioServico, segundo modelo da ABRASF811 *812 * @name tcDadosIntermediario813 * @access private814 * @param object $CompNfse815 * @param array $dadosNFE816 * @return boolean817 */818 private function tcDadosIntermediario(DOMElement $CompNfse, Intermediario $dadosNFE)819 {820 // IdentificacaoPrestador tcIdentificacaoPrestador 1-1821 $identificacaoIntermediario= $this->documentoXML->createElement("IdentificacaoIntermediario");822 $this->vinculaElementofilho($CompNfse, $identificacaoIntermediario);823 $this->tcIdentificacaoPessoa($identificacaoIntermediario, $dadosNFE->__get("IdentificacaoIntermediario"));824 825 //RazaoSocial tsRazaoSocial 1-1826 $this->criaNodo($CompNfse, 'RazaoSocial', $dadosNFE->__get('RazaoSocial'));827 } 828 829 830 /**831 * Método responsável por montar object DOM da estrutura XML do tcContato, segundo modelo da ABRASF832 *833 * @name tcContato834 * @access private835 * @param object $CompNfse836 * @param array $dadosNFE837 * @return boolean838 */839 private function tcContato(DOMElement $CompNfse, Contato $dados)840 {841 if(!($dados->__get("Telefone")) || !($dados->__get("Email")))842 {843 //Telefone tsTelefone 0-1844 if(!($dados->__get("Telefone"))){845 $this->criaNodo($CompNfse, 'Telefone', $dados->__get("Telefone"));846 }847 848 //Email tsEmail849 if(!($dados->__get("Email"))){850 $this->criaNodo($CompNfse, 'Email', $dados->__get("Email"));851 }852 }853 } 854 855 856 /**857 * Método responsável por montar object DOM da estrutura XML do tcEndereco, segundo modelo da ABRASF858 *859 * @name tcEndereco860 * @access private861 * @param object $nodoPai862 * @param array $dadosNFE863 * @return boolean864 */865 private function tcEndereco(DOMElement $nodoPai, Endereco $dadosEndereco)866 {867868 //Endereco tsEndereco 0-1 Endereço869 $this->criaNodo($nodoPai, 'Endereco' , $dadosEndereco->__get("Endereco"));870 //Numero tsNumeroEndereco 0-1 Número do endereço871 $this->criaNodo($nodoPai, 'Numero' , $dadosEndereco->__get("Numero"));872873 //Complemento tsComplementoEndereco 0-1 Complemento do Endereço874 $this->criaNodo($nodoPai, 'Complemento' , $dadosEndereco->__get("Complemento"));875876 //Bairro tsBairro 0-1 Nome do bairro877 $this->criaNodo($nodoPai, 'Bairro' , $dadosEndereco->__get("Bairro"));878879 //CodigoMunicipio tsCodigoMunicipioIbge 0-1 Código da cidade880 $this->criaNodo($nodoPai, 'CodigoMunicipio' , $dadosEndereco->__get("CodigoMunicipio"));881882 //Uf tsUf 0-1 Sigla do estado883 $this->criaNodo($nodoPai, 'Uf' , $dadosEndereco->__get("Uf"));884 885 //Cep tsCodPais 0-1 CEP da localidade886 $this->criaNodo($nodoPai, 'CodigoPais' , $dadosEndereco->__get("CodigoPais")); 887 888 //Cep tsCep 0-1 CEP da localidade889 $this->criaNodo($nodoPai, 'Cep' , str_replace("-",",",$dadosEndereco->__get("Cep")));890 } 891 892 893 894 /**895 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcIdentificacaoPrestador, segundo modelo da ABRASF896 *897 * @name tcIdentificacaoPrestador898 * @access public899 * @param object $nodoPai900 * @param array $dados901 * @return boolean902 */903 public function tcIdentificacaoPessoa(DOMElement $nodoPai, IdentificacaoPessoa $dados)904 {905 $CpfCnpj= $this->documentoXML->createElement('CpfCnpj');906 $this->vinculaElementofilho($nodoPai, $CpfCnpj); 907 $this->tcCpfCnpj($CpfCnpj,$dados->__get('CpfCnpj')); 908 $this->criaNodo($nodoPai,'InscricaoMunicipal',$dados->__get('InscricaoMunicipal'));909 }910 911 /**912 * Método responsável por montar object DOM da estrutura XML do tcCpfCnpj, segundo modelo da ABRASF913 *914 * @name tcCpfCnpj915 * @access private916 * @param object $nodoPai917 * @param array $dadosNFE918 * @return boolean919 */920 private function tcCpfCnpj(DOMElement $nodoPai, CpfCnpj $cpfCnpj)921 {922 //Se num_cnpj_cpf_dest tiver 11 caracteres...923 if(strlen($cpfCnpj->__get("Cpf"))==11){924 //..é cCPF925 $this->criaNodo($nodoPai, "Cpf" , $cpfCnpj->__get("Cpf"));926 } else {927 //...senão é CNPJ928 $label="Cnpj";929 $this->criaNodo($nodoPai, "Cnpj" , $cpfCnpj->__get("Cnpj"));930 }931 } 932 933 934 935 /**936 * Método utilitário para criar umo nodo Simples com um valor e associá-lo a um elemento pai937 *938 * @name tcListaNotasFiscais939 * @access private940 * @param object $elementoPai941 * @param array $labelFilho942 * @param array $valorFilho943 */944 private function tcListaNotasFiscais(DOMElement $elementoPai,$ListaNotasFiscais)945 {946 // InfNfse tcInfNfse 1-1947 $elementoListaNotasFiscais= $this->documentoXML->createElement('ListaNotasFiscais');948 $elementoPai->appendChild($elementoListaNotasFiscais);949 foreach( $ListaNotasFiscais['NumeroNfse'] as $numNfse)950 {951 $this->criaNodo($elementoListaNotasFiscais, 'NumeroNfse' , $numNfse);952 }953 }954 /**955 * Método para adaptação dos códigos de Sim/Não do modelo Abrasf para modelo padrão DMS956 *957 * @name padraoSimNaoAbrasf958 * @access public959 * @param string $valor960 * @return string961 */962 public function padraoSimNaoAbrasf($valor)963 {964 //No modelo ABRASF 2 = não...965 if((int)$valor==2 || empty($valor)){966 //... que é = 'N' no DMS )967 return 'N';968 }969 //retorna valor original970 return 'S';971 }972 /**973 * Método para capturar o CNPJ ou CPF informado em um campo de escolha entre as duas possibilidades974 *975 * @name padraoCpfCnpjAbrasf976 * @access public977 * @param string $tagXml978 * @return integer979 */980 public function padraoCpfCnpjAbrasf($tagXml)981 {982 //Capturar código do tomador de serviços DMS na tabela sintaxt_dvr_nfa_destinatario983 $cpf_cnpj=$tagXml["Cnpj"];984 //Se CNPJ não informado985 if($cpf_cnpj==''){986 //Captura o CPF987 $cpf_cnpj=$tagXml["Cpf"];988 }989 return $cpf_cnpj;990 }991 992 993 994 995 /**996 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF997 *998 * @name tcMensagemRetorno999 * @access private1000 * @param object $elementoPai1001 * @param MensagemRetorno $MensagemRetorno1002 * @return void1003 */1004 private function tcMensagemRetorno(DOMElement $elementoPai, MensagemRetorno $MensagemRetorno)1005 {1006 // MensagemRetorno tcMensagemRetorno 1-N1007 $ElementMensagemRetorno = $this->criaElemento("MensagemRetorno");1008 $this->vinculaElementofilho($elementoPai, $ElementMensagemRetorno); 1009 1010 // ValorServicos tsValor 1-11011 $this->criaNodo($ElementMensagemRetorno, 'Codigo' , $MensagemRetorno->__get('Codigo'));1012 // ValorServicos tsValor 1-11013 $this->criaNodo($ElementMensagemRetorno, 'Mensagem' , substr($MensagemRetorno->__get('Mensagem'),0,200));1014 // ValorServicos tsValor 1-11015 $this->criaNodo($ElementMensagemRetorno, 'Correcao' , $MensagemRetorno->__get('Correcao'));1016 }1017 1018 1019 /**1020 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1021 *1022 * @name tcMensagemRetorno1023 * @access private1024 * @param object $elementoPai1025 * @param MensagemRetorno $MensagemRetorno1026 * @return void1027 */1028 private function tcMensagemRetornoLote(DOMElement $elementoPai, MensagemRetornoLote $MensagemRetorno)1029 {1030 // MensagemRetorno tcMensagemRetorno 1-N1031 $ElementMensagemRetorno = $this->criaElemento("MensagemRetorno");1032 $this->vinculaElementofilho($elementoPai, $ElementMensagemRetorno);1033 1034 1035 $IdentificacaoRps= $this->documentoXML->createElement('IdentificacaoRps');1036 $ElementMensagemRetorno->appendChild($IdentificacaoRps);1037 //IdentificacaoRps 1-11038 $this->tcIdentificacaoRps($IdentificacaoRps, $MensagemRetorno->__get('IdentificacaoRps'));1039 1040 // ValorServicos tsValor 1-11041 $this->criaNodo($ElementMensagemRetorno, 'Codigo' , $MensagemRetorno->__get('Codigo'));1042 // ValorServicos tsValor 1-11043 $this->criaNodo($ElementMensagemRetorno, 'Mensagem' , substr($MensagemRetorno->__get('Mensagem'),0,200));1044 } 1045 1046 1047 /**1048 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1049 *1050 * @name EnviarLoteRpsResposta1051 * @access private1052 * @param object $objLoteRps1053 * @param MensagemRetorno $MensagemRetorno1054 * @return void1055 */ 1056 public function EnviarLoteRpsResposta(LoteRps $objLoteRps)1057 {1058 //EnviarLoteRpsResposta 1-11059 $this->setTagServico('EnviarLoteRpsResposta');1060 $EnviarLoteRpsResposta= $this->criaCabecalhoXMLResposta();1061 1062 //Protocolo está setado, ou seja, Lote recebido com sucesso1063 if($objLoteRps->__get('Protocolo'))1064 {1065 //NumeroLote TsNumeroLote 1-1 LoteRps1066 $this->criaNodo($EnviarLoteRpsResposta,'NumeroLote', $objLoteRps->__get('NumeroLote')); 1067 1068 //DataRecebimento Datetime 1-1 LoteRps1069 $this->criaNodo($EnviarLoteRpsResposta,'DataRecebimento', $objLoteRps->__get('DataRecebimento'), true);1070 1071 //DataRecebimento Datetime 1-1 LoteRps1072 $this->criaNodo($EnviarLoteRpsResposta,'Protocolo', $objLoteRps->__get('Protocolo'), true); 1073 }1074 // Lote recebido com erro1075 else {1076 //Cria nodo ListaMensagemRetorno1077 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1078 $this->vinculaElementofilho($EnviarLoteRpsResposta, $ElementListaMensagemRetorno);1079 1080 //Captura as mensagens de retorno1081 foreach($objLoteRps->__get("ListaMensagemRetorno") as $objMensagemRetorno)1082 {1083 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1084 }1085 }1086 1087 //Retorna o conteúdo do arquivo1088 return utf8_encode($this->retornaConteudoArquivo()); 1089 }1090 1091 1092 /**1093 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1094 *1095 * @name EnviarLoteRpsSincronoResposta1096 * @access private1097 * @param object $objLoteRps1098 * @param MensagemRetorno $MensagemRetorno1099 * @return void1100 */ 1101 public function EnviarLoteRpsSincronoResposta(LoteRps $objLoteRps)1102 {1103 //EnviarLoteRpsResposta 1-11104 $this->setTagServico('EnviarLoteRpsSincronoResposta');1105 $EnviarLoteRpsResposta= $this->criaCabecalhoXMLResposta(); 1106 1107 //Protocolo está setado e Lista NFse carregada, ou seja, Lote recebido com sucesso1108 if($objLoteRps->__get('Protocolo') && $objLoteRps->__get('ListaNfse') instanceof ListaNfse)1109 {1110 //NumeroLote TsNumeroLote 1-1 LoteRps1111 $this->criaNodo($EnviarLoteRpsResposta,'NumeroLote', $objLoteRps->__get('NumeroLote'));1112 1113 //DataRecebimento Datetime 1-1 LoteRps1114 $this->criaNodo($EnviarLoteRpsResposta,'DataRecebimento', $objLoteRps->__get('DataRecebimento'), true);1115 1116 //DataRecebimento Datetime 1-1 LoteRps1117 $this->criaNodo($EnviarLoteRpsResposta,'Protocolo', $objLoteRps->__get('Protocolo'), true); 1118 1119 // ListaNfse ListaNfse1120 $elementListaNfse= $this->documentoXML->createElement("ListaNfse");1121 $this->vinculaElementofilho($EnviarLoteRpsResposta, $elementListaNfse); 1122 $listaNfse = $objLoteRps->__get('ListaNfse');1123 1124 //Montando a lista de NFSe1125 foreach($listaNfse->__get("ListaNfse") as $objNfse)1126 {1127 // Nfse tcNfse 1-11128 $CompNfse= $this->documentoXML->createElement('CompNfse'); 1129 $this->vinculaElementofilho($elementListaNfse, $CompNfse); 1130 1131 $this->tcCompNfse($CompNfse, $objNfse);1132 }1133 //Se houver mensagens de alerta setados...1134 if( ($listaNfse->__get('ListaMensagemAlertaRetorno')) )1135 {1136 $elementListaMensagemAlertaRetorno= $this->documentoXML->createElement("ListaMensagemAlertaRetorno");1137 $this->vinculaElementofilho($elementListaNfse, $elementListaMensagemAlertaRetorno); 1138 1139 //Captura as mensagens de retorno1140 foreach($objLoteRps->__get("ListaMensagemRetorno") as $objMensagemRetorno)1141 {1142 $this->tcMensagemRetorno($elementListaMensagemAlertaRetorno, $objMensagemRetorno);1143 }1144 }1145 }1146 //Se houver mensagens de alerta setados...1147 else if( ($objLoteRps->__get('ListaMensagemRetorno')) )1148 {1149 //Cria nodo ListaMensagemRetorno1150 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1151 $this->vinculaElementofilho($EnviarLoteRpsResposta, $ElementListaMensagemRetorno);1152 1153 //Captura as mensagens de retorno1154 foreach($objLoteRps->__get("ListaMensagemRetorno") as $objMensagemRetorno)1155 {1156 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1157 }1158 } 1159 1160 //Se houver mensagens de alerta setados...1161 else if( ($objLoteRps->__get('ListaMensagemRetornoLote')) )1162 {1163 //Cria nodo ListaMensagemRetorno1164 $ElementListaMensagemRetornoLote = $this->criaElemento("ListaMensagemRetornoLote");1165 $this->vinculaElementofilho($EnviarLoteRpsResposta, $ElementListaMensagemRetornoLote);1166 1167 //Captura as mensagens de retorno1168 foreach($objLoteRps->__get("ListaMensagemRetornoLote") as $objMensagemRetornoLote)1169 {1170 $this->tcMensagemRetornoLote($ElementListaMensagemRetornoLote, $objMensagemRetornoLote);1171 }1172 }1173 1174 //Retorna o conteúdo do arquivo1175 return utf8_encode($this->retornaConteudoArquivo());1176 } 1177 1178 1179 /**1180 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1181 *1182 * @name GerarNfseResposta1183 * @access private1184 * @param object $ListaNfse1185 * @param MensagemRetorno $MensagemRetorno1186 * @return void1187 */ 1188 function GerarNfseResposta(ListaNfse $ListaNfse)1189 { 1190 //EnviarLoteRpsResposta 1-11191 $this->setTagServico('GerarNfseResposta');1192 $GerarNfseResposta= $this->criaCabecalhoXMLResposta(); 1193 1194 1195 //Lista NFSE não está vazia(Gerou a nfse)1196 if(($ListaNfse->__get('ListaNfse')))1197 {1198 // ListaNfse ListaNfse1199 $elementListaNfse= $this->documentoXML->createElement("ListaNfse");1200 $this->vinculaElementofilho($GerarNfseResposta, $elementListaNfse); 1201 1202 //Montando a lista de NFSe1203 foreach($ListaNfse->__get("ListaNfse") as $objNfse)1204 {1205 // Nfse tcNfse 1-11206 $CompNfse= $this->documentoXML->createElement('CompNfse'); 1207 $this->vinculaElementofilho($elementListaNfse, $CompNfse); 1208 1209 $this->tcCompNfse($CompNfse, $objNfse);1210 }1211 1212 //Se houver mensagens de alerta setados...1213 if( ($ListaNfse->__get('ListaMensagemAlertaRetorno')) )1214 {1215 $elementListaMensagemAlertaRetorno= $this->documentoXML->createElement("ListaMensagemAlertaRetorno");1216 $this->vinculaElementofilho($elementListaNfse, $elementListaMensagemAlertaRetorno); 1217 1218 //Captura as mensagens de retorno1219 foreach($ListaNfse->__get("ListaMensagemAlertaRetorno") as $objMensagemRetorno)1220 {1221 $this->tcMensagemRetorno($elementListaMensagemAlertaRetorno, $objMensagemRetorno);1222 }1223 } 1224 }1225 //Lista NFSE está vazia(Não Gerou a nfse)1226 else1227 {1228 //Cria nodo ListaMensagemRetorno1229 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1230 $this->vinculaElementofilho($GerarNfseResposta, $ElementListaMensagemRetorno);1231 1232 //Captura as mensagens de retorno1233 foreach($ListaNfse->__get("ListaMensagemRetorno") as $objMensagemRetorno)1234 {1235 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1236 } 1237 }1238 1239 //Retorna o conteúdo do arquivo1240 return utf8_encode($this->retornaConteudoArquivo()); 1241 } 1242 1243 1244 1245 /**1246 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1247 *1248 * @name EnviarLoteRpsSincronoResposta1249 * @access private1250 * @param object $objLoteRps1251 * @param MensagemRetorno $MensagemRetorno1252 * @return void1253 */1254 public function ConsultarLoteRpsResposta(LoteRps $objLoteRps)1255 {1256 //EnviarLoteRpsResposta 1-11257 $this->setTagServico('ConsultarLoteRpsResposta');1258 $ConsultarLoteRpsResposta= $this->criaCabecalhoXMLResposta();1259 1260 // ValorServicos tsValor 1-11261 $this->criaNodo($ConsultarLoteRpsResposta, 'Situacao' , $objLoteRps->__get('Situacao')); 1262 1263 //Lote gerou NFSE - Lista NFSE não está vazia(Gerou a nfse)1264 1265 if(($objLoteRps->__get('ListaNfse')))1266 {1267 $ListaNfse = $objLoteRps->__get('ListaNfse');1268 1269 // ListaNfse ListaNfse1270 $elementListaNfse= $this->documentoXML->createElement("ListaNfse");1271 $this->vinculaElementofilho($ConsultarLoteRpsResposta, $elementListaNfse);12721273 //Montando a lista de NFSe1274 foreach($ListaNfse->__get("ListaNfse") as $objNfse)1275 {1276 // Nfse tcNfse 1-11277 $CompNfse= $this->documentoXML->createElement('CompNfse');1278 $this->vinculaElementofilho($elementListaNfse, $CompNfse);1279 1280 $this->tcCompNfse($CompNfse, $objNfse);1281 }1282 1283 //Se houver mensagens de alerta setados...1284 if( ($ListaNfse->__get('ListaMensagemAlertaRetorno')) )1285 {1286 $elementListaMensagemAlertaRetorno= $this->documentoXML->createElement("ListaMensagemAlertaRetorno");1287 $this->vinculaElementofilho($elementListaNfse, $elementListaMensagemAlertaRetorno);1288 1289 //Captura as mensagens de retorno1290 foreach($ListaNfse->__get("ListaMensagemAlertaRetorno") as $objMensagemRetorno)1291 {1292 $this->tcMensagemRetorno($elementListaMensagemAlertaRetorno, $objMensagemRetorno);1293 }1294 }1295 } 1296 //Lote NÃO gerou NFSE - Lista NFSE está vazia(NÃO Gerou a nfse)1297 else if( ($objLoteRps->__get('ListaMensagemRetorno')) )1298 {1299 //Cria nodo ListaMensagemRetorno1300 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1301 $this->vinculaElementofilho($ConsultarLoteRpsResposta, $ElementListaMensagemRetorno);1302 1303 //Captura as mensagens de retorno1304 foreach($objLoteRps->__get("ListaMensagemRetorno") as $objMensagemRetorno)1305 {1306 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1307 }1308 }1309 1310 //Se houver mensagens de alerta setados...1311 else if( ($objLoteRps->__get('ListaMensagemRetornoLote')) )1312 {1313 //Cria nodo ListaMensagemRetorno1314 $ElementListaMensagemRetornoLote = $this->criaElemento("ListaMensagemRetornoLote");1315 $this->vinculaElementofilho($ConsultarLoteRpsResposta, $ElementListaMensagemRetornoLote);1316 1317 //Captura as mensagens de retorno1318 foreach($objLoteRps->__get("ListaMensagemRetornoLote") as $objMensagemRetornoLote)1319 {1320 $this->tcMensagemRetornoLote($ElementListaMensagemRetornoLote, $objMensagemRetornoLote);1321 }1322 } 1323 1324 //Retorna o conteúdo do arquivo1325 return utf8_encode($this->retornaConteudoArquivo()); 1326 } 1327 1328 1329 /**1330 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1331 *1332 * @name ConsultarNfseRpsResposta1333 * @access private1334 * @param object $ListaNfse1335 * @param MensagemRetorno $MensagemRetorno1336 * @return void1337 */1338 public function ConsultarNfseRpsResposta(ListaNfse $ListaNfse)1339 {1340 //EnviarLoteRpsResposta 1-11341 $this->setTagServico('ConsultarNfseRpsResposta');1342 $ConsultarNfseRpsResposta= $this->criaCabecalhoXMLResposta();1343 1344 //Lista NFSE não está vazia(Gerou a nfse)1345 if(($ListaNfse->__get('ListaNfse')))1346 {1347 //Captura o primeiro elemento...1348 $objListaNfse = $ListaNfse->__get('ListaNfse');1349 $objNfse = current($objListaNfse);1350 // Nfse tcNfse 1-11351 $CompNfse= $this->documentoXML->createElement('CompNfse');1352 $this->vinculaElementofilho($ConsultarNfseRpsResposta, $CompNfse);1353 1354 $this->tcCompNfse($CompNfse, $objNfse); 1355 } 1356 else 1357 {1358 //Cria nodo ListaMensagemRetorno1359 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1360 $this->vinculaElementofilho($ConsultarNfseRpsResposta, $ElementListaMensagemRetorno);1361 1362 //Captura as mensagens de retorno1363 foreach($ListaNfse->__get("ListaMensagemRetorno") as $objMensagemRetorno)1364 {1365 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1366 } 1367 }1368 1369 //Retorna o conteúdo do arquivo1370 return utf8_encode($this->retornaConteudoArquivo()); 1371 }1372 1373 1374 /**1375 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1376 *1377 * @name ConsultarNfseRpsResposta1378 * @access private1379 * @param object $ListaNfse1380 * @param MensagemRetorno $MensagemRetorno1381 * @return void1382 */1383 public function CancelarNfseResposta(PedidoCancelamento $pedidoCancelamento)1384 {1385 //EnviarLoteRpsResposta 1-11386 $this->setTagServico('CancelarNfseResposta');1387 $CancelarNfseResposta= $this->criaCabecalhoXMLResposta(); 1388 1389 if($pedidoCancelamento->__get("ConfirmacaoCancelamento") instanceof ConfirmacaoCancelamento)1390 {1391 //Cria nodo ListaMensagemRetorno1392 $ElementRetCancelamento = $this->criaElemento("RetCancelamento");1393 $this->vinculaElementofilho($CancelarNfseResposta, $ElementRetCancelamento); 1394 1395 //Cria nodo ListaMensagemRetorno1396 $ElementNfseCancelamento = $this->criaElemento("NfseCancelamento");1397 $this->vinculaElementofilho($ElementRetCancelamento, $ElementNfseCancelamento); 1398 $this->tcCancelamentoNfse($ElementNfseCancelamento, $pedidoCancelamento);1399 1400 }1401 else1402 {1403 //Cria nodo ListaMensagemRetorno1404 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1405 $this->vinculaElementofilho($CancelarNfseResposta, $ElementListaMensagemRetorno);1406 1407 //Captura as mensagens de retorno1408 foreach($pedidoCancelamento->__get("ListaMensagemRetorno") as $objMensagemRetorno)1409 {1410 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1411 } 1412 }1413 1414 //Retorna o conteúdo do arquivo1415 return utf8_encode($this->retornaConteudoArquivo()); 1416 1417 }1418 1419 1420 1421 /**1422 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1423 *1424 * @name ConsultarNfseFaixaResposta1425 * @access private1426 * @param object $objLoteRps1427 * @param MensagemRetorno $MensagemRetorno1428 * @return void1429 */1430 public function ConsultarNfseFaixaResposta(ListaNfse $ListaNfse)1431 {1432 //EnviarLoteRpsResposta 1-11433 $this->setTagServico('ConsultarNfseFaixaResposta');1434 $ConsultarNfseFaixaResposta= $this->criaCabecalhoXMLResposta();14351436 1437 //Lista NFSE não está vazia(Gerou a nfse)1438 if(($ListaNfse->__get('ListaNfse')))1439 {1440 //Captura o primeiro elemento...1441 $objListaNfse = $ListaNfse->__get('ListaNfse');1442 1443 // ListaNfse ListaNfse1444 $elementListaNfse= $this->documentoXML->createElement("ListaNfse");1445 $this->vinculaElementofilho($ConsultarNfseFaixaResposta, $elementListaNfse); 1446 1447 //Montando a lista de NFSe1448 foreach($objListaNfse as $objNfse)1449 {1450 // Nfse tcNfse 1-11451 $CompNfse= $this->documentoXML->createElement('CompNfse');1452 $this->vinculaElementofilho($elementListaNfse, $CompNfse); 1453 $this->tcCompNfse($CompNfse, $objNfse);1454 } 1455 1456 //DataRecebimento Datetime 1-1 LoteRps1457 $this->criaNodo($elementListaNfse,'Pagina', $ListaNfse->__get('Pagina')); 1458 }1459 else1460 {1461 //Cria nodo ListaMensagemRetorno1462 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1463 $this->vinculaElementofilho($ConsultarNfseFaixaResposta, $ElementListaMensagemRetorno);1464 1465 //Captura as mensagens de retorno1466 foreach($ListaNfse->__get("ListaMensagemRetorno") as $objMensagemRetorno)1467 {1468 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1469 }1470 } 1471 1472 1473 //Retorna o conteúdo do arquivo1474 return utf8_encode($this->retornaConteudoArquivo());1475 } 1476 1477 1478 1479 /**1480 * Método responsável por montar object DOM da estrutura XML do tipoComplexo tcMensagemRetorno, segundo modelo da ABRASF1481 *1482 * @name ConsultarNfseFaixaResposta1483 * @access private1484 * @param object $objLoteRps1485 * @param MensagemRetorno $MensagemRetorno1486 * @return void1487 */1488 public function SubstituirNfseResposta(PedidoSubstituicao $objPedidoSubstituicao)1489 {1490 //EnviarLoteRpsResposta 1-11491 $this->setTagServico('SubstituirNfseResposta');1492 $SubstituirNfseResposta= $this->criaCabecalhoXMLResposta(); 1493 1494 1495 if($objPedidoSubstituicao->__get("NfseSubstituidora") instanceof Nfse)1496 {1497 //Cria nodo ListaMensagemRetorno1498 $ElementRetSubstituicao = $this->criaElemento("RetSubstituicao");1499 $this->vinculaElementofilho($SubstituirNfseResposta, $ElementRetSubstituicao);1500 1501 1502 //Cria nodo NfseSubstituida1503 $ElementNfseSubstituido = $this->criaElemento("NfseSubstituida");1504 $this->vinculaElementofilho($ElementRetSubstituicao, $ElementNfseSubstituido); 1505 // Nfse tcNfse 1-11506 $CompNfse= $this->documentoXML->createElement('CompNfse');1507 $this->vinculaElementofilho($ElementNfseSubstituido, $CompNfse);1508 //Compnfse1509 $this->tcCompNfse($CompNfse, $objPedidoSubstituicao->__get("NfseSubstituida")); 15101511 //ListaMensagemAlertaRetorno 1512 if( $objPedidoSubstituicao->__get("ListaMensagemAlertaRetorno"))1513 {1514 //Cria nodo ListaMensagemRetorno1515 $ElementListaMensagemAlertaRetorno = $this->criaElemento("ListaMensagemAlertaRetorno");1516 $this->vinculaElementofilho($ElementNfseSubstituido, $ElementListaMensagemAlertaRetorno);1517 1518 //Captura as mensagens de retorno1519 foreach($objPedidoSubstituicao->__get("ListaMensagemAlertaRetorno") as $objMensagemRetorno)1520 {1521 $this->tcMensagemRetorno($ElementListaMensagemAlertaRetorno, $objMensagemRetorno);1522 }1523 } 1524 1525 //Cria nodo NfseSubstituidora1526 $ElementNfseSubstituidora = $this->criaElemento("NfseSubstituidora");1527 $this->vinculaElementofilho($ElementRetSubstituicao, $ElementNfseSubstituidora); 1528 // Nfse tcNfse 1-11529 $CompNfseS= $this->documentoXML->createElement('CompNfse');1530 $this->vinculaElementofilho($ElementNfseSubstituidora, $CompNfseS);1531 //Compnfse1532 $this->tcCompNfse($CompNfseS, $objPedidoSubstituicao->__get("NfseSubstituidora")); 1533 1534 }1535 else1536 {1537 //Cria nodo ListaMensagemRetorno1538 $ElementListaMensagemRetorno = $this->criaElemento("ListaMensagemRetorno");1539 $this->vinculaElementofilho($SubstituirNfseResposta, $ElementListaMensagemRetorno);1540 1541 //Captura as mensagens de retorno1542 foreach($objPedidoSubstituicao->__get("ListaMensagemRetorno") as $objMensagemRetorno)1543 {1544 $this->tcMensagemRetorno($ElementListaMensagemRetorno, $objMensagemRetorno);1545 }1546 } 1547 1548 //Retorna o conteúdo do arquivo1549 return utf8_encode($this->retornaConteudoArquivo()); 1550 }1551 }...

Full Screen

Full Screen

ChildApiModel.php

Source:ChildApiModel.php Github

copy

Full Screen

...21 }22 private function getOrganisationTypes(): array23 {24 return array(25 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasContributor', $this->repo->getSchema()->__get('namespaces')->ontology . 'hasFunder',26 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasOwner', $this->repo->getSchema()->__get('namespaces')->ontology . 'hasLicensor',27 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasRightsHolder'28 );29 }30 private function getPublicationTypes(): array31 {32 return array(33 $this->repo->getSchema()->parent34 );35 }36 private function getPersonTypes(): array37 {38 return array(39 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasContributor', $this->repo->getSchema()->__get('namespaces')->ontology . 'hasCreator',40 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasAuthor', $this->repo->getSchema()->__get('namespaces')->ontology . 'hasEditor',41 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasPrincipalInvestigator'42 );43 }44 private function getProjectTypes(): array45 {46 return array(47 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasRelatedProject'48 );49 }50 private function getConceptTypes()51 {52 return array(53 'http://www.w3.org/2004/02/skos/core#narrower'54 );55 }56 private function getInstituteTypes(): array57 {58 return array(59 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasMember'60 );61 }62 private function getPlaceTypes(): array63 {64 return array(65 $this->repo->getSchema()->__get('namespaces')->ontology . 'hasSpatialCoverage'66 );67 }68 private function getChildTypes(): array69 {70 return array(71 $this->repo->getSchema()->parent72 );73 }74 public function getAcdhtype(): string75 {76 if (!empty($this->rootAcdhType)) {77 return $this->rootAcdhType;78 }79 return '';80 }81 /**82 * Get the actual page view data83 *84 * @param string $identifier85 * @param int $limit86 * @param int $page87 * @param string $orderby88 * @return array89 */90 public function getViewData(string $identifier = "", int $limit = 10, int $page = 0, string $orderby = "titleasc"): array91 {92 $order = $this->ordering($orderby);93 if (empty($this->sqlTypes)) {94 $this->sqlTypes = "ARRAY[]::text[]";95 }96 //get the requested sorting97 try {98 $this->setSqlTimeout('30000');99 // distinct is removing the ordering100 $query = $this->repodb->query(101 "select id, title, avdate, description, accesres, titleimage, acdhtype, version from gui.child_views_func(:id, :limit, :page, :order, :orderprop, :lang, $this->sqlTypes);",102 array(103 ':id' => $identifier,104 ':limit' => $limit,105 ':page' => $page,106 ':order' => $order->order,107 ':orderprop' => $order->property,108 ':lang' => $this->siteLang109 ),110 ['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]111 );112 $this->data = $query->fetchAll();113 } catch (\Exception $ex) {114 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());115 $this->data = array();116 } catch (\Drupal\Core\Database\DatabaseExceptionWrapper $ex) {117 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());118 $this->data = array();119 }120 $this->changeBackDBConnection();121 return $this->data;122 }123 /**124 * Get the number of the child resources for the pagination125 *126 * @param string $identifier127 */128 public function getCount(string $identifier): int129 {130 if (empty($this->sqlTypes)) {131 $this->sqlTypes = "ARRAY['" . $this->repo->getSchema()->parent . "']";132 }133 try {134 $this->setSqlTimeout('10000');135 $query = $this->repodb->query(136 "select * from gui.child_sum_views_func(:id, $this->sqlTypes);",137 array(138 ':id' => $identifier139 ),140 ['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]141 );142 $result = $query->fetch();143 $this->changeBackDBConnection();144 if (isset($result->countid)) {145 return (int) $result->countid;146 }147 } catch (\Exception $ex) {148 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());149 return 0;150 } catch (\Drupal\Core\Database\DatabaseExceptionWrapper $ex) {151 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());152 return 0;153 }154 $this->changeBackDBConnection();155 return 0;156 }157 /**158 * Get the root resource acdh type159 *160 * @param string $repoid161 * @return string162 */163 private function getProperties(string $repoid): string164 {165 $rdf = $this->repo->getSchema()->__get('namespaces')->rdfs . 'type';166 try {167 $this->setSqlTimeout('30000');168 $query = $this->repodb->query(169 "select value from metadata_view where id = :id and property = '" . $rdf . "' and value like '%/vocabs.acdh.oeaw.ac.at/schema#%' limit 1",170 array(':id' => $repoid),171 ['allow_delimiter_in_query' => true, 'allow_square_brackets' => true]172 );173 $result = $query->fetch();174 if (isset($result->value)) {175 return $result->value;176 }177 } catch (\Exception $ex) {178 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());179 } catch (\Drupal\Core\Database\DatabaseExceptionWrapper $ex) {180 \Drupal::logger('acdh_repo_gui')->notice($ex->getMessage());181 }182 $this->changeBackDBConnection();183 return '';184 }185 /**186 * Get the properties for the sql search by the root resource acdh type187 * @param string $class188 * @return array189 */190 public function getPropertiesByClass(string $repoid)191 {192 $class = $this->getProperties($repoid);193 $property = '';194 $this->rootAcdhType = $class;195 if (!empty($class)) {196 $class = strtolower(str_replace($this->repo->getSchema()->__get('namespaces')->ontology, '', $class));197 }198 $this->checkChildProperties($class);199 //create the sql string array for the query200 $this->formatTypeFilter();201 }202 /**203 * Check the root for the special properties204 * @param string $class205 */206 private function checkChildProperties(string $class)207 {208 switch (strtolower($class)) {209 case 'organisation':210 $this->childProperties = $this->getOrganisationTypes();...

Full Screen

Full Screen

GenericPage.php

Source:GenericPage.php Github

copy

Full Screen

...36 public function filteredChildren($filter='default'){37 return App::make('Cmsable\Html\MenuFilterRegistry')->filteredChildren($this->childNodes(), $filter);38 }39 public function getUrlSegment(){40 return $this->__get('url_segment');41 }42 public function setUrlSegment($segment){43 $this->__set('url_segment',$segment);44 return $this;45 }46 public function getPath(){47 return $this->__get('path');48 }49 public function setPath($path){50 $this->__set('path', $path);51 return $this;52 }53 public function getPageTypeId(){54 return $this->__get('page_type');55 }56 public function setPageTypeId($id){57 $this->__set('page_type', $id);58 return $this;59 }60 /**61 * @brief Returns the type of redirect this page is62 *63 * @see self::INTERNAL, self::EXTERNAL, self::VIRTUAL, self::NONE64 ** @return string65 **/66 public function getRedirectType(){67 return $this->__get('redirect_type');68 }69 /**70 * @brief Returns the redirect target. Can be a number for other pages71 * or a id of another page72 *73 * @see self::getRedirectType()74 ** @return string75 **/76 public function getRedirectTarget(){77 return $this->__get('redirect_target');78 }79 /**80 * @return mixed81 */82 public function getRedirectAnchor()83 {84 $this->__get('redirect_anchor');85 }86 /**87 * @brief Returns if node is a root node88 * 89 * @return void90 */91 public function isRootNode(){92 return !(bool)$this->parentNode;93 }94 public function getMenuTitle(){95 return $this->__get('menu_title');96 }97 public function setMenuTitle($menuTitle){98 $this->__set('menu_title', $menuTitle);99 return $this;100 }101 public function getTitle(){102 return $this->__get('title');103 }104 public function setTitle($title){105 $this->__set('title', $title);106 }107 public function getContent(){108 return $this->__get('content');109 }110 public function setContent($content){111 $this->__set('content', $content);112 return $this;113 }114 /**115 * @brief Returns the parent node of this node116 * 117 * @return NodeInterface118 */119 public function parentNode(){120 return $this->parentNode;121 }122 /**123 * @brief Returns the parent node of this node124 * 125 * @return NodeInterface126 */127 public function setParentNode(NodeInterface $parent){128 $this->parentNode = $parent;129 return $this;130 }131 /**132 * @brief Returns the childs of this node133 * 134 * @return array [NodeInterface]135 */136 public function childNodes(){137 return $this->childNodes;138 }139 /**140 * @brief Clears all childNodes141 * 142 * @return array [NodeInterface]143 */144 public function clearChildNodes(){145 $this->childNodes = [];146 return $this;147 }148 /**149 * @brief Adds a childNode to this node150 * 151 * @return NodeInterface152 */153 public function addChildNode(NodeInterface $childNode){154 $this->childNodes[] = $childNode;155 $childNode->setParentNode($this);156 return $this;157 }158 /**159 * @brief Removes a child node160 * 161 * @return NodeInterface162 */163 public function removeChildNode(NodeInterface $childNode){164 $this->childNodes = array_filter($this->childNodes, function($node) use ($childNode){165 return $node !== $childNode;166 });167 return $this;168 }169 /**170 * @brief Does this node have children?171 * 172 * @return bool173 */174 public function hasChildNodes(){175 return (bool)count($this->childNodes);176 }177 /**178 * @brief Returns the depth of this node179 * 180 * @return int181 */182 public function getDepth(){183 if($this->depth === NULL){184 if($this->isRootNode()){185 $this->depth = -1;186 }187 else{188 $parents = [$this];189 $node = $this;190 while($parent = $node->parentNode()){191 if(!$parent->isRootNode()){192 $parents[] = $parent;193 }194 $node = $parent;195 }196 $this->depth = count($parents);197 }198 }199 return $this->depth;200 }201 /**202 * @brief Set the depth of this node (usually done by BeeTreeModel)203 *204 * @param int $depth205 * @return NodeInterface206 */207 public function setDepth($depth){208 $this->depth = $depth;209 return $this;210 }211 /**212 * @brief Returns the identifier of this node213 * Identifiers are used to compare nodes and deceide which214 * child depends to which parent.215 * In a filesystem the path would be the identifier, in216 * a database a id column.217 * 218 * @return mixed219 */220 public function getIdentifier(){221 return $this->__get('id');222 }223 /**224 * @brief Returns the identifier of the parent225 * 226 * @return mixed227 */228 public function getParentIdentifier(){229 if ($this->parentNode) {230 return $this->parentNode->getIdentifier();231 }232 }233 /**234 * @brief Returns the identifier of the parent235 * 236 * @return mixed237 */238 public function hasParentNode(){239 return (bool)$this->parentNode;240 }241 public function __get($key)242 {243 if (isset($this->attributes[$key])) {244 return $this->attributes[$key];245 }246 }247 public function __set($key, $value)248 {249 $this->attributes[$key] = $value;250 }251}...

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$child = new ChildClass();2echo $child->test;3echo $child->test2;4$parent = new ParentClass();5echo $parent->test;6echo $parent->test2;7In the above code, we have created two files, one file is 1.php and another is 2.php. In 1.php, we have created an object of ChildClass and in 2.php, we have created an object of ParentClass. We have used the __get() method of both classes and we have called the same property. In 1.php, we have called the property test and in 2.php, we have called the property test2. The output of 1.php is:8Code of __set() method9$child = new ChildClass();10$child->test = "Hello";11$parent = new ParentClass();12$parent->test = "Hello";13In the above code, we have created two files, one file is 1.php and another is 2.php. In 1.php, we have created an object of ChildClass and in 2.php, we have created an object of ParentClass. We have used the __set() method of both classes and we have called the same property. In 1.php, we have called the property test and in 2.php, we have called the property test2. The output of 1.php is:14In the above output, we have called the __set() method of ParentClass and we have set the

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$obj = new MyClass();2$obj->foo = "bar";3echo $obj->foo;4$obj = new MyClass();5$obj->foo = "bar";6echo $obj->foo;7$obj = new MyClass();8$obj->foo = "bar";9echo $obj->foo;10$obj = new MyClass();11$obj->foo = "bar";12echo $obj->foo;13$obj = new MyClass();14$obj->foo = "bar";15echo $obj->foo;16$obj = new MyClass();17$obj->foo = "bar";18echo $obj->foo;19$obj = new MyClass();20$obj->foo = "bar";21echo $obj->foo;22$obj = new MyClass();23$obj->foo = "bar";24echo $obj->foo;25$obj = new MyClass();26$obj->foo = "bar";27echo $obj->foo;28$obj = new MyClass();29$obj->foo = "bar";30echo $obj->foo;31$obj = new MyClass();32$obj->foo = "bar";33echo $obj->foo;34$obj = new MyClass();35$obj->foo = "bar";36echo $obj->foo;37$obj = new MyClass();38$obj->foo = "bar";39echo $obj->foo;40$obj = new MyClass();41$obj->foo = "bar";42echo $obj->foo;

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$child = new Child();2echo $child->name;3$parent = new Parent();4echo $parent->name;5$child = new Child();6echo $child->childName;7$parent = new Parent();8echo $parent->parentName;9$child = new Child();10echo $child->childName;11$parent = new Parent();12echo $parent->parentName;

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$obj=new Child();2$obj->name="Sachin";3echo $obj->name;4$obj=new Child();5$obj->name="Sachin";6echo $obj->name;7$obj=new Child();8$obj->display("Sachin");9Child::display("Sachin");10$obj=new Child();11echo $obj;12$obj=new Child();13echo $obj("Sachin");14$obj=new Child();15var_export($obj);16$obj=new Child();17$obj2=clone $obj;18$obj=new Child();19serialize($obj);20$obj=new Child();21serialize($obj);22unserialize($obj);23$obj=new Child();24var_dump($obj);25$obj=new Child();26$obj->name="Sachin";27isset($obj->name);28$obj=new Child();29$obj->name="Sachin";30unset($obj->name);31$obj=new Child();32serialize($obj);33$obj=new Child();34serialize($obj);35unserialize($obj);36$obj=new Child();37serialize($obj);38$obj=new Child();39serialize($obj);40unserialize($obj);

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$obj1 = new Child();2$obj1->name = 'John Doe';3$obj2 = new Child();4$obj2->name = 'John Doe';5$obj3 = new Child();6$obj3->setName('John Doe');7Child::setName('John Doe');8$obj4 = new Child();9$obj4->name = 'John Doe';10$obj5 = new Child();11$obj5->name = 'John Doe';12unset($obj5->name);13$obj6 = new Child();14$obj6->name = 'John Doe';15$serialized = serialize($obj6);16$obj7 = new Child();17$obj7->name = 'John Doe';18$serialized = serialize($obj7);19$obj7 = unserialize($serialized);20$obj8 = new Child();21$obj8->name = 'John Doe';22$obj9 = new Child();23$obj10 = new Child();24$obj10->name = 'John Doe';25$obj10 = eval('return '.var_export($obj10, true).';');26$obj11 = new Child();27$obj11->name = 'John Doe';28$obj12 = clone $obj11;

Full Screen

Full Screen

__get

Using AI Code Generation

copy

Full Screen

1$obj=new child();2$obj->name="Neha";3echo $obj->name;4__set() method in PHP5{6private $name;7public function __set($property, $value)8{9$this->$property=$value;10}11}12{13}14$obj=new child();15$obj->name="Neha";16echo $obj->name;17__call() method in PHP18{19public function __call($method, $arguments)20{21echo "Method $method does not exist";22}23}24{25}26$obj=new child();27$obj->display();28__callStatic() method in PHP29The __callStatic() method is used to call the static methods which are not defined in a class. It is called when we try to call the static method which is not defined in a

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger __get code on LambdaTest Cloud Grid

Execute automation tests with __get on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful