Test Failed
Pull Request — master (#517)
by Bill
03:00
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/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.
src/Tools.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
         }
368 368
         //monta a consulta
369 369
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
370
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
370
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
371 371
             . "<cUFAutor>$cUF</cUFAutor>"
372
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>";
372
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>";
373 373
         //valida o xml da requisição
374 374
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
375 375
         $this->lastRequest = $consulta;
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             $dt = new \DateTime();
641 641
             $dhEvento = $dt->format('Y-m-d\TH:i:sP');
642 642
             $sSeqEvento = str_pad($evt->nSeqEvento, 2, "0", STR_PAD_LEFT);
643
-            $eventId = "ID".$evt->tpEvento.$evt->chave.$sSeqEvento;
643
+            $eventId = "ID" . $evt->tpEvento . $evt->chave . $sSeqEvento;
644 644
             $cOrgao = UFList::getCodeByUF($uf);
645 645
             $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
646 646
                 . "<infEvento Id=\"$eventId\">"
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
             );
671 671
             $batchRequest .= Strings::clearXmlString($request, true);
672 672
         }
673
-        $lote = $dt->format('YmdHis').rand(0, 9);
673
+        $lote = $dt->format('YmdHis') . rand(0, 9);
674 674
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
675 675
             . "<idLote>$lote</idLote>"
676 676
             . $batchRequest
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $dt = new \DateTime();
797 797
         $dhEvento = $dt->format('Y-m-d\TH:i:sP');
798 798
         $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT);
799
-        $eventId = "ID".$tpEvento.$chave.$sSeqEvento;
799
+        $eventId = "ID" . $tpEvento . $chave . $sSeqEvento;
800 800
         $cOrgao = UFList::getCodeByUF($uf);
801 801
         $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
802 802
             . "<infEvento Id=\"$eventId\">"
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
             $this->canonical
825 825
         );
826 826
         $request = Strings::clearXmlString($request, true);
827
-        $lote = $dt->format('YmdHis').rand(0, 9);
827
+        $lote = $dt->format('YmdHis') . rand(0, 9);
828 828
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
829 829
             . "<idLote>$lote</idLote>"
830 830
             . $request
@@ -862,9 +862,9 @@  discard block
 block discarded – undo
862 862
         $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>";
863 863
         //monta a consulta
864 864
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
865
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
865
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
866 866
             . "<cUFAutor>$cUF</cUFAutor>"
867
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>";
867
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>";
868 868
         //valida o xml da requisição
869 869
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
870 870
         $this->lastRequest = $consulta;
@@ -919,8 +919,8 @@  discard block
 block discarded – undo
919 919
             . "<indOp>$indOp</indOp>"
920 920
             . "<raizCNPJ>$raizCNPJ</raizCNPJ>"
921 921
             . "<dadosCsc>"
922
-            . "<idCsc>".$this->config->CSCid."</idCsc>"
923
-            . "<codigoCsc>".$this->config->CSC."</codigoCsc>"
922
+            . "<idCsc>" . $this->config->CSCid . "</idCsc>"
923
+            . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>"
924 924
             . "</dadosCsc>"
925 925
             . "</admCscNFCe>";
926 926
         }
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
         $dom->loadXML($nfe);
952 952
         //verifica a validade no webservice da SEFAZ
953 953
         $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue;
954
-        $infNFe  = $dom->getElementsByTagName('infNFe')->item(0);
954
+        $infNFe = $dom->getElementsByTagName('infNFe')->item(0);
955 955
         $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id"));
956 956
         $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue;
957 957
         $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue;
Please login to merge, or discard this patch.