@@ -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)) { |
@@ -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; |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | |
1229 | 1229 | $identificador = '#4 <infPercurso> - '; |
1230 | 1230 | $this->infPercurso[] = $this->dom->createElement('infPercurso'); |
1231 | - $posicao = (int)count($this->infPercurso) - 1; |
|
1231 | + $posicao = (int) count($this->infPercurso) - 1; |
|
1232 | 1232 | $this->dom->addChild( |
1233 | 1233 | $this->infPercurso[$posicao], |
1234 | 1234 | 'UFPer', |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | |
1874 | 1874 | $identificador = '#65 <pass> - '; |
1875 | 1875 | $this->pass[] = $this->dom->createElement('pass'); |
1876 | - $posicao = (int)count($this->pass) - 1; |
|
1876 | + $posicao = (int) count($this->pass) - 1; |
|
1877 | 1877 | $this->dom->addChild( |
1878 | 1878 | $this->pass[$posicao], |
1879 | 1879 | 'xPass', |
@@ -2128,7 +2128,7 @@ discard block |
||
2128 | 2128 | $identificador = '#91 <ObsCont> - '; |
2129 | 2129 | if (count($this->obsCont) <= 10) { |
2130 | 2130 | $this->obsCont[] = $this->dom->createElement('ObsCont'); |
2131 | - $posicao = (int)count($this->obsCont) - 1; |
|
2131 | + $posicao = (int) count($this->obsCont) - 1; |
|
2132 | 2132 | $this->obsCont[$posicao]->setAttribute('xCampo', $std->xCampo); |
2133 | 2133 | $this->dom->addChild( |
2134 | 2134 | $this->obsCont[$posicao], |
@@ -2140,9 +2140,9 @@ discard block |
||
2140 | 2140 | return true; |
2141 | 2141 | } |
2142 | 2142 | $this->errors[] = array( |
2143 | - 'tag' => (string)'<ObsCont>', |
|
2144 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
2145 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
2143 | + 'tag' => (string) '<ObsCont>', |
|
2144 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
2145 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
2146 | 2146 | ); |
2147 | 2147 | return false; |
2148 | 2148 | } |
@@ -2169,7 +2169,7 @@ discard block |
||
2169 | 2169 | $identificador = '#94 <ObsFisco> - '; |
2170 | 2170 | if (count($this->obsFisco) <= 10) { |
2171 | 2171 | $this->obsFisco[] = $this->dom->createElement('ObsFisco'); |
2172 | - $posicao = (int)count($this->obsFisco) - 1; |
|
2172 | + $posicao = (int) count($this->obsFisco) - 1; |
|
2173 | 2173 | $this->obsFisco[$posicao]->setAttribute('xCampo', $std->xCampo); |
2174 | 2174 | $this->dom->addChild( |
2175 | 2175 | $this->obsFisco[$posicao], |
@@ -2181,9 +2181,9 @@ discard block |
||
2181 | 2181 | return true; |
2182 | 2182 | } |
2183 | 2183 | $this->errors[] = array( |
2184 | - 'tag' => (string)'<ObsFisco>', |
|
2185 | - 'desc' => (string)'Campo de uso livre do contribuinte', |
|
2186 | - 'erro' => (string)'Tag deve aparecer de 0 a 10 vezes' |
|
2184 | + 'tag' => (string) '<ObsFisco>', |
|
2185 | + 'desc' => (string) 'Campo de uso livre do contribuinte', |
|
2186 | + 'erro' => (string) 'Tag deve aparecer de 0 a 10 vezes' |
|
2187 | 2187 | ); |
2188 | 2188 | return false; |
2189 | 2189 | } |
@@ -3211,7 +3211,7 @@ discard block |
||
3211 | 3211 | |
3212 | 3212 | $identificador = '#65 <pass> - '; |
3213 | 3213 | $this->comp[] = $this->dom->createElement('Comp'); |
3214 | - $posicao = (int)count($this->comp) - 1; |
|
3214 | + $posicao = (int) count($this->comp) - 1; |
|
3215 | 3215 | $this->dom->addChild( |
3216 | 3216 | $this->comp[$posicao], |
3217 | 3217 | 'xNome', |
@@ -3672,7 +3672,7 @@ discard block |
||
3672 | 3672 | |
3673 | 3673 | $identificador = '#257 <infQ> - '; |
3674 | 3674 | $this->infQ[] = $this->dom->createElement('infQ'); |
3675 | - $posicao = (int)count($this->infQ) - 1; |
|
3675 | + $posicao = (int) count($this->infQ) - 1; |
|
3676 | 3676 | $this->dom->addChild( |
3677 | 3677 | $this->infQ[$posicao], |
3678 | 3678 | 'cUnid', |
@@ -4171,7 +4171,7 @@ discard block |
||
4171 | 4171 | |
4172 | 4172 | $ident = '#319 <infDocRef> - '; |
4173 | 4173 | $this->infDocRef[] = $this->dom->createElement('infDocRef'); |
4174 | - $posicao = (int)count($this->infDocRef) - 1; |
|
4174 | + $posicao = (int) count($this->infDocRef) - 1; |
|
4175 | 4175 | $this->dom->addChild( |
4176 | 4176 | $this->infDocRef[$posicao], |
4177 | 4177 | 'nDoc', |
@@ -4231,7 +4231,7 @@ discard block |
||
4231 | 4231 | |
4232 | 4232 | $identificador = '#345 <emiDocAnt> - '; |
4233 | 4233 | $this->emiDocAnt[] = $this->dom->createElement('emiDocAnt'); |
4234 | - $posicao = (int)count($this->emiDocAnt) - 1; |
|
4234 | + $posicao = (int) count($this->emiDocAnt) - 1; |
|
4235 | 4235 | if ($std->CNPJ != '') { |
4236 | 4236 | $this->dom->addChild( |
4237 | 4237 | $this->emiDocAnt[$posicao], |
@@ -4290,7 +4290,7 @@ discard block |
||
4290 | 4290 | |
4291 | 4291 | $identificador = '#358 <idDocAntEle> - '; |
4292 | 4292 | $this->idDocAntEle[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntEle'); |
4293 | - $posicao = (int)count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
4293 | + $posicao = (int) count($this->idDocAntEle[count($this->emiDocAnt) - 1]) - 1; |
|
4294 | 4294 | $this->dom->addChild( |
4295 | 4295 | $this->idDocAntEle[count($this->emiDocAnt) - 1][$posicao], |
4296 | 4296 | 'chCTe', |
@@ -4321,7 +4321,7 @@ discard block |
||
4321 | 4321 | |
4322 | 4322 | $identificador = '#360 <seg> - '; |
4323 | 4323 | $this->seg[] = $this->dom->createElement('seg'); |
4324 | - $posicao = (int)count($this->seg) - 1; |
|
4324 | + $posicao = (int) count($this->seg) - 1; |
|
4325 | 4325 | $this->dom->addChild( |
4326 | 4326 | $this->seg[$posicao], |
4327 | 4327 | 'respSeg', |
@@ -4367,7 +4367,7 @@ discard block |
||
4367 | 4367 | |
4368 | 4368 | $identificador = '#358 <idDocAntPap> - '; |
4369 | 4369 | $this->idDocAntPap[count($this->emiDocAnt) - 1][] = $this->dom->createElement('idDocAntPap'); |
4370 | - $posicao = (int)count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
4370 | + $posicao = (int) count($this->idDocAntPap[count($this->emiDocAnt) - 1]) - 1; |
|
4371 | 4371 | $this->dom->addChild( |
4372 | 4372 | $this->idDocAntPap[count($this->emiDocAnt) - 1][$posicao], |
4373 | 4373 | 'tpDoc', |
@@ -4648,7 +4648,7 @@ discard block |
||
4648 | 4648 | |
4649 | 4649 | $identificador = '#12 <detCont> - '; |
4650 | 4650 | $this->lacre[count($this->detCont) - 1][] = $this->dom->createElement('lacre'); |
4651 | - $posicao = (int)count($this->lacre[count($this->detCont) - 1]) - 1; |
|
4651 | + $posicao = (int) count($this->lacre[count($this->detCont) - 1]) - 1; |
|
4652 | 4652 | |
4653 | 4653 | $this->dom->addChild( |
4654 | 4654 | $this->lacre[count($this->detCont) - 1][$posicao], |
@@ -4676,7 +4676,7 @@ discard block |
||
4676 | 4676 | $std = $this->equilizeParameters($std, $possible); |
4677 | 4677 | $identificador = '#15 <detCont> <infNF> - '; |
4678 | 4678 | $this->infNFCont[count($this->detCont) - 1][] = $this->dom->createElement('infNF'); |
4679 | - $posicao = (int)count($this->infNFCont[count($this->detCont) - 1]) - 1; |
|
4679 | + $posicao = (int) count($this->infNFCont[count($this->detCont) - 1]) - 1; |
|
4680 | 4680 | |
4681 | 4681 | $this->dom->addChild( |
4682 | 4682 | $this->infNFCont[count($this->detCont) - 1][$posicao], |
@@ -4715,7 +4715,7 @@ discard block |
||
4715 | 4715 | $std = $this->equilizeParameters($std, $possible); |
4716 | 4716 | $identificador = '#19 <infNFe> - '; |
4717 | 4717 | $this->infNFeCont[count($this->detCont) - 1][] = $this->dom->createElement('infNFe'); |
4718 | - $posicao = (int)count($this->infNFeCont[count($this->detCont) - 1]) - 1; |
|
4718 | + $posicao = (int) count($this->infNFeCont[count($this->detCont) - 1]) - 1; |
|
4719 | 4719 | |
4720 | 4720 | $this->dom->addChild( |
4721 | 4721 | $this->infNFeCont[count($this->detCont) - 1][$posicao], |