@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Add protocol to xml |
| 27 | 27 | * @param string $xmlnfe xml |
| 28 | - * @param string $protocol response xml |
|
| 28 | + * @param string $xmlprotocol response xml |
|
| 29 | 29 | * @return string |
| 30 | 30 | * @throws InvalidArgumentException |
| 31 | 31 | */ |
@@ -19,8 +19,6 @@ |
||
| 19 | 19 | use NFePHP\Common\Strings; |
| 20 | 20 | use NFePHP\Common\Signer; |
| 21 | 21 | use NFePHP\Common\UFList; |
| 22 | -use NFePHP\NFe\Factories\QRCode; |
|
| 23 | -use NFePHP\NFe\Factories\Events; |
|
| 24 | 22 | use NFePHP\NFe\Common\Tools as ToolsCommon; |
| 25 | 23 | use RuntimeException; |
| 26 | 24 | use InvalidArgumentException; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if ($compactar) { |
| 89 | 89 | $gzdata = base64_encode(gzencode($request, 9, FORCE_GZIP)); |
| 90 | 90 | $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>"; |
| 91 | - $method = $this->urlMethod."Zip"; |
|
| 91 | + $method = $this->urlMethod . "Zip"; |
|
| 92 | 92 | $parameters = ['nfeDadosMsgZip' => $gzdata]; |
| 93 | 93 | $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>"; |
| 94 | 94 | } |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | //monta a consulta |
| 361 | 361 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 362 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
| 362 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
| 363 | 363 | . "<cUFAutor>$cUF</cUFAutor>" |
| 364 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>"; |
|
| 364 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>"; |
|
| 365 | 365 | //valida o xml da requisição |
| 366 | 366 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
| 367 | 367 | $this->lastRequest = $consulta; |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | $dt = new \DateTime(); |
| 654 | 654 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
| 655 | 655 | $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT); |
| 656 | - $eventId = "ID".$tpEvento.$chave.$sSeqEvento; |
|
| 656 | + $eventId = "ID" . $tpEvento . $chave . $sSeqEvento; |
|
| 657 | 657 | $cOrgao = UFList::getCodeByUF($uf); |
| 658 | 658 | $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 659 | 659 | . "<infEvento Id=\"$eventId\">" |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $this->canonical |
| 682 | 682 | ); |
| 683 | 683 | $request = Strings::clearXmlString($request, true); |
| 684 | - $lote = $dt->format('YmdHis').rand(0, 9); |
|
| 684 | + $lote = $dt->format('YmdHis') . rand(0, 9); |
|
| 685 | 685 | $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 686 | 686 | . "<idLote>$lote</idLote>" |
| 687 | 687 | . $request |
@@ -716,9 +716,9 @@ discard block |
||
| 716 | 716 | $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>"; |
| 717 | 717 | //monta a consulta |
| 718 | 718 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 719 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
| 719 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
| 720 | 720 | . "<cUFAutor>$cUF</cUFAutor>" |
| 721 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>"; |
|
| 721 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>"; |
|
| 722 | 722 | //valida o xml da requisição |
| 723 | 723 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
| 724 | 724 | $this->lastRequest = $consulta; |
@@ -770,8 +770,8 @@ discard block |
||
| 770 | 770 | . "<indOp>$indOp</indOp>" |
| 771 | 771 | . "<raizCNPJ>$raizCNPJ</raizCNPJ>" |
| 772 | 772 | . "<dadosCsc>" |
| 773 | - . "<idCsc>".$this->config->CSCid."</idCsc>" |
|
| 774 | - . "<codigoCsc>".$this->config->CSC."</codigoCsc>" |
|
| 773 | + . "<idCsc>" . $this->config->CSCid . "</idCsc>" |
|
| 774 | + . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>" |
|
| 775 | 775 | . "</dadosCsc>" |
| 776 | 776 | . "</admCscNFCe>"; |
| 777 | 777 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | $dom->loadXML($nfe); |
| 800 | 800 | //verifica a validade no webservice da SEFAZ |
| 801 | 801 | $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue; |
| 802 | - $infNFe = $dom->getElementsByTagName('infNFe')->item(0); |
|
| 802 | + $infNFe = $dom->getElementsByTagName('infNFe')->item(0); |
|
| 803 | 803 | $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id")); |
| 804 | 804 | $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue; |
| 805 | 805 | $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue; |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | ); |
| 817 | 817 | } |
| 818 | 818 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
| 819 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 819 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 820 | 820 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 821 | 821 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
| 822 | 822 | $digProt = '000'; |
@@ -158,12 +158,12 @@ |
||
| 158 | 158 | $seq .= '&vICMS=' . $vICMS; |
| 159 | 159 | $seq .= '&digVal=' . strtolower($digHex); |
| 160 | 160 | $seq .= '&cIdToken=' . str_pad($idToken, 6, '0', STR_PAD_LEFT); |
| 161 | - $hash = sha1($seq.$token); |
|
| 162 | - $seq .= '&cHashQRCode='. strtoupper($hash); |
|
| 161 | + $hash = sha1($seq . $token); |
|
| 162 | + $seq .= '&cHashQRCode=' . strtoupper($hash); |
|
| 163 | 163 | if (strpos($url, '?') === false) { |
| 164 | - $url = $url.'?'; |
|
| 164 | + $url = $url . '?'; |
|
| 165 | 165 | } |
| 166 | - return $url.$seq; |
|
| 166 | + return $url . $seq; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -48,9 +48,9 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | protected static function validInputData(stdClass $data) |
| 50 | 50 | { |
| 51 | - $filejsonschema = __DIR__. "/../../storage/config_json.schema"; |
|
| 51 | + $filejsonschema = __DIR__ . "/../../storage/config_json.schema"; |
|
| 52 | 52 | $validator = new JsonValid(); |
| 53 | - $validator->check($data, (object)['$ref' => 'file://' . $filejsonschema]); |
|
| 53 | + $validator->check($data, (object) ['$ref' => 'file://' . $filejsonschema]); |
|
| 54 | 54 | if (!$validator->isValid()) { |
| 55 | 55 | $msg = ""; |
| 56 | 56 | foreach ($validator->getErrors() as $error) { |
@@ -109,15 +109,15 @@ |
||
| 109 | 109 | if (substr($linha, 0, 2) == 'A|') { |
| 110 | 110 | $resp[$xCount]['init'] = $iCount; |
| 111 | 111 | if ($xCount > 0) { |
| 112 | - $resp[$xCount -1]['fim'] = $iCount; |
|
| 112 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
| 113 | 113 | } |
| 114 | 114 | $xCount += 1; |
| 115 | 115 | } |
| 116 | 116 | $iCount += 1; |
| 117 | 117 | } |
| 118 | - $resp[$xCount-1]['fim'] = $iCount; |
|
| 118 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
| 119 | 119 | foreach ($resp as $marc) { |
| 120 | - $length = $marc['fim']-$marc['init']; |
|
| 120 | + $length = $marc['fim'] - $marc['init']; |
|
| 121 | 121 | $aNotas[] = array_slice($array, $marc['init'], $length, false); |
| 122 | 122 | } |
| 123 | 123 | return $aNotas; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | //wrong document, this document is not able to recieve a protocol |
| 26 | 26 | throw DocumentsException::wrongDocument(0, $key); |
| 27 | 27 | } |
| 28 | - $func = "add".$key."Protocol"; |
|
| 28 | + $func = "add" . $key . "Protocol"; |
|
| 29 | 29 | return self::$func($request, $response); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $node2 = $procb2b->importNode($nodeb2b, true); |
| 73 | 73 | $nfeProcB2B->appendChild($node2); |
| 74 | 74 | $nfeb2bXML = $procb2b->saveXML(); |
| 75 | - $nfeb2bXMLString = str_replace(array("\n","\r","\s"), '', $nfeb2bXML); |
|
| 75 | + $nfeb2bXMLString = str_replace(array("\n", "\r", "\s"), '', $nfeb2bXML); |
|
| 76 | 76 | return (string) $nfeb2bXMLString; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | throw DocumentsException::wrongDocument(3, "<protNFe>"); |
| 240 | 240 | } |
| 241 | 241 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
| 242 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 242 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 243 | 243 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 244 | 244 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
| 245 | 245 | $digProt = '000'; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue; |
| 293 | 293 | //extrai a rag retEvento da resposta (retorno da SEFAZ) |
| 294 | 294 | $retEv = $ret->getElementsByTagName('retEvento')->item(0); |
| 295 | - $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 295 | + $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 296 | 296 | $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 297 | 297 | $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue; |
| 298 | 298 | $cStatValids = ['135', '136']; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | { |
| 329 | 329 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 330 | 330 | . "<$nodename versao=\"$versao\" " |
| 331 | - . "xmlns=\"".self::$urlPortal."\">"; |
|
| 331 | + . "xmlns=\"" . self::$urlPortal . "\">"; |
|
| 332 | 332 | $xml .= $first; |
| 333 | 333 | $xml .= $second; |
| 334 | 334 | $xml .= "</$nodename>"; |
@@ -776,7 +776,6 @@ |
||
| 776 | 776 | |
| 777 | 777 | /** |
| 778 | 778 | * Create tag comb [LA] |
| 779 | - * @param stdClass $std |
|
| 780 | 779 | * @return void |
| 781 | 780 | */ |
| 782 | 781 | protected function buildLAEntity() |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function __construct($version = '3.10') |
| 107 | 107 | { |
| 108 | 108 | $ver = str_replace('.', '', $version); |
| 109 | - $path = realpath(__DIR__."/../../storage/txtstructure$ver.json"); |
|
| 109 | + $path = realpath(__DIR__ . "/../../storage/txtstructure$ver.json"); |
|
| 110 | 110 | $this->structure = json_decode(file_get_contents($path), true); |
| 111 | 111 | $this->make = new Make(); |
| 112 | 112 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if (empty($fields)) { |
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | - $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity'; |
|
| 140 | + $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity'; |
|
| 141 | 141 | if (!method_exists(__CLASS__, $metodo)) { |
| 142 | 142 | //campo não definido |
| 143 | 143 | throw DocumentsException::wrongDocument(16, $lin); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | protected static function fieldsToStd($dfls, $struct) |
| 158 | 158 | { |
| 159 | 159 | $sfls = explode('|', $struct); |
| 160 | - $len = count($sfls)-1; |
|
| 160 | + $len = count($sfls) - 1; |
|
| 161 | 161 | $std = new \stdClass(); |
| 162 | 162 | for ($i = 1; $i < $len; $i++) { |
| 163 | 163 | $name = $sfls[$i]; |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | $this->stdPIS->CST = $std->CST; |
| 1231 | 1231 | $this->stdPIS->vPIS = $std->vPIS; |
| 1232 | 1232 | $this->stdPIS->qBCProd = $std->qBCProd; |
| 1233 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1233 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1234 | 1234 | $this->buildQEntity(); |
| 1235 | 1235 | } |
| 1236 | 1236 | |
@@ -1281,7 +1281,7 @@ discard block |
||
| 1281 | 1281 | protected function q10Entity($std) |
| 1282 | 1282 | { |
| 1283 | 1283 | $this->stdPIS->qBCProd = $std->qBCProd; |
| 1284 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1284 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1285 | 1285 | $this->buildQEntity(); |
| 1286 | 1286 | } |
| 1287 | 1287 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * Canonical conversion options |
| 98 | 98 | * @var array |
| 99 | 99 | */ |
| 100 | - protected $canonical = [true,false,null,null]; |
|
| 100 | + protected $canonical = [true, false, null, null]; |
|
| 101 | 101 | /** |
| 102 | 102 | * Model of NFe 55 or 65 |
| 103 | 103 | * @var int |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->config = json_decode($configJson); |
| 186 | 186 | $this->pathwsfiles = realpath( |
| 187 | 187 | __DIR__ . '/../../storage' |
| 188 | - ).'/'; |
|
| 188 | + ) . '/'; |
|
| 189 | 189 | $this->version($this->config->versao); |
| 190 | 190 | $this->setEnvironmentTimeZone($this->config->siglaUF); |
| 191 | 191 | $this->certificate = $certificate; |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | $this->versao = $version; |
| 264 | 264 | $this->config->schemes = $this->availableVersions[$version]; |
| 265 | 265 | $this->pathschemes = realpath( |
| 266 | - __DIR__ . '/../../schemes/'. $this->config->schemes |
|
| 267 | - ).'/'; |
|
| 266 | + __DIR__ . '/../../schemes/' . $this->config->schemes |
|
| 267 | + ) . '/'; |
|
| 268 | 268 | } |
| 269 | 269 | return $this->versao; |
| 270 | 270 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | protected function isValid($version, $body, $method) |
| 364 | 364 | { |
| 365 | - $schema = $this->pathschemes.$method."_v$version.xsd"; |
|
| 365 | + $schema = $this->pathschemes . $method . "_v$version.xsd"; |
|
| 366 | 366 | if (!is_file($schema)) { |
| 367 | 367 | return true; |
| 368 | 368 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * @param array $opt |
| 429 | 429 | * @return array |
| 430 | 430 | */ |
| 431 | - public function canonicalOptions($opt = [true,false,null,null]) |
|
| 431 | + public function canonicalOptions($opt = [true, false, null, null]) |
|
| 432 | 432 | { |
| 433 | 433 | if (!empty($opt) && is_array($opt)) { |
| 434 | 434 | $this->canonical = $opt; |
@@ -547,11 +547,11 @@ discard block |
||
| 547 | 547 | { |
| 548 | 548 | $file = $this->pathwsfiles |
| 549 | 549 | . DIRECTORY_SEPARATOR |
| 550 | - . "wsnfe_".$this->versao."_mod55.xml"; |
|
| 550 | + . "wsnfe_" . $this->versao . "_mod55.xml"; |
|
| 551 | 551 | if ($this->modelo == 65) { |
| 552 | 552 | $file = str_replace('55', '65', $file); |
| 553 | 553 | } |
| 554 | - if (! file_exists($file)) { |
|
| 554 | + if (!file_exists($file)) { |
|
| 555 | 555 | return ''; |
| 556 | 556 | } |
| 557 | 557 | return file_get_contents($file); |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | //os URI estão em storage/uri_consulta_nfce.json |
| 602 | 602 | $std = json_decode( |
| 603 | 603 | file_get_contents( |
| 604 | - $this->pathwsfiles.'uri_consulta_nfce.json' |
|
| 604 | + $this->pathwsfiles . 'uri_consulta_nfce.json' |
|
| 605 | 605 | ) |
| 606 | 606 | ); |
| 607 | 607 | return $std->$uf; |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $cNF |
| 76 | 76 | ); |
| 77 | 77 | $ide->getElementsByTagName('cDV')->item(0)->nodeValue = substr($chave, -1); |
| 78 | - $infNFe->setAttribute('Id', 'NFe'.$chave); |
|
| 78 | + $infNFe->setAttribute('Id', 'NFe' . $chave); |
|
| 79 | 79 | return Strings::clearXmlString($dom->saveXML(), true); |
| 80 | 80 | } |
| 81 | 81 | } |