Passed
Pull Request — master (#190)
by Eduardo
07:47
created
src/Factories/ContingencyNFe.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use NFePHP\NFe\Factories\Contingency;
7 7
 use NFePHP\Common\Signer;
8 8
 use NFePHP\Common\Keys;
9
-use NFePHP\Common\UFList;
10 9
 use DateTime;
11 10
 
12 11
 class ContingencyNFe
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
             $tpEmis,
74 74
             $cNF
75 75
         );
76
-        $infNFe->setAttribute('Id', 'NFe'.$chave);
76
+        $infNFe->setAttribute('Id', 'NFe' . $chave);
77 77
         return Strings::clearXmlString($dom->saveXML(), true);
78 78
     }
79 79
 }
Please login to merge, or discard this patch.
src/Factories/Protocol.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     /**
26 26
      * Add protocol to xml
27 27
      * @param string $xmlnfe xml
28
-     * @param string $protocol response xml
28
+     * @param string $xmlprotocol response xml
29 29
      * @return string
30 30
      * @throws InvalidArgumentException
31 31
      */
Please login to merge, or discard this patch.
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   +9 added lines, -9 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($cons, 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
         }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
362 362
             . "<tpAmb>1</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
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
719 719
             . "<tpAmb>1</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
         //consulta a NFe
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
             );
816 816
         }
817 817
         $infProt = $ret->getElementsByTagName('infProt')->item(0);
818
-        $cStat  = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
818
+        $cStat = $infProt->getElementsByTagName('cStat')->item(0)->nodeValue;
819 819
         $xMotivo = $infProt->getElementsByTagName('xMotivo')->item(0)->nodeValue;
820 820
         $dig = $infProt->getElementsByTagName("digVal")->item(0);
821 821
         $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/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/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
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
         $this->config = json_decode($configJson);
179 179
         $this->pathwsfiles = realpath(
180 180
             __DIR__ . '/../../storage'
181
-        ).'/';
181
+        ) . '/';
182 182
         $this->pathschemes = realpath(
183
-            __DIR__ . '/../../schemes/'. $this->config->schemes
184
-        ).'/';
183
+            __DIR__ . '/../../schemes/' . $this->config->schemes
184
+        ) . '/';
185 185
         $this->version($this->config->versao);
186 186
         $this->setEnvironmentTimeZone($this->config->siglaUF);
187 187
         $this->certificate = $certificate;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      */
351 351
     protected function isValid($version, $body, $method)
352 352
     {
353
-        $schema = $this->pathschemes.$method."_v$version.xsd";
353
+        $schema = $this->pathschemes . $method . "_v$version.xsd";
354 354
         if (!is_file($schema)) {
355 355
             return true;
356 356
         }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      * @param array $opt
417 417
      * @return array
418 418
      */
419
-    public function canonicalOptions($opt = [true,false,null,null])
419
+    public function canonicalOptions($opt = [true, false, null, null])
420 420
     {
421 421
         if (!empty($opt) && is_array($opt)) {
422 422
             $this->canonical = $opt;
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
     {
536 536
         $file = $this->pathwsfiles
537 537
             . DIRECTORY_SEPARATOR
538
-            . "wsnfe_".$this->versao."_mod55.xml";
538
+            . "wsnfe_" . $this->versao . "_mod55.xml";
539 539
         if ($this->modelo == 65) {
540 540
             $file = str_replace('55', '65', $file);
541 541
         }
542
-        if (! file_exists($file)) {
542
+        if (!file_exists($file)) {
543 543
             return '';
544 544
         }
545 545
         return file_get_contents($file);
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
         //os URI estão em storage/uri_consulta_nfce.json
590 590
         $std = json_decode(
591 591
             file_get_contents(
592
-                $this->pathwsfiles.'uri_consulta_nfce.json'
592
+                $this->pathwsfiles . 'uri_consulta_nfce.json'
593 593
             )
594 594
         );
595 595
         return $std->$uf;
Please login to merge, or discard this patch.
src/Factories/Parser.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function __construct($version = '3.10')
97 97
     {
98 98
         $ver = str_replace('.', '', $version);
99
-        $path = realpath(__DIR__."/../../storage/txtstructure$ver.json");
99
+        $path = realpath(__DIR__ . "/../../storage/txtstructure$ver.json");
100 100
         $this->structure = json_decode(file_get_contents($path), true);
101 101
         $this->make = new Make();
102 102
     }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             if (empty($fields)) {
132 132
                 continue;
133 133
             }
134
-            $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity';
134
+            $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity';
135 135
             if (!method_exists(__CLASS__, $metodo)) {
136 136
                 $msg = "O txt tem um metodo não definido!! $lin";
137 137
                 throw new \RuntimeException($msg);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     protected static function fieldsToStd($dfls, $struct)
146 146
     {
147 147
         $sfls = explode('|', $struct);
148
-        $len = count($sfls)-1;
148
+        $len = count($sfls) - 1;
149 149
         $std = new \stdClass();
150 150
         for ($i = 1; $i < $len; $i++) {
151 151
             $name = $sfls[$i];
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
             }
174 174
             $n[] = $field;
175 175
         }
176
-        if (empty($n[count($n)-1])) {
177
-            unset($n[count($n)-1]);
176
+        if (empty($n[count($n) - 1])) {
177
+            unset($n[count($n) - 1]);
178 178
         }
179 179
         return $n;
180 180
     }
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
         $this->stdPIS->CST = $std->CST;
1119 1119
         $this->stdPIS->vPIS = $std->vPIS;
1120 1120
         $this->stdPIS->qBCProd = $std->qBCProd;
1121
-        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1121
+        $this->stdPIS->vAliqProd = $std->vAliqProd;
1122 1122
         $this->buildQEntity();
1123 1123
     }
1124 1124
     
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
     protected function q10Entity($std)
1166 1166
     {
1167 1167
         $this->stdPIS->qBCProd = $std->qBCProd;
1168
-        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1168
+        $this->stdPIS->vAliqProd = $std->vAliqProd;
1169 1169
         $this->buildQEntity();
1170 1170
     }
1171 1171
     
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/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.