Test Failed
Pull Request — master (#214)
by Eduardo
02:17
created
src/Factories/QRCode.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -158,12 +158,12 @@
 block discarded – undo
158 158
         $seq .= '&vICMS=' . $vICMS;
159 159
         $seq .= '&digVal=' . strtolower($digHex);
160 160
         $seq .= '&cIdToken=' . str_pad($idToken, 6, '0', STR_PAD_LEFT);
161
-        $hash = sha1($seq.$token);
162
-        $seq .= '&cHashQRCode='. strtoupper($hash);
161
+        $hash = sha1($seq . $token);
162
+        $seq .= '&cHashQRCode=' . strtoupper($hash);
163 163
         if (strpos($url, '?') === false) {
164
-            $url = $url.'?';
164
+            $url = $url . '?';
165 165
         }
166
-        return $url.$seq;
166
+        return $url . $seq;
167 167
     }
168 168
     
169 169
     /**
Please login to merge, or discard this patch.
src/Common/Config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,9 +48,9 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
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/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
     
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             throw DocumentsException::wrongDocument(3, "<protNFe>");
240 240
         }
241 241
         $infProt = $ret->getElementsByTagName('infProt')->item(0);
242
-        $cStat  = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
242
+        $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
243 243
         $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue;
244 244
         $dig = $infProt->getElementsByTagName("digVal")->item(0);
245 245
         $digProt = '000';
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue;
293 293
         //extrai a rag retEvento da resposta (retorno da SEFAZ)
294 294
         $retEv = $ret->getElementsByTagName('retEvento')->item(0);
295
-        $cStat  = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
295
+        $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
296 296
         $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue;
297 297
         $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue;
298 298
         $cStatValids = ['135', '136'];
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     {
329 329
         $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
330 330
                 . "<$nodename versao=\"$versao\" "
331
-                . "xmlns=\"".self::$urlPortal."\">";
331
+                . "xmlns=\"" . self::$urlPortal . "\">";
332 332
         $xml .= $first;
333 333
         $xml .= $second;
334 334
         $xml .= "</$nodename>";
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/Common/Tools.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * Canonical conversion options
98 98
      * @var array
99 99
      */
100
-    protected $canonical = [true,false,null,null];
100
+    protected $canonical = [true, false, null, null];
101 101
     /**
102 102
      * Model of NFe 55 or 65
103 103
      * @var int
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         $this->config = json_decode($configJson);
186 186
         $this->pathwsfiles = realpath(
187 187
             __DIR__ . '/../../storage'
188
-        ).'/';
188
+        ) . '/';
189 189
         $this->version($this->config->versao);
190 190
         $this->setEnvironmentTimeZone($this->config->siglaUF);
191 191
         $this->certificate = $certificate;
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
             $this->versao = $version;
264 264
             $this->config->schemes = $this->availableVersions[$version];
265 265
             $this->pathschemes = realpath(
266
-                __DIR__ . '/../../schemes/'. $this->config->schemes
267
-            ).'/';
266
+                __DIR__ . '/../../schemes/' . $this->config->schemes
267
+            ) . '/';
268 268
         }
269 269
         return $this->versao;
270 270
     }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     protected function isValid($version, $body, $method)
364 364
     {
365
-        $schema = $this->pathschemes.$method."_v$version.xsd";
365
+        $schema = $this->pathschemes . $method . "_v$version.xsd";
366 366
         if (!is_file($schema)) {
367 367
             return true;
368 368
         }
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
      * @param array $opt
429 429
      * @return array
430 430
      */
