| Server IP : 162.214.74.102 / Your IP : 216.73.216.192 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/www/lrsys_apps/rodeio/application/plugins/modulo_fiscal/nfephp/libs/NFe/ |
Upload File : |
<?php
namespace NFePHP\NFe;
/**
* Classe para a identificação do documento eletrônico da NFe
*
* @category NFePHP
* @package NFePHP\NFe\IdentifyNFe
* @copyright Copyright (c) 2008-2015
* @license http://www.gnu.org/licenses/lesser.html LGPL v3
* @author Roberto L. Machado <linux.rlm at gmail dot com>
* @link http://github.com/nfephp-org/nfephp for the canonical source repository
*/
use \DOMDocument;
use NFePHP\Common\Identify\Identify;
class IdentifyNFe
{
public static function identificar($xml = '', &$aResp = array())
{
$aList = array(
'consReciNFe' => 'consReciNFe',
'consSitNFe' => 'consSitNFe',
'consStatServ' => 'consStatServ',
'distDFeInt' => 'distDFeInt',
'enviNFe' => 'enviNFe',
'inutNFe' => 'inutNFe',
'NFe' => 'nfe',
'procInutNFe' => 'procInutNFe',
'procNFe' => 'procNFe',
'resEvento' => 'resEvento',
'resNFe' => 'resNFe',
'retConsReciNFe' => 'retConsReciNFe',
'retConsSitNFe' => 'retConsSitNFe',
'retConsStatServ' => 'retConsStatServ',
'retDistDFeInt' => 'retDistDFeInt',
'retEnviNFe' => 'retEnviNFe',
'retInutNFe' => 'retInutNFe'
);
Identify::setListSchemesId($aList);
$schem = Identify::identificacao($xml, $aResp);
$dom = $aResp['dom'];
$node = $dom->getElementsByTagName($aResp['tag'])->item(0);
if ($schem == 'nfe') {
//se for um nfe então é necessário pegar a versão
// em outro node infNFe
$node1 = $dom->getElementsByTagName('infNFe')->item(0);
$versao = $node1->getAttribute('versao');
} else {
$versao = $node->getAttribute('versao');
}
$aResp['versao'] = $versao;
$aResp['xml'] = $dom->saveXML($node);
return $schem;
}
}