Passed
Pull Request — master (#382)
by Eduardo
04:10
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   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         if ($compactar) {
95 95
             $gzdata = base64_encode(gzencode($request, 9, FORCE_GZIP));
96 96
             $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>";
97
-            $method = $this->urlMethod."Zip";
97
+            $method = $this->urlMethod . "Zip";
98 98
             $parameters = ['nfeDadosMsgZip' => $gzdata];
99 99
             $body = "<nfeDadosMsgZip xmlns=\"$this->urlNamespace\">$gzdata</nfeDadosMsgZip>";
100 100
         }
@@ -362,9 +362,9 @@  discard block
 block discarded – undo
362 362
         }
363 363
         //monta a consulta
364 364
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
365
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
365
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
366 366
             . "<cUFAutor>$cUF</cUFAutor>"
367
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagNSU</distDFeInt>";
367
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagNSU</distDFeInt>";
368 368
         //valida o xml da requisição
369 369
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
370 370
         $this->lastRequest = $consulta;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
             $dt = new \DateTime();
625 625
             $dhEvento = $dt->format('Y-m-d\TH:i:sP');
626 626
             $sSeqEvento = str_pad($evt->nSeqEvento, 2, "0", STR_PAD_LEFT);
627
-            $eventId = "ID".$evt->tpEvento.$evt->chave.$sSeqEvento;
627
+            $eventId = "ID" . $evt->tpEvento . $evt->chave . $sSeqEvento;
628 628
             $cOrgao = UFList::getCodeByUF($uf);
629 629
             $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
630 630
                 . "<infEvento Id=\"$eventId\">"
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
             );
655 655
             $batchRequest .= Strings::clearXmlString($request, true);
656 656
         }
657
-        $lote = $dt->format('YmdHis').rand(0, 9);
657
+        $lote = $dt->format('YmdHis') . rand(0, 9);
658 658
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
659 659
             . "<idLote>$lote</idLote>"
660 660
             . $batchRequest
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
         $dt = new \DateTime();
779 779
         $dhEvento = $dt->format('Y-m-d\TH:i:sP');
780 780
         $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT);
781
-        $eventId = "ID".$tpEvento.$chave.$sSeqEvento;
781
+        $eventId = "ID" . $tpEvento . $chave . $sSeqEvento;
782 782
         $cOrgao = UFList::getCodeByUF($uf);
783 783
         $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
784 784
             . "<infEvento Id=\"$eventId\">"
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
             $this->canonical
807 807
         );
808 808
         $request = Strings::clearXmlString($request, true);
809
-        $lote = $dt->format('YmdHis').rand(0, 9);
809
+        $lote = $dt->format('YmdHis') . rand(0, 9);
810 810
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
811 811
             . "<idLote>$lote</idLote>"
812 812
             . $request
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
         $tagChave = "<consChNFe><chNFe>$chave</chNFe></consChNFe>";
842 842
         //monta a consulta
843 843
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
844
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
844
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
845 845
             . "<cUFAutor>$cUF</cUFAutor>"
846
-            . "<CNPJ>".$this->config->cnpj."</CNPJ>$tagChave</distDFeInt>";
846
+            . "<CNPJ>" . $this->config->cnpj . "</CNPJ>$tagChave</distDFeInt>";
847 847
         //valida o xml da requisição
848 848
         $this->isValid($this->urlVersion, $consulta, 'distDFeInt');
849 849
         $this->lastRequest = $consulta;
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
             . "<indOp>$indOp</indOp>"
896 896
             . "<raizCNPJ>$raizCNPJ</raizCNPJ>"
897 897
             . "<dadosCsc>"
898
-            . "<idCsc>".$this->config->CSCid."</idCsc>"
899
-            . "<codigoCsc>".$this->config->CSC."</codigoCsc>"
898
+            . "<idCsc>" . $this->config->CSCid . "</idCsc>"
899
+            . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>"
900 900
             . "</dadosCsc>"
901 901
             . "</admCscNFCe>";
902 902
         }
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         $dom->loadXML($nfe);
925 925
         //verifica a validade no webservice da SEFAZ
926 926
         $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue;
927
-        $infNFe  = $dom->getElementsByTagName('infNFe')->item(0);
927
+        $infNFe = $dom->getElementsByTagName('infNFe')->item(0);
928 928
         $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id"));
929 929
         $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue;
930 930
         $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue;
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
             );
942 942
         }
943 943
         $infProt = $ret->getElementsByTagName('infProt')->item(0);
944
-        $cStat  = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
944
+        $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
945 945
         $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue;
946 946
         $dig = $infProt->getElementsByTagName("digVal")->item(0);
947 947
         $digProt = '000';
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/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 2 patches
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.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
             true,
1722 1722
             $identificador . "[item $std->item] Indica se valor do Item (vProd) entra no valor total da NF-e (vProd)"
1723 1723
         );
1724
-        if (!empty($std->xPed) &&  !empty($std->nItemPed)) {
1724
+        if (!empty($std->xPed) && !empty($std->nItemPed)) {
1725 1725
             $this->dom->addChild(
1726 1726
                 $prod,
1727 1727
                 "xPed",
@@ -6030,14 +6030,14 @@  discard block
 block discarded – undo
6030 6030
         if ($this->version === '3.10') {
6031 6031
             $n = count($this->aPag);
6032 6032
             $this->dom->addChild(
6033
-                $this->aPag[$n-1],
6033
+                $this->aPag[$n - 1],
6034 6034
                 "tPag",
6035 6035
                 $std->tPag,
6036 6036
                 true,
6037 6037
                 "Forma de pagamento"
6038 6038
             );
6039 6039
             $this->dom->addChild(
6040
-                $this->aPag[$n-1],
6040
+                $this->aPag[$n - 1],
6041 6041
                 "vPag",
6042 6042
                 $std->vPag,
6043 6043
                 true,
@@ -6073,9 +6073,9 @@  discard block
 block discarded – undo
6073 6073
                     false,
6074 6074
                     "Número de autorização da operação cartão de crédito e/ou débito"
6075 6075
                 );
6076
-                $this->dom->appChild($this->aPag[$n-1], $card, "Inclusão do node Card");
6076
+                $this->dom->appChild($this->aPag[$n - 1], $card, "Inclusão do node Card");
6077 6077
             }
6078
-            return $this->aPag[$n-1];
6078
+            return $this->aPag[$n - 1];
6079 6079
         } else {
6080 6080
             //padrão para layout 4.00
6081 6081
             $detPag = $this->dom->createElement("detPag");
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.