431
-    public function canonicalOptions($opt = [true,false,null,null])
431
+    public function canonicalOptions($opt = [true, false, null, null])
432 432
     {
433 433
         if (!empty($opt) && is_array($opt)) {
434 434
             $this->canonical = $opt;
@@ -547,11 +547,11 @@  discard block
 block discarded – undo
547 547
     {
548 548
         $file = $this->pathwsfiles
549 549
             . DIRECTORY_SEPARATOR
550
-            . "wsnfe_".$this->versao."_mod55.xml";
550
+            . "wsnfe_" . $this->versao . "_mod55.xml";
551 551
         if ($this->modelo == 65) {
552 552
             $file = str_replace('55', '65', $file);
553 553
         }
554
-        if (! file_exists($file)) {
554
+        if (!file_exists($file)) {
555 555
             return '';
556 556
         }
557 557
         return file_get_contents($file);
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         //os URI estão em storage/uri_consulta_nfce.json
602 602
         $std = json_decode(
603 603
             file_get_contents(
604
-                $this->pathwsfiles.'uri_consulta_nfce.json'
604
+                $this->pathwsfiles . 'uri_consulta_nfce.json'
605 605
             )
606 606
         );
607 607
         return $std->$uf;
Please login to merge, or discard this patch.
src/Make.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
     {
425 425
         $chave = preg_replace('/[^0-9]/', '', $std->Id);
426 426
         $this->infNFe = $this->dom->createElement("infNFe");
427
-        $this->infNFe->setAttribute("Id", 'NFe'.$chave);
427
+        $this->infNFe->setAttribute("Id", 'NFe' . $chave);
428 428
         $this->infNFe->setAttribute(
429 429
             "versao",
430 430
             $std->versao
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     {
632 632
         $num = $this->buildNFref();
633 633
         $refNFe = $this->dom->createElement("refNFe", $std->refNFe);
634
-        $this->dom->appChild($this->aNFref[$num-1], $refNFe);
634
+        $this->dom->appChild($this->aNFref[$num - 1], $refNFe);
635 635
         return $refNFe;
636 636
     }
637 637
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
             true,
689 689
             $identificador . "Número do Documento Fiscal"
690 690
         );
691
-        $this->dom->appChild($this->aNFref[$num-1], $refNF);
691
+        $this->dom->appChild($this->aNFref[$num - 1], $refNF);
692 692
         return $refNF;
693 693
     }
694 694
 
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
             true,
760 760
             $identificador . "Número do Documento Fiscal"
761 761
         );
762
-        $this->dom->appChild($this->aNFref[$num-1], $refNFP);
762
+        $this->dom->appChild($this->aNFref[$num - 1], $refNFP);
763 763
         return $refNFP;
764 764
     }
765 765
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
     {
774 774
         $num = $this->buildNFref();
775 775
         $refCTe = $this->dom->createElement("refCTe", $std->refCTe);
776
-        $this->dom->appChild($this->aNFref[$num-1], $refCTe);
776
+        $this->dom->appChild($this->aNFref[$num - 1], $refCTe);
777 777
         return $refCTe;
778 778
     }
779 779
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
             true,
810 810
             $identificador . "Número do Contador de Ordem de Operação - COO"
811 811
         );
812
-        $this->dom->appChild($this->aNFref[$num-1], $refECF);
812
+        $this->dom->appChild($this->aNFref[$num - 1], $refECF);
813 813
         return $refECF;
814 814
     }
815 815
 
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
     public function tagdest($std)
