Passed
Pull Request — master (#276)
by Sebastiao
09:39
created
src/Tools.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@
 block discarded – undo
19 19
 use NFePHP\Common\Strings;
20 20
 use NFePHP\Common\Signer;
21 21
 use NFePHP\Common\UFList;
22
-use NFePHP\NFe\Factories\QRCode;
23
-use NFePHP\NFe\Factories\Events;
24 22
 use NFePHP\NFe\Common\Tools as ToolsCommon;
25 23
 use RuntimeException;
26 24
 use InvalidArgumentException;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         if ($compactar) {
89 89
             $gzdata = base64_encode(gzencode($request, 9, FORCE_GZIP));
90 90
             $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>";
91
-            $method = $this->urlMethod."Zip";
91
+            $method = $this->urlMethod . "Zip";
92 92
             $parameters = ['nfeDadosMsgZip' => $gzdata];
93 93
             $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>";
94 94
         }
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
         }
360 360
         //monta a consulta
361 361
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
362
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
362
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
363 363
             . "<cUFAutor>$cUF</cUFAutor>"
364
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>";
364
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>";
365 365
         //valida o xml da requisição
366 366
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
367 367
         $this->lastRequest = $consulta;
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
         $dt = new \DateTime();
654 654
         $dhEvento = $dt->format('Y-m-d\TH:i:sP');
655 655
         $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT);
656
-        $eventId = "ID".$tpEvento.$chave.$sSeqEvento;
656
+        $eventId = "ID" . $tpEvento . $chave . $sSeqEvento;
657 657
         $cOrgao = UFList::getCodeByUF($uf);
658 658
         $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
659 659
             . "<infEvento Id=\"$eventId\">"
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             $this->canonical
682 682
         );
683 683
         $request = Strings::clearXmlString($request, true);
684
-        $lote = $dt->format('YmdHis').rand(0, 9);
684
+        $lote = $dt->format('YmdHis') . rand(0, 9);
685 685
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
686 686
             . "<idLote>$lote</idLote>"
687 687
             . $request
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
         $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>";
717 717
         //monta a consulta
718 718
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
719
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
719
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
720 720
             . "<cUFAutor>$cUF</cUFAutor>"
721
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>";
721
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>";
722 722
         //valida o xml da requisição
723 723
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
724 724
         $this->lastRequest = $consulta;
@@ -770,8 +770,8 @@  discard block
 block discarded – undo
770 770
             . "<indOp>$indOp</indOp>"
771 771
             . "<raizCNPJ>$raizCNPJ</raizCNPJ>"
772 772
             . "<dadosCsc>"
773
-            . "<idCsc>".$this->config->CSCid."</idCsc>"
774
-            . "<codigoCsc>".$this->config->CSC."</codigoCsc>"
773
+            . "<idCsc>" . $this->config->CSCid . "</idCsc>"
774
+            . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>"
775 775
             . "</dadosCsc>"
776 776
             . "</admCscNFCe>";
777 777
         }
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         $dom->loadXML($nfe);
800 800
         //verifica a validade no webservice da SEFAZ
801 801
         $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue;
802
-        $infNFe  = $dom->getElementsByTagName('infNFe')->item(0);
802
+        $infNFe = $dom->getElementsByTagName('infNFe')->item(0);
803 803
         $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id"));
804 804
         $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue;
805 805
         $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
             );
817 817
         }
818 818
         $infProt = $ret->getElementsByTagName('infProt')->item(0);
819
-        $cStat  = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
819
+        $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
820 820
         $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue;
821 821
         $dig = $infProt->getElementsByTagName("digVal")->item(0);
822 822
         $digProt = '000';
Please login to merge, or discard this patch.
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/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/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/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/Make.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6959,7 +6959,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.