@@ -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) { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | $path = realpath(__DIR__ . "/../../storage"); |
| 32 | 32 | $json = file_get_contents( |
| 33 | - $path . '/txtstructure' . ($version*100) . '.json' |
|
| 33 | + $path . '/txtstructure' . ($version * 100) . '.json' |
|
| 34 | 34 | ); |
| 35 | 35 | self::$entities = json_decode($json, true); |
| 36 | 36 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($default != $count) { |
| 82 | 82 | self::$errors[] = "ERRO: O número de parâmetros na linha " |
| 83 | 83 | . "está errado (esperado #$default) -> (encontrado #$count). [ $row ] Esperado [ " |
| 84 | - . self::$entities[$ref]." ]"; |
|
| 84 | + . self::$entities[$ref] . " ]"; |
|
| 85 | 85 | } |
| 86 | 86 | foreach ($fields as $field) { |
| 87 | 87 | if ($field != trim($field)) { |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $dtEmi = new DateTime($ide->getElementsByTagName('dhEmi')->item(0)->nodeValue); |
| 37 | 37 | $ano = $dtEmi->format('y'); |
| 38 | 38 | $mes = $dtEmi->format('m'); |
| 39 | - $tpEmis = (string)$contingency->tpEmis; |
|
| 39 | + $tpEmis = (string) $contingency->tpEmis; |
|
| 40 | 40 | $emit = $dom->getElementsByTagName('emit')->item(0); |
| 41 | 41 | $cnpj = $emit->getElementsByTagName('CNPJ')->item(0)->nodeValue; |
| 42 | 42 | |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | $type = strtoupper(str_replace('-', '', $type)); |
| 115 | 115 | |
| 116 | 116 | if (empty($type)) { |
| 117 | - $type = (string)$list[$acronym]; |
|
| 117 | + $type = (string) $list[$acronym]; |
|
| 118 | 118 | } |
| 119 | 119 | $this->config = $this->configBuild($dt->getTimestamp(), $motive, $type); |
| 120 | 120 | return $this->__toString(); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | throw DocumentsException::wrongDocument(3, "<protCTe>"); |
| 130 | 130 | } |
| 131 | 131 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
| 132 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 132 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 133 | 133 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 134 | 134 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
| 135 | 135 | $digProt = '000'; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | throw DocumentsException::wrongDocument(3, "<protCTe>"); |
| 187 | 187 | } |
| 188 | 188 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
| 189 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 189 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 190 | 190 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 191 | 191 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
| 192 | 192 | $digProt = '000'; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue; |
| 240 | 240 | //extrai a rag retEvento da resposta (retorno da SEFAZ) |
| 241 | 241 | $retEv = $ret->getElementsByTagName('retEventoCTe')->item(0); |
| 242 | - $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 242 | + $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 243 | 243 | $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 244 | 244 | $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue; |
| 245 | 245 | $cStatValids = ['135', '136']; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $signed = $this->addQRCode($dom); |
| 359 | 359 | } |
| 360 | 360 | $this->isValid($this->versao, $signed, $method); |
| 361 | - $modal = (int)$dom->getElementsByTagName('modal')->item(0)->nodeValue; |
|
| 361 | + $modal = (int) $dom->getElementsByTagName('modal')->item(0)->nodeValue; |
|
| 362 | 362 | if ($modelo != 67) { |
| 363 | 363 | switch ($modal) { |
| 364 | 364 | case 1: |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | protected function sendRequest($request, array $parameters = []) |
| 599 | 599 | { |
| 600 | 600 | $this->checkSoap(); |
| 601 | - return (string)$this->soap->send( |
|
| 601 | + return (string) $this->soap->send( |
|
| 602 | 602 | $this->urlService, |
| 603 | 603 | $this->urlMethod, |
| 604 | 604 | $this->urlAction, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($compactar) { |
| 82 | 82 | $gzdata = base64_encode(gzencode($request, 9, FORCE_GZIP)); |
| 83 | 83 | $body = "<cteDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</cteDadosMsgZip>"; |
| 84 | - $method = $this->urlMethod."Zip"; |
|
| 84 | + $method = $this->urlMethod . "Zip"; |
|
| 85 | 85 | $parameters = ['cteDadosMsgZip' => $gzdata]; |
| 86 | 86 | $body = "<cteDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</cteDadosMsgZip>"; |
| 87 | 87 | } |
@@ -374,13 +374,12 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | //monta a consulta |
| 376 | 376 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 377 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
| 377 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
| 378 | 378 | . "<cUFAutor>$cUF</cUFAutor>" |
| 379 | - . ((strlen($this->config->cnpj)==14) ? |
|
| 380 | - "<CNPJ>".$this->config->cnpj."</CNPJ>" : |
|
| 381 | - "<CPF>".$this->config->cnpj."</CPF>" |
|
| 379 | + . ((strlen($this->config->cnpj) == 14) ? |
|
| 380 | + "<CNPJ>" . $this->config->cnpj . "</CNPJ>" : "<CPF>" . $this->config->cnpj . "</CPF>" |
|
| 382 | 381 | ) |
| 383 | - . $tagNSU."</distDFeInt>"; |
|
| 382 | + . $tagNSU . "</distDFeInt>"; |
|
| 384 | 383 | //valida o xml da requisição |
| 385 | 384 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
| 386 | 385 | $this->lastRequest = $consulta; |
@@ -666,7 +665,7 @@ discard block |
||
| 666 | 665 | $dt = new \DateTime('now', new \DateTimeZone($this->timezone)); |
| 667 | 666 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
| 668 | 667 | $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT); |
| 669 | - $eventId = "ID".$tpEvento.$chave.$sSeqEvento; |
|
| 668 | + $eventId = "ID" . $tpEvento . $chave . $sSeqEvento; |
|
| 670 | 669 | $cOrgao = UFList::getCodeByUF($uf); |
| 671 | 670 | |
| 672 | 671 | $request = "<eventoCTe xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
@@ -722,9 +721,8 @@ discard block |
||
| 722 | 721 | ); |
| 723 | 722 | //monta a consulta |
| 724 | 723 | $consulta = "<consChNFe><chNFe>$chave</chNFe></consChNFe>" |
| 725 | - . ((strlen($this->config->cnpj)==14) ? |
|
| 726 | - "<CNPJ>".$this->config->cnpj."</CNPJ>" : |
|
| 727 | - "<CPF>".$this->config->cnpj."</CPF>" |
|
| 724 | + . ((strlen($this->config->cnpj) == 14) ? |
|
| 725 | + "<CNPJ>" . $this->config->cnpj . "</CNPJ>" : "<CPF>" . $this->config->cnpj . "</CPF>" |
|
| 728 | 726 | ) |
| 729 | 727 | ."</distDFeInt>"; |
| 730 | 728 | //valida o xml da requisição |
@@ -778,8 +776,8 @@ discard block |
||
| 778 | 776 | . "<indOp>$indOp</indOp>" |
| 779 | 777 | . "<raizCNPJ>$raizCNPJ</raizCNPJ>" |
| 780 | 778 | . "<dadosCsc>" |
| 781 | - . "<idCsc>".$this->config->CSCid."</idCsc>" |
|
| 782 | - . "<codigoCsc>".$this->config->CSC."</codigoCsc>" |
|
| 779 | + . "<idCsc>" . $this->config->CSCid . "</idCsc>" |
|
| 780 | + . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>" |
|
| 783 | 781 | . "</dadosCsc>" |
| 784 | 782 | . "</admCscNFCe>"; |
| 785 | 783 | } |
@@ -810,7 +808,7 @@ discard block |
||
| 810 | 808 | $dom->loadXML($cte); |
| 811 | 809 | //verifica a validade no webservice da SEFAZ |
| 812 | 810 | $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue; |
| 813 | - $infCTe = $dom->getElementsByTagName('infCte')->item(0); |
|
| 811 | + $infCTe = $dom->getElementsByTagName('infCte')->item(0); |
|
| 814 | 812 | $chCTe = preg_replace('/[^0-9]/', '', $infCTe->getAttribute("Id")); |
| 815 | 813 | $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue; |
| 816 | 814 | $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue; |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | $std = $this->equilizeParameters($std, $possible); |
| 1279 | 1279 | $identificador = '#4 <infPercurso> - '; |
| 1280 | 1280 | $this->infPercurso[] = $this->dom->createElement('infPercurso'); |
| 1281 | - $posicao = (int)count($this->infPercurso) - 1; |
|
| 1281 | + $posicao = (int) count($this->infPercurso) - 1; |
|
| 1282 | 1282 | $this->dom->addChild( |
| 1283 | 1283 | $this->infPercurso[$posicao], |
| 1284 | 1284 | 'UFPer', |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | $std = $this->equilizeParameters($std, $possible); |
| 1899 | 1899 | $identificador = '#65 <pass> - '; |
| 1900 | 1900 | $this->pass[] = $this->dom->createElement('pass'); |
| 1901 | - $posicao = (int)count($this->pass) - 1; |
|
| 1901 | + $posicao = (int) count($this->pass) - 1; |
|
| 1902 | 1902 | $this->dom->addChild( |
| 1903 | 1903 | $this->pass[$posicao], |
| 1904 | 1904 | 'xPass', |
@@ -2132,7 +2132,7 @@ discard block |
||
| 2132 | 2132 | $identificador = '#91 <ObsCont> - '; |
| 2133 | 2133 | if (count($this->obsCont) <= 10) { |
| 2134 | 2134 | $this->obsCont[] = $this->dom->createElement('ObsCont'); |
| 2135 | - $posicao = (int)count($this->obsCont) - 1; |
|
| 2135 | + $posicao = (int) count($this->obsCont) - 1; |
|
| 2136 | 2136 | $this->obsCont[$posicao]->setAttribute('xCampo', $std->xCampo); |
| 2137 | 2137 | $this->dom->addChild( |
| 2138 | 2138 | $this->obsCont[$posicao], |
@@ -2144,9 +2144,9 @@ discard block |
||
| 2144 | 2144 | return true; |
| 2145 | 2145 | } |
| 2146 | 2146 | $this->errors[] = array( |
| 2147 | - 'tag' => (string)'<ObsCont>', |
|
| 2148 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
| 2149 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
| 2147 | + 'tag' => (string) '<ObsCont>', |
|
| 2148 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
| 2149 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
| 2150 | 2150 | ); |
| 2151 | 2151 | return false; |
| 2152 | 2152 | } |
@@ -2170,7 +2170,7 @@ discard block |
||
| 2170 | 2170 | $identificador = '#94 <ObsFisco> - '; |
| 2171 | 2171 | if (count($this->obsFisco) <= 10) { |
| 2172 | 2172 | $this->obsFisco[] = $this->dom->createElement('ObsFisco'); |
| 2173 | - $posicao = (int)count($this->obsFisco) - 1; |
|
| 2173 | + $posicao = (int) count($this->obsFisco) - 1; |
|
| 2174 | 2174 | $this->obsFisco[$posicao]->setAttribute('xCampo', $std->xCampo); |
| 2175 | 2175 | $this->dom->addChild( |
| 2176 | 2176 | $this->obsFisco[$posicao], |
@@ -2182,9 +2182,9 @@ discard block |
||
| 2182 | 2182 | return true; |
| 2183 | 2183 | } |
| 2184 | 2184 | $this->errors[] = array( |
| 2185 | - 'tag' => (string)'<ObsFisco>', |
|
| 2186 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
| 2187 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
| 2185 | + 'tag' => (string) '<ObsFisco>', |
|
| 2186 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
| 2187 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
| 2188 | 2188 | ); |
| 2189 | 2189 | return false; |
| 2190 | 2190 | } |
@@ -3187,7 +3187,7 @@ discard block |
||
| 3187 | 3187 | $std = $this->equilizeParameters($std, $possible); |
| 3188 | 3188 | $identificador = '#65 <pass> - '; |
| 3189 | 3189 | $this->comp[] = $this->dom->createElement('Comp'); |
| 3190 | - $posicao = (int)count($this->comp) - 1; |
|
| 3190 | + $posicao = (int) count($this->comp) - 1; |
|
| 3191 | 3191 | $this->dom->addChild( |
| 3192 | 3192 | $this->comp[$posicao], |
| 3193 | 3193 | 'xNome', |
@@ -3776,7 +3776,7 @@ discard block |
||
| 3776 | 3776 | $std = $this->equilizeParameters($std, $possible); |
| 3777 | 3777 | $identificador = '#257 <infQ> - '; |
| 3778 | 3778 | $this->infQ[] = $this->dom->createElement('infQ'); |
| 3779 | - $posicao = (int)count($this->infQ) - 1; |
|
| 3779 | + $posicao = (int) count($this->infQ) - 1; |
|
| 3780 | 3780 | $this->dom->addChild( |
| 3781 | 3781 | $this->infQ[$posicao], |
| 3782 | 3782 | 'cUnid', |
@@ -4267,7 +4267,7 @@ discard block |
||
| 4267 | 4267 | $std = $this->equilizeParameters($std, $possible); |
| 4268 | 4268 | $ident = '#319 <infDocRef> - '; |
| 4269 | 4269 | $this->infDocRef[] = $this->dom->createElement('infDocRef'); |
| 4270 | - $posicao = (int)count($this->infDocRef) - 1; |
|
| 4270 | + $posicao = (int) count($this->infDocRef) - 1; |
|
| 4271 | 4271 | if (!empty($std->chBPe)) { |
| 4272 | 4272 | $this->dom->addChild( |
| 4273 | 4273 | $this->infDocRef[$posicao], |
@@ -4334,7 +4334,7 @@ discard block |
||
| 4334 | 4334 | $std = $this->equilizeParameters($std, $possible); |
| 4335 | 4335 | $identificador = '#345 <emiDocAnt> - '; |
| 4336 | 4336 | $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt'); |
| 4337 | - $posicao = (int)count($this->emiDocAnt) - 1; |
|
| 4337 | + $posicao = (int) count($this->emiDocAnt) - 1; |
|
| 4338 | 4338 | if ($std->CNPJ != '') { |
| 4339 | 4339 | $this->dom->addChild( |
| 4340 | 4340 | $this->emiDocAnt[$posicao], |
@@ -4390,7 +4390,7 @@ discard block |
||
| 4390 | 4390 | $std = $this->equilizeParameters($std, $possible); |
| 4391 | 4391 | $identificador = '#358 <idDocAntEle> - '; |
| 4392 | 4392 | $this->idDocAntEle[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntEle'); |
| 4393 | - $posicao = (int)count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
| 4393 | + $posicao = (int) count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
| 4394 | 4394 | $this->dom->addChild( |
| 4395 | 4395 | $this->idDocAntEle[count($this->emiDocAnt) - 1][$posicao], |
| 4396 | 4396 | 'chCTe', |
@@ -4418,7 +4418,7 @@ discard block |
||
| 4418 | 4418 | $std = $this->equilizeParameters($std, $possible); |
| 4419 | 4419 | $identificador = '#360 <seg> - '; |
| 4420 | 4420 | $this->seg[] = $this->dom->createElement('seg'); |
| 4421 | - $posicao = (int)count($this->seg) - 1; |
|
| 4421 | + $posicao = (int) count($this->seg) - 1; |
|
| 4422 | 4422 | $this->dom->addChild( |
| 4423 | 4423 | $this->seg[$posicao], |
| 4424 | 4424 | 'respSeg', |
@@ -4461,7 +4461,7 @@ discard block |
||
| 4461 | 4461 | $std = $this->equilizeParameters($std, $possible); |
| 4462 | 4462 | $identificador = '#358 <idDocAntPap> - '; |
| 4463 | 4463 | $this->idDocAntPap[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntPap'); |
| 4464 | - $posicao = (int)count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
| 4464 | + $posicao = (int) count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
| 4465 | 4465 | $this->dom->addChild( |
| 4466 | 4466 | $this->idDocAntPap[count($this->emiDocAnt) - 1][$posicao], |
| 4467 | 4467 | 'tpDoc', |
@@ -4727,7 +4727,7 @@ discard block |
||
| 4727 | 4727 | $std = $this->equilizeParameters($std, $possible); |
| 4728 | 4728 | $identificador = '#12 <detCont> - '; |
| 4729 | 4729 | $this->lacre[count($this->detCont) - 1][] = $this->dom->createElement('lacre'); |
| 4730 | - $posicao = (int)count($this->lacre[count($this->detCont) - 1]) - 1; |
|
| 4730 | + $posicao = (int) count($this->lacre[count($this->detCont) - 1]) - 1; |
|
| 4731 | 4731 | $this->dom->addChild( |
| 4732 | 4732 | $this->lacre[count($this->detCont) - 1][$posicao], |
| 4733 | 4733 | 'nLacre', |
@@ -4754,7 +4754,7 @@ discard block |
||
| 4754 | 4754 | $std = $this->equilizeParameters($std, $possible); |
| 4755 | 4755 | $identificador = '#15 <detCont> <infNF> - '; |
| 4756 | 4756 | $this->infNFCont[count($this->detCont) - 1][] = $this->dom->createElement('infNF'); |
| 4757 | - $posicao = (int)count($this->infNFCont[count($this->detCont) - 1]) - 1; |
|
| 4757 | + $posicao = (int) count($this->infNFCont[count($this->detCont) - 1]) - 1; |
|
| 4758 | 4758 | $this->dom->addChild( |
| 4759 | 4759 | $this->infNFCont[count($this->detCont) - 1][$posicao], |
| 4760 | 4760 | 'serie', |
@@ -4791,7 +4791,7 @@ discard block |
||
| 4791 | 4791 | $std = $this->equilizeParameters($std, $possible); |
| 4792 | 4792 | $identificador = '#19 <infNFe> - '; |
| 4793 | 4793 | $this->infNFeCont[count($this->detCont) - 1][] = $this->dom->createElement('infNFe'); |
| 4794 | - $posicao = (int)count($this->infNFeCont[count($this->detCont) - 1]) - 1; |
|
| 4794 | + $posicao = (int) count($this->infNFeCont[count($this->detCont) - 1]) - 1; |
|
| 4795 | 4795 | $this->dom->addChild( |
| 4796 | 4796 | $this->infNFeCont[count($this->detCont) - 1][$posicao], |
| 4797 | 4797 | 'chave', |