@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function __construct($version = '3.10') |
108 | 108 | { |
109 | 109 | $ver = str_replace('.', '', $version); |
110 | - $path = realpath(__DIR__."/../../storage/txtstructure$ver.json"); |
|
110 | + $path = realpath(__DIR__ . "/../../storage/txtstructure$ver.json"); |
|
111 | 111 | $this->structure = json_decode(file_get_contents($path), true); |
112 | 112 | $this->make = new Make(); |
113 | 113 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (empty($fields)) { |
139 | 139 | continue; |
140 | 140 | } |
141 | - $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity'; |
|
141 | + $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity'; |
|
142 | 142 | if (!method_exists(__CLASS__, $metodo)) { |
143 | 143 | //campo não definido |
144 | 144 | throw DocumentsException::wrongDocument(16, $lin); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | protected static function fieldsToStd($dfls, $struct) |
159 | 159 | { |
160 | 160 | $sfls = explode('|', $struct); |
161 | - $len = count($sfls)-1; |
|
161 | + $len = count($sfls) - 1; |
|
162 | 162 | $std = new \stdClass(); |
163 | 163 | for ($i = 1; $i < $len; $i++) { |
164 | 164 | $name = $sfls[$i]; |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | $this->stdPIS->CST = $std->CST; |
1232 | 1232 | $this->stdPIS->vPIS = $std->vPIS; |
1233 | 1233 | $this->stdPIS->qBCProd = $std->qBCProd; |
1234 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1234 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1235 | 1235 | $this->buildQEntity(); |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | protected function q10Entity($std) |
1283 | 1283 | { |
1284 | 1284 | $this->stdPIS->qBCProd = $std->qBCProd; |
1285 | - $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1285 | + $this->stdPIS->vAliqProd = $std->vAliqProd; |
|
1286 | 1286 | $this->buildQEntity(); |
1287 | 1287 | } |
1288 | 1288 |
@@ -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)) { |
@@ -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 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | throw DocumentsException::wrongDocument(3, "<protCTe>"); |
129 | 129 | } |
130 | 130 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
131 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
131 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
132 | 132 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
133 | 133 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
134 | 134 | $digProt = '000'; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | throw DocumentsException::wrongDocument(3, "<protCTe>"); |
186 | 186 | } |
187 | 187 | $infProt = $ret->getElementsByTagName('infProt')->item(0); |
188 | - $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
188 | + $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
189 | 189 | $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
190 | 190 | $dig = $infProt->getElementsByTagName("digVal")->item(0); |
191 | 191 | $digProt = '000'; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue; |
239 | 239 | //extrai a rag retEvento da resposta (retorno da SEFAZ) |
240 | 240 | $retEv = $ret->getElementsByTagName('retEventoCTe')->item(0); |
241 | - $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
241 | + $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue; |
|
242 | 242 | $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue; |
243 | 243 | $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue; |
244 | 244 | $cStatValids = ['135', '136']; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" |
271 | 271 | . "<$nodename versao=\"$versao\" " |
272 | - . "xmlns=\"".self::$urlPortal."\">"; |
|
272 | + . "xmlns=\"" . self::$urlPortal . "\">"; |
|
273 | 273 | $xml .= $first; |
274 | 274 | $xml .= $second; |
275 | 275 | $xml .= "</$nodename>"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ($compactar) { |
82 | 82 | $gzdata = base64_encode(gzencode($cons, 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,9 +374,9 @@ 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 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>"; |
|
379 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>"; |
|
380 | 380 | //valida o xml da requisição |
381 | 381 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
382 | 382 | $this->lastRequest = $consulta; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $dt = new \DateTime(); |
667 | 667 | $dhEvento = $dt->format('Y-m-d\TH:i:sP'); |
668 | 668 | $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT); |
669 | - $eventId = "ID".$tpEvento.$chave.$sSeqEvento; |
|
669 | + $eventId = "ID" . $tpEvento . $chave . $sSeqEvento; |
|
670 | 670 | $cOrgao = UFList::getCodeByUF($uf); |
671 | 671 | |
672 | 672 | $request = "<eventoCTe xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
@@ -731,9 +731,9 @@ discard block |
||
731 | 731 | $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>"; |
732 | 732 | //monta a consulta |
733 | 733 | $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">" |
734 | - . "<tpAmb>".$this->tpAmb."</tpAmb>" |
|
734 | + . "<tpAmb>" . $this->tpAmb . "</tpAmb>" |
|
735 | 735 | . "<cUFAutor>$cUF</cUFAutor>" |
736 | - . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>"; |
|
736 | + . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>"; |
|
737 | 737 | //valida o xml da requisição |
738 | 738 | $this->isValid($this->urlVersion, $consulta, 'distDFeInt'); |
739 | 739 | $this->lastRequest = $consulta; |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | . "<indOp>$indOp</indOp>" |
786 | 786 | . "<raizCNPJ>$raizCNPJ</raizCNPJ>" |
787 | 787 | . "<dadosCsc>" |
788 | - . "<idCsc>".$this->config->CSCid."</idCsc>" |
|
789 | - . "<codigoCsc>".$this->config->CSC."</codigoCsc>" |
|
788 | + . "<idCsc>" . $this->config->CSCid . "</idCsc>" |
|
789 | + . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>" |
|
790 | 790 | . "</dadosCsc>" |
791 | 791 | . "</admCscNFCe>"; |
792 | 792 | } |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $dom->loadXML($cte); |
818 | 818 | //verifica a validade no webservice da SEFAZ |
819 | 819 | $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue; |
820 | - $infCTe = $dom->getElementsByTagName('infCte')->item(0); |
|
820 | + $infCTe = $dom->getElementsByTagName('infCte')->item(0); |
|
821 | 821 | $chCTe = preg_replace('/[^0-9]/', '', $infCTe->getAttribute("Id")); |
822 | 822 | $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue; |
823 | 823 | $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue; |
@@ -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(); |
@@ -516,7 +516,7 @@ |
||
516 | 516 | protected function sendRequest($request, array $parameters = []) |
517 | 517 | { |
518 | 518 | $this->checkSoap(); |
519 | - return (string)$this->soap->send( |
|
519 | + return (string) $this->soap->send( |
|
520 | 520 | $this->urlService, |
521 | 521 | $this->urlMethod, |
522 | 522 | $this->urlAction, |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | { |
1138 | 1138 | $identificador = '#4 <infPercurso> - '; |
1139 | 1139 | $this->infPercurso[] = $this->dom->createElement('infPercurso'); |
1140 | - $posicao = (int)count($this->infPercurso) - 1; |
|
1140 | + $posicao = (int) count($this->infPercurso) - 1; |
|
1141 | 1141 | $this->dom->addChild( |
1142 | 1142 | $this->infPercurso[$posicao], |
1143 | 1143 | 'UFPer', |
@@ -1654,7 +1654,7 @@ discard block |
||
1654 | 1654 | { |
1655 | 1655 | $identificador = '#65 <pass> - '; |
1656 | 1656 | $this->pass[] = $this->dom->createElement('pass'); |
1657 | - $posicao = (int)count($this->pass) - 1; |
|
1657 | + $posicao = (int) count($this->pass) - 1; |
|
1658 | 1658 | $this->dom->addChild( |
1659 | 1659 | $this->pass[$posicao], |
1660 | 1660 | 'xPass', |
@@ -1853,7 +1853,7 @@ discard block |
||
1853 | 1853 | $identificador = '#91 <ObsCont> - '; |
1854 | 1854 | if (count($this->obsCont) <= 10) { |
1855 | 1855 | $this->obsCont[] = $this->dom->createElement('ObsCont'); |
1856 | - $posicao = (int)count($this->obsCont) - 1; |
|
1856 | + $posicao = (int) count($this->obsCont) - 1; |
|
1857 | 1857 | $this->obsCont[$posicao]->setAttribute('xCampo', $std->xCampo); |
1858 | 1858 | $this->dom->addChild( |
1859 | 1859 | $this->obsCont[$posicao], |
@@ -1865,9 +1865,9 @@ discard block |
||
1865 | 1865 | return true; |
1866 | 1866 | } |
1867 | 1867 | $this->errors[] = array( |
1868 | - 'tag' => (string)'<ObsCont>', |
|
1869 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
1870 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
1868 | + 'tag' => (string) '<ObsCont>', |
|
1869 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
1870 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
1871 | 1871 | ); |
1872 | 1872 | return false; |
1873 | 1873 | } |
@@ -1886,7 +1886,7 @@ discard block |
||
1886 | 1886 | $identificador = '#94 <ObsFisco> - '; |
1887 | 1887 | if (count($this->obsFisco) <= 10) { |
1888 | 1888 | $this->obsFisco[] = $this->dom->createElement('ObsFisco'); |
1889 | - $posicao = (int)count($this->obsFisco) - 1; |
|
1889 | + $posicao = (int) count($this->obsFisco) - 1; |
|
1890 | 1890 | $this->obsFisco[$posicao]->setAttribute('xCampo', $std->xCampo); |
1891 | 1891 | $this->dom->addChild( |
1892 | 1892 | $this->obsFisco[$posicao], |
@@ -1898,9 +1898,9 @@ discard block |
||
1898 | 1898 | return true; |
1899 | 1899 | } |
1900 | 1900 | $this->errors[] = array( |
1901 | - 'tag' => (string)'<ObsFisco>', |
|
1902 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
1903 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
1901 | + 'tag' => (string) '<ObsFisco>', |
|
1902 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
1903 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
1904 | 1904 | ); |
1905 | 1905 | return false; |
1906 | 1906 | } |
@@ -2772,7 +2772,7 @@ discard block |
||
2772 | 2772 | { |
2773 | 2773 | $identificador = '#65 <pass> - '; |
2774 | 2774 | $this->comp[] = $this->dom->createElement('Comp'); |
2775 | - $posicao = (int)count($this->comp) - 1; |
|
2775 | + $posicao = (int) count($this->comp) - 1; |
|
2776 | 2776 | $this->dom->addChild( |
2777 | 2777 | $this->comp[$posicao], |
2778 | 2778 | 'xNome', |
@@ -3169,7 +3169,7 @@ discard block |
||
3169 | 3169 | { |
3170 | 3170 | $identificador = '#257 <infQ> - '; |
3171 | 3171 | $this->infQ[] = $this->dom->createElement('infQ'); |
3172 | - $posicao = (int)count($this->infQ) - 1; |
|
3172 | + $posicao = (int) count($this->infQ) - 1; |
|
3173 | 3173 | $this->dom->addChild($this->infQ[$posicao], 'cUnid', $std->cUnid, true, $identificador . 'Código da |
3174 | 3174 | Unidade de Medida'); |
3175 | 3175 | $this->dom->addChild($this->infQ[$posicao], 'tpMed', $std->tpMed, true, $identificador . 'Tipo da Medida'); |
@@ -3220,7 +3220,7 @@ discard block |
||
3220 | 3220 | { |
3221 | 3221 | $identificador = '#262 <infNF> - '; |
3222 | 3222 | $this->infNF[] = $this->dom->createElement('infNF'); |
3223 | - $posicao = (int)count($this->infNF) - 1; |
|
3223 | + $posicao = (int) count($this->infNF) - 1; |
|
3224 | 3224 | |
3225 | 3225 | $this->dom->addChild($this->infNF[$posicao], 'nRoma', $std->nRoma, false, $identificador . 'Número do |
3226 | 3226 | Romaneio da NF'); |
@@ -3261,7 +3261,7 @@ discard block |
||
3261 | 3261 | { |
3262 | 3262 | $identificador = '#297 <infNFe> - '; |
3263 | 3263 | $this->infNFe[] = $this->dom->createElement('infNFe'); |
3264 | - $posicao = (int)count($this->infNFe) - 1; |
|
3264 | + $posicao = (int) count($this->infNFe) - 1; |
|
3265 | 3265 | $this->dom->addChild( |
3266 | 3266 | $this->infNFe[$posicao], |
3267 | 3267 | 'chave', |
@@ -3296,7 +3296,7 @@ discard block |
||
3296 | 3296 | { |
3297 | 3297 | $ident = '#319 <infOutros> - '; |
3298 | 3298 | $this->infOutros[] = $this->dom->createElement('infOutros'); |
3299 | - $posicao = (int)count($this->infOutros) - 1; |
|
3299 | + $posicao = (int) count($this->infOutros) - 1; |
|
3300 | 3300 | $this->dom->addChild($this->infOutros[$posicao], 'tpDoc', $std->tpDoc, true, $ident . 'Tipo ' |
3301 | 3301 | . 'de documento originário'); |
3302 | 3302 | $this->dom->addChild($this->infOutros[$posicao], 'descOutros', $std->descOutros, false, $ident . 'Descrição ' |
@@ -3321,7 +3321,7 @@ discard block |
||
3321 | 3321 | { |
3322 | 3322 | $ident = '#319 <infDocRef> - '; |
3323 | 3323 | $this->infDocRef[] = $this->dom->createElement('infDocRef'); |
3324 | - $posicao = (int)count($this->infDocRef) - 1; |
|
3324 | + $posicao = (int) count($this->infDocRef) - 1; |
|
3325 | 3325 | $this->dom->addChild($this->infDocRef[$posicao], 'nDoc', $std->nDoc, false, $ident . 'Número ' |
3326 | 3326 | . 'do documento'); |
3327 | 3327 | $this->dom->addChild($this->infDocRef[$posicao], 'serie', $std->serie, false, $ident . 'Série ' |
@@ -3344,7 +3344,7 @@ discard block |
||
3344 | 3344 | { |
3345 | 3345 | $identificador = '#345 <emiDocAnt> - '; |
3346 | 3346 | $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt'); |
3347 | - $posicao = (int)count($this->emiDocAnt) - 1; |
|
3347 | + $posicao = (int) count($this->emiDocAnt) - 1; |
|
3348 | 3348 | if ($std->CNPJ != '') { |
3349 | 3349 | $this->dom->addChild( |
3350 | 3350 | $this->emiDocAnt[$posicao], |
@@ -3385,7 +3385,7 @@ discard block |
||
3385 | 3385 | { |
3386 | 3386 | $identificador = '#358 <idDocAntEle> - '; |
3387 | 3387 | $this->idDocAntEle[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntEle'); |
3388 | - $posicao = (int)count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
3388 | + $posicao = (int) count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
3389 | 3389 | $this->dom->addChild( |
3390 | 3390 | $this->idDocAntEle[count($this->emiDocAnt) - 1][$posicao], |
3391 | 3391 | 'chCTe', |
@@ -3407,7 +3407,7 @@ discard block |
||
3407 | 3407 | { |
3408 | 3408 | $identificador = '#360 <seg> - '; |
3409 | 3409 | $this->seg[] = $this->dom->createElement('seg'); |
3410 | - $posicao = (int)count($this->seg) - 1; |
|
3410 | + $posicao = (int) count($this->seg) - 1; |
|
3411 | 3411 | |
3412 | 3412 | $this->dom->addChild($this->seg[$posicao], 'respSeg', $std->respSeg, true, $identificador . 'Responsável |
3413 | 3413 | pelo Seguro'); |
@@ -3428,7 +3428,7 @@ discard block |
||
3428 | 3428 | $identificador = '#358 <idDocAntPap> - '; |
3429 | 3429 | |
3430 | 3430 | $this->idDocAntPap[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntPap'); |
3431 | - $posicao = (int)count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
3431 | + $posicao = (int) count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
3432 | 3432 | |
3433 | 3433 | $this->dom->addChild( |
3434 | 3434 | $this->idDocAntPap[count($this->emiDocAnt) - 1][$posicao], |