Passed
Pull Request — master (#450)
by Sebastiao
02:43
created
src/Convert.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,15 +109,15 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Factories/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Factories/ContingencyNFe.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Common/ValidTXT.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/Complements.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         $digProt = '000';
245 245
         foreach ($retProt as $rp) {
246 246
             $infProt = $rp->getElementsByTagName('infProt')->item(0);
247
-            $cStat  = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
247
+            $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
248 248
             $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue;
249 249
             $dig = $infProt->getElementsByTagName("digVal")->item(0);
250 250
             $key = $infProt->getElementsByTagName("chNFe")->item(0)->nodeValue;
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
         $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue;
302 302
         //extrai a rag retEvento da resposta (retorno da SEFAZ)
303 303
         $retEv = $ret->getElementsByTagName('retEvento')->item(0);
304
-        $cStat  = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
304
+        $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
305 305
         $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue;
306 306
         $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue;
307 307
         $cStatValids = ['135', '136'];
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
     {
338 338
         $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
339 339
                 . "<$nodename versao=\"$versao\" "
340
-                . "xmlns=\"".self::$urlPortal."\">";
340
+                . "xmlns=\"" . self::$urlPortal . "\">";
341 341
         $xml .= $first;
342 342
         $xml .= $second;
343 343
         $xml .= "</$nodename>";
Please login to merge, or discard this patch.
src/Common/FakePretty.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
         $html .= '<h2>body</h2>';
67 67
         $html .= str_replace(
68 68
             ['<', '>'],
69
-            ['&lt;','&gt;'],
69
+            ['&lt;', '&gt;'],
70 70
             str_replace(
71 71
                 '<?xml version="1.0"?>',
72 72
                 '<?xml version="1.0" encoding="UTF-8"?>',
Please login to merge, or discard this patch.
src/Common/Config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
src/Common/Tools.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         );
Please login to merge, or discard this patch.
src/Factories/QRCode.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.