@@ -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 | } |
@@ -6959,7 +6959,7 @@ |
||
| 6959 | 6959 | /** |
| 6960 | 6960 | * Includes missing or unsupported properties in stdClass |
| 6961 | 6961 | * @param stdClass $std |
| 6962 | - * @param array $possible |
|
| 6962 | + * @param string[] $possible |
|
| 6963 | 6963 | * @return stdClass |
| 6964 | 6964 | */ |
| 6965 | 6965 | protected function equilizeParameters(stdClass $std, $possible) |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | $html .= '<h2>body</h2>'; |
| 67 | 67 | $html .= str_replace( |
| 68 | 68 | ['<', '>'], |
| 69 | - ['<','>'], |
|
| 69 | + ['<', '>'], |
|
| 70 | 70 | str_replace( |
| 71 | 71 | '<?xml version="1.0"?>', |
| 72 | 72 | '<?xml version="1.0" encoding="UTF-8"?>', |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | throw DocumentsException::wrongDocument(8, "Não foi passado um json."); |
| 34 | 34 | } |
| 35 | 35 | $std = json_decode($content); |
| 36 | - if (! is_object($std)) { |
|
| 36 | + if (!is_object($std)) { |
|
| 37 | 37 | throw DocumentsException::wrongDocument(8, "Não foi passado um json valido."); |
| 38 | 38 | } |
| 39 | 39 | self::validInputData($std); |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected static function validInputData($data) |
| 50 | 50 | { |
| 51 | - $filejsonschema = __DIR__. "/../../storage/config.schema"; |
|
| 51 | + $filejsonschema = __DIR__ . "/../../storage/config.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) { |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | '?', |
| 136 | 136 | $field |
| 137 | 137 | ); |
| 138 | - $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
| 138 | + $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
| 139 | 139 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield); |
| 140 | 140 | if ($field != $newfield) { |
| 141 | 141 | $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, " |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | class ValidTXT |
| 21 | 21 | { |
| 22 | - const LOCAL="LOCAL"; |
|
| 23 | - const SEBRAE="SEBRAE"; |
|
| 22 | + const LOCAL = "LOCAL"; |
|
| 23 | + const SEBRAE = "SEBRAE"; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Loads structure of txt from json file in storage folder |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | if (strtoupper($baselayout) === 'SEBRAE') { |
| 36 | 36 | $comp = '_sebrae'; |
| 37 | 37 | } |
| 38 | - $file = $path . '/txtstructure' . ($version*100) . $comp . '.json'; |
|
| 38 | + $file = $path . '/txtstructure' . ($version * 100) . $comp . '.json'; |
|
| 39 | 39 | if (!is_file($file)) { |
| 40 | 40 | throw new \InvalidArgumentException("O arquivo de estrutura para a " |
| 41 | 41 | . "versão de layout indicada no TXT, não foi encontrado [$file]."); |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | $errors[] = "ERRO: ($num) Essa referência não está definida. [$row]"; |
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | - $count = count($fields)-1; |
|
| 104 | - $default = count(explode('|', $entities[$ref]))-1; |
|
| 103 | + $count = count($fields) - 1; |
|
| 104 | + $default = count(explode('|', $entities[$ref])) - 1; |
|
| 105 | 105 | if ($default !== $count) { |
| 106 | 106 | $errors[] = "ERRO: ($num) O número de parâmetros na linha " |
| 107 | 107 | . "está errado (esperado #$default) -> (encontrado #$count). [ $row ] Esperado [ " |
| 108 | - . $entities[$ref]." ]"; |
|
| 108 | + . $entities[$ref] . " ]"; |
|
| 109 | 109 | continue; |
| 110 | 110 | } |
| 111 | 111 | foreach ($fields as $field) { |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | continue; |
| 128 | 128 | } |
| 129 | 129 | $newfield = preg_replace( |
| 130 | - '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'. |
|
| 131 | - '|[\x00-\x7F][\x80-\xBF]+'. |
|
| 132 | - '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'. |
|
| 133 | - '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'. |
|
| 130 | + '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' . |
|
| 131 | + '|[\x00-\x7F][\x80-\xBF]+' . |
|
| 132 | + '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' . |
|
| 133 | + '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' . |
|
| 134 | 134 | '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S', |
| 135 | 135 | '?', |
| 136 | 136 | $field |
| 137 | 137 | ); |
| 138 | - $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'. |
|
| 138 | + $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' . |
|
| 139 | 139 | '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield); |
| 140 | 140 | if ($field != $newfield) { |
| 141 | 141 | $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, " |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | class Convert |
| 23 | 23 | { |
| 24 | - const LOCAL="LOCAL"; |
|
| 25 | - const SEBRAE="SEBRAE"; |
|
| 24 | + const LOCAL = "LOCAL"; |
|
| 25 | + const SEBRAE = "SEBRAE"; |
|
| 26 | 26 | |
| 27 | 27 | protected $txt; |
| 28 | 28 | protected $dados; |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | if (substr($linha, 0, 2) == 'A|') { |
| 124 | 124 | $resp[$xCount]['init'] = $iCount; |
| 125 | 125 | if ($xCount > 0) { |
| 126 | - $resp[$xCount -1]['fim'] = $iCount; |
|
| 126 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
| 127 | 127 | } |
| 128 | 128 | $xCount += 1; |
| 129 | 129 | } |
| 130 | 130 | $iCount += 1; |
| 131 | 131 | } |
| 132 | - $resp[$xCount-1]['fim'] = $iCount; |
|
| 132 | + $resp[$xCount - 1]['fim'] = $iCount; |
|
| 133 | 133 | foreach ($resp as $marc) { |
| 134 | - $length = $marc['fim']-$marc['init']; |
|
| 134 | + $length = $marc['fim'] - $marc['init']; |
|
| 135 | 135 | $aNotas[] = array_slice($array, $marc['init'], $length, false); |
| 136 | 136 | } |
| 137 | 137 | return $aNotas; |
@@ -339,9 +339,9 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | //monta a consulta |
| 341 | 341 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 342 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
| 342 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
| 343 | 343 | . "<cUFAutor>$cUF</cUFAutor>" |
| 344 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>"; |
|
| 344 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>"; |
|
| 345 | 345 | //valida o xml da requisição |
| 346 | 346 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
| 347 | 347 | $this->lastRequest = $consulta; |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $dt = new \DateTime(); |
| 585 | 585 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
| 586 | 586 | $sSeqEvento = str_pad($evt->nSeqEvento, 2, "0", STR_PAD_LEFT); |
| 587 | - $eventId = "ID".$evt->tpEvento.$evt->chave.$sSeqEvento; |
|
| 587 | + $eventId = "ID" . $evt->tpEvento . $evt->chave . $sSeqEvento; |
|
| 588 | 588 | $cOrgao = UFList::getCodeByUF($uf); |
| 589 | 589 | $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 590 | 590 | . "<infEvento Id=\"$eventId\">" |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | $dt = new \DateTime(); |
| 744 | 744 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
| 745 | 745 | $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT); |
| 746 | - $eventId = "ID".$tpEvento.$chave.$sSeqEvento; |
|
| 746 | + $eventId = "ID" . $tpEvento . $chave . $sSeqEvento; |
|
| 747 | 747 | $cOrgao = UFList::getCodeByUF($uf); |
| 748 | 748 | $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 749 | 749 | . "<infEvento Id=\"$eventId\">" |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | $this->canonical |
| 772 | 772 | ); |
| 773 | 773 | $request = Strings::clearXmlString($request, true); |
| 774 | - $lote = $dt->format('YmdHis').rand(0, 9); |
|
| 774 | + $lote = $dt->format('YmdHis') . rand(0, 9); |
|
| 775 | 775 | $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 776 | 776 | . "<idLote>$lote</idLote>" |
| 777 | 777 | . $request |
@@ -805,9 +805,9 @@ discard block |
||
| 805 | 805 | $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>"; |
| 806 | 806 | //monta a consulta |
| 807 | 807 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
| 808 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
| 808 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
| 809 | 809 | . "<cUFAutor>$cUF</cUFAutor>" |
| 810 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>"; |
|
| 810 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>"; |
|
| 811 | 811 | //valida o xml da requisição |
| 812 | 812 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
| 813 | 813 | $this->lastRequest = $consulta; |
@@ -857,8 +857,8 @@ discard block |
||
| 857 | 857 | . "<indOp>$indOp</indOp>" |
| 858 | 858 | . "<raizCNPJ>$raizCNPJ</raizCNPJ>" |
| 859 | 859 | . "<dadosCsc>" |
| 860 | - . "<idCsc>".$this->config->CSCid."</idCsc>" |
|
| 861 | - . "<codigoCsc>".$this->config->CSC."</codigoCsc>" |
|
| 860 | + . "<idCsc>" . $this->config->CSCid . "</idCsc>" |
|
| 861 | + . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>" |
|
| 862 | 862 | . "</dadosCsc>" |
| 863 | 863 | . "</admCscNFCe>"; |
| 864 | 864 | } |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | $dom->loadXML($nfe); |
| 891 | 891 | //verifica a validade no webservice da SEFAZ |
| 892 | 892 | $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue; |
| 893 | - $infNFe = $dom->getElementsByTagName('infNFe')->item(0); |
|
| 893 | + $infNFe = $dom->getElementsByTagName('infNFe')->item(0); |
|
| 894 | 894 | $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id")); |
| 895 | 895 | $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue; |
| 896 | 896 | $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue; |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | class Parser |
| 23 | 23 | { |
| 24 | - const LOCAL="LOCAL"; |
|
| 25 | - const SEBRAE="SEBRAE"; |
|
| 24 | + const LOCAL = "LOCAL"; |
|
| 25 | + const SEBRAE = "SEBRAE"; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var array |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $comp = "_sebrae"; |
| 119 | 119 | } |
| 120 | 120 | $this->baselayout = $baselayout; |
| 121 | - $path = realpath(__DIR__."/../../storage/txtstructure$ver" . $comp . ".json"); |
|
| 121 | + $path = realpath(__DIR__ . "/../../storage/txtstructure$ver" . $comp . ".json"); |
|
| 122 | 122 | $this->structure = json_decode(file_get_contents($path), true); |
| 123 | 123 | $this->make = new Make(); |
| 124 | 124 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if (empty($fields)) { |
| 150 | 150 | continue; |
| 151 | 151 | } |
| 152 | - $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity'; |
|
| 152 | + $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity'; |
|
| 153 | 153 | if (!method_exists(__CLASS__, $metodo)) { |
| 154 | 154 | throw DocumentsException::wrongDocument(16, $lin); //campo não definido |
| 155 | 155 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | protected static function fieldsToStd($dfls, $struct) |
| 169 | 169 | { |
| 170 | 170 | $sfls = explode('|', $struct); |
| 171 | - $len = count($sfls)-1; |
|
| 171 | + $len = count($sfls) - 1; |
|
| 172 | 172 | $std = new \stdClass(); |
| 173 | 173 | for ($i = 1; $i < $len; $i++) { |
| 174 | 174 | $name = $sfls[$i]; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | $this->stdPIS->CST = $std->CST; |
| 1194 | 1194 | $this->stdPIS->vPIS = $std->vPIS; |
| 1195 | 1195 | $this->stdPIS->qBCProd = $std->qBCProd; |
| 1196 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1196 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1197 | 1197 | $this->buildQEntity(); |
| 1198 | 1198 | } |
| 1199 | 1199 | |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | protected function q10Entity($std) |
| 1245 | 1245 | { |
| 1246 | 1246 | $this->stdPIS->qBCProd = $std->qBCProd; |
| 1247 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1247 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
| 1248 | 1248 | $this->buildQEntity(); |
| 1249 | 1249 | } |
| 1250 | 1250 | |
@@ -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 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | //205 NFe Denegada |
| 258 | 258 | //301 Uso denegado por irregularidade fiscal do emitente |
| 259 | 259 | //302 Uso denegado por irregularidade fiscal do destinatário |
| 260 | - $cstatpermit = ['100', '150', '110', '205', '301','302']; |
|
| 260 | + $cstatpermit = ['100', '150', '110', '205', '301', '302']; |
|
| 261 | 261 | if (!in_array($cStat, $cstatpermit)) { |
| 262 | 262 | throw DocumentsException::wrongDocument(4, "[$cStat] $xMotivo"); |
| 263 | 263 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue; |
| 304 | 304 | //extrai a rag retEvento da resposta (retorno da SEFAZ) |
| 305 | 305 | $retEv = $ret->getElementsByTagName('retEvento')->item(0); |
| 306 | - $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 306 | + $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
| 307 | 307 | $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
| 308 | 308 | $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue; |
| 309 | 309 | $cStatValids = ['135', '136']; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | { |
| 340 | 340 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
| 341 | 341 | . "<$nodename versao=\"$versao\" " |
| 342 | - . "xmlns=\"".self::$urlPortal."\">"; |
|
| 342 | + . "xmlns=\"" . self::$urlPortal . "\">"; |
|
| 343 | 343 | $xml .= $first; |
| 344 | 344 | $xml .= $second; |
| 345 | 345 | $xml .= "</$nodename>"; |