991 991
     {
992 992
         $identificador = 'E01 <dest> - ';
993
-        $flagNome = true;//marca se xNome é ou não obrigatório
993
+        $flagNome = true; //marca se xNome é ou não obrigatório
994 994
         $temIE = $std->IE != '' && $std->IE != 'ISENTO'; // Tem inscrição municipal
995 995
         $this->dest = $this->dom->createElement("dest");
996 996
         if (!$temIE && $std->indIEDest == 1) {
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
         if ($this->mod == '65') {
1000 1000
             $std->indIEDest = 9;
1001 1001
             if ($std->xNome == '') {
1002
-                $flagNome = false;//marca se xNome é ou não obrigatório
1002
+                $flagNome = false; //marca se xNome é ou não obrigatório
1003 1003
             }
1004 1004
         }
1005 1005
         $xNome = $std->xNome;
@@ -3243,10 +3243,10 @@  discard block
 block discarded – undo
3243 3243
     public function tagICMSSN($std)
3244 3244
     {
3245 3245
         //totalizador
3246
-        $this->stdTot->vBC += (float) !empty($std->vBC) ? : 0;
3247
-        $this->stdTot->vICMS += (float) !empty($std->vICMS) ? : 0;
3248
-        $this->stdTot->vBCST += (float) !empty($std->vBCST) ? : 0;
3249
-        $this->stdTot->vST += (float) !empty($std->vICMSST) ? : 0;
3246
+        $this->stdTot->vBC += (float) !empty($std->vBC) ?: 0;
3247
+        $this->stdTot->vICMS += (float) !empty($std->vICMS) ?: 0;
3248
+        $this->stdTot->vBCST += (float) !empty($std->vBCST) ?: 0;
3249
+        $this->stdTot->vST += (float) !empty($std->vICMSST) ?: 0;
3250 3250
 
3251 3251
         switch ($std->CSOSN) {
3252 3252
             case '101':
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
             true,
3713 3713
             "[item $std->item] Código de Enquadramento Legal do IPI"
3714 3714
         );
3715
-        if ($std->CST == '00' || $std->CST == '49'|| $std->CST == '50' || $std->CST == '99') {
3715
+        if ($std->CST == '00' || $std->CST == '49' || $std->CST == '50' || $std->CST == '99') {
3716 3716
             $ipiTrib = $this->dom->createElement('IPITrib');
3717 3717
             $this->dom->addChild(
3718 3718
                 $ipiTrib,
@@ -5098,11 +5098,11 @@  discard block
 block discarded – undo
5098 5098
             $this->dom->appChild($detPag, $card, "Inclusão do node Card");
5099 5099
         }
5100 5100
         $n = count($this->aPag);
5101
-        $node = $this->aPag[$n-1]->getElementsByTagName("vTroco")->item(0);
5101
+        $node = $this->aPag[$n - 1]->getElementsByTagName("vTroco")->item(0);
5102 5102
         if (!empty($node)) {
5103
-            $this->aPag[$n-1]->insertBefore($detPag, $node);
5103
+            $this->aPag[$n - 1]->insertBefore($detPag, $node);
5104 5104
         } else {
5105
-            $this->dom->appChild($this->aPag[$n-1], $detPag, 'Falta tag "Pag"');
5105
+            $this->dom->appChild($this->aPag[$n - 1], $detPag, 'Falta tag "Pag"');
5106 5106
         }
5107 5107
         return $detPag;
5108 5108
     }
@@ -5730,7 +5730,7 @@  discard block
 block discarded – undo
5730 5730
             $prod = $this->aProd[$nItem];
5731 5731
             foreach ($aDI as $child) {
5732 5732
                 $node = $prod->getElementsByTagName("xPed")->item(0);
5733
-                if (! empty($node)) {
5733
+                if (!empty($node)) {
5734 5734
                     $prod->insertBefore($child, $node);
5735 5735
                 } else {
5736 5736
                     $this->dom->appChild($prod, $child, "Inclusão do node DI");
@@ -5767,9 +5767,9 @@  discard block
 block discarded – undo
5767 5767
         //insere combustivel
5768 5768
         foreach ($this->aComb as $nItem => $child) {
5769 5769
             $prod = $this->aProd[$nItem];
5770
-            if (! empty($this->aEncerrante)) {
5770
+            if (!empty($this->aEncerrante)) {
5771 5771
                 $encerrante = $this->aEncerrante[$nItem];
5772
-                if (! empty($encerrante)) {
5772
+                if (!empty($encerrante)) {
5773 5773
                     $this->dom->appChild($child, $encerrante, "inclusão do node encerrante na tag comb");
5774 5774
                 }
5775 5775
             }
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.