@@ -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; |
@@ -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 |
@@ -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 | } |
@@ -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)) { |
@@ -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) |
@@ -1729,7 +1729,7 @@ discard block |
||
1729 | 1729 | true, |
1730 | 1730 | $identificador . "[item $std->item] Indica se valor do Item (vProd) entra no valor total da NF-e (vProd)" |
1731 | 1731 | ); |
1732 | - if (!empty($std->xPed) && !empty($std->nItemPed)) { |
|
1732 | + if (!empty($std->xPed) && !empty($std->nItemPed)) { |
|
1733 | 1733 | $this->dom->addChild( |
1734 | 1734 | $prod, |
1735 | 1735 | "xPed", |
@@ -2078,7 +2078,7 @@ discard block |
||
2078 | 2078 | $identificador . "[item $std->item] Quantidade do item realmente exportado" |
2079 | 2079 | ); |
2080 | 2080 | //obtem o ultimo detExport |
2081 | - $nDE = count($this->aDetExport[$std->item])-1; |
|
2081 | + $nDE = count($this->aDetExport[$std->item]) - 1; |
|
2082 | 2082 | if ($nDE < 0) { |
2083 | 2083 | throw new RuntimeException('A TAG detExportInd deve ser criada depois da detExport, pois pertence a ela.'); |
2084 | 2084 | } |
@@ -6108,14 +6108,14 @@ discard block |
||
6108 | 6108 | if ($this->version === '3.10') { |
6109 | 6109 | $n = count($this->aPag); |
6110 | 6110 | $this->dom->addChild( |
6111 | - $this->aPag[$n-1], |
|
6111 | + $this->aPag[$n - 1], |
|
6112 | 6112 | "tPag", |
6113 | 6113 | $std->tPag, |
6114 | 6114 | true, |
6115 | 6115 | "Forma de pagamento" |
6116 | 6116 | ); |
6117 | 6117 | $this->dom->addChild( |
6118 | - $this->aPag[$n-1], |
|
6118 | + $this->aPag[$n - 1], |
|
6119 | 6119 | "vPag", |
6120 | 6120 | $std->vPag, |
6121 | 6121 | true, |
@@ -6151,9 +6151,9 @@ discard block |
||
6151 | 6151 | false, |
6152 | 6152 | "Número de autorização da operação cartão de crédito e/ou débito" |
6153 | 6153 | ); |
6154 | - $this->dom->appChild($this->aPag[$n-1], $card, "Inclusão do node Card"); |
|
6154 | + $this->dom->appChild($this->aPag[$n - 1], $card, "Inclusão do node Card"); |
|
6155 | 6155 | } |
6156 | - return $this->aPag[$n-1]; |
|
6156 | + return $this->aPag[$n - 1]; |
|
6157 | 6157 | } else { |
6158 | 6158 | //padrão para layout 4.00 |
6159 | 6159 | $detPag = $this->dom->createElement("detPag"); |
@@ -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) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * Canonical conversion options |
100 | 100 | * @var array |
101 | 101 | */ |
102 | - protected $canonical = [true,false,null,null]; |
|
102 | + protected $canonical = [true, false, null, null]; |
|
103 | 103 | /** |
104 | 104 | * Model of NFe 55 or 65 |
105 | 105 | * @var int |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | { |
187 | 187 | $this->pathwsfiles = realpath( |
188 | 188 | __DIR__ . '/../../storage' |
189 | - ).'/'; |
|
189 | + ) . '/'; |
|
190 | 190 | //valid config json string |
191 | 191 | $this->config = Config::validate($configJson); |
192 | 192 | |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | $this->versao = $version; |
273 | 273 | $this->config->schemes = $this->availableVersions[$version]; |
274 | 274 | $this->pathschemes = realpath( |
275 | - __DIR__ . '/../../schemes/'. $this->config->schemes |
|
276 | - ).'/'; |
|
275 | + __DIR__ . '/../../schemes/' . $this->config->schemes |
|
276 | + ) . '/'; |
|
277 | 277 | |
278 | 278 | return $this->versao; |
279 | 279 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | protected function isValid($version, $body, $method) |
378 | 378 | { |
379 | - $schema = $this->pathschemes.$method."_v$version.xsd"; |
|
379 | + $schema = $this->pathschemes . $method . "_v$version.xsd"; |
|
380 | 380 | if (!is_file($schema)) { |
381 | 381 | return true; |
382 | 382 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @param array $opt |
443 | 443 | * @return array |
444 | 444 | */ |
445 | - public function canonicalOptions($opt = [true,false,null,null]) |
|
445 | + public function canonicalOptions($opt = [true, false, null, null]) |
|
446 | 446 | { |
447 | 447 | if (!empty($opt) && is_array($opt)) { |
448 | 448 | $this->canonical = $opt; |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | protected function getXmlUrlPath() |
561 | 561 | { |
562 | 562 | $file = $this->pathwsfiles |
563 | - . "wsnfe_".$this->versao."_mod55.xml"; |
|
563 | + . "wsnfe_" . $this->versao . "_mod55.xml"; |
|
564 | 564 | if ($this->modelo == 65) { |
565 | 565 | $file = str_replace('55', '65', $file); |
566 | 566 | } |
567 | - if (! file_exists($file)) { |
|
567 | + if (!file_exists($file)) { |
|
568 | 568 | return ''; |
569 | 569 | } |
570 | 570 | return file_get_contents($file); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | //os URI estão em storage/uri_consulta_nfce.json |
620 | 620 | $arr = json_decode( |
621 | 621 | file_get_contents( |
622 | - $this->pathwsfiles.'uri_consulta_nfce.json' |
|
622 | + $this->pathwsfiles . 'uri_consulta_nfce.json' |
|
623 | 623 | ), |
624 | 624 | true |
625 | 625 | ); |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | $seq .= '&vICMS=' . $vICMS; |
167 | 167 | $seq .= '&digVal=' . strtolower($digHex); |
168 | 168 | $seq .= '&cIdToken=' . str_pad($idToken, 6, '0', STR_PAD_LEFT); |
169 | - $hash = sha1($seq.$token); |
|
170 | - $seq .= '&cHashQRCode='. strtoupper($hash); |
|
169 | + $hash = sha1($seq . $token); |
|
170 | + $seq .= '&cHashQRCode=' . strtoupper($hash); |
|
171 | 171 | if (strpos($url, '?') === false) { |
172 | - $url = $url.'?'; |
|
172 | + $url = $url . '?'; |
|
173 | 173 | } |
174 | - return $url.$seq; |
|
174 | + return $url . $seq; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -204,15 +204,15 @@ discard block |
||
204 | 204 | $tpEmis, |
205 | 205 | $cDest |
206 | 206 | ) { |
207 | - $ver = $versao/100; |
|
207 | + $ver = $versao / 100; |
|
208 | 208 | $cscId = (int) $idToken; |
209 | 209 | $csc = $token; |
210 | 210 | if (strpos($url, '?p=') === false) { |
211 | - $url = $url.'?p='; |
|
211 | + $url = $url . '?p='; |
|
212 | 212 | } |
213 | 213 | if ($tpEmis != 9) { |
214 | 214 | $seq = "$chNFe|$ver|$tpAmb|$cscId"; |
215 | - $hash = strtoupper(sha1($seq.$csc)); |
|
215 | + $hash = strtoupper(sha1($seq . $csc)); |
|
216 | 216 | return "$url$seq|$hash"; |
217 | 217 | } |
218 | 218 | $dt = new \DateTime($dhEmi); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $valor = number_format($vNF, 2, '.', ''); |
221 | 221 | $digHex = self::str2Hex($digVal); |
222 | 222 | $seq = "$chNFe|$ver|$tpAmb|$dia|$valor|$digHex|$cscId"; |
223 | - $hash = strtoupper(sha1($seq.$csc)); |
|
223 | + $hash = strtoupper(sha1($seq . $csc)); |
|
224 | 224 | return "$url$seq|$hash"; |
225 | 225 | } |
226 | 226 |