Passed
Pull Request — master (#619)
by Luis Henrique
07:34 queued 04:33
created
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/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.
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/ValidTXT.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@
 block discarded – undo
135 135
                     '?',
136 136
                     $field
137 137
                 );
138
-                 $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
138
+                    $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
139 139
                     '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield);
140 140
                 if ($field != $newfield) {
141 141
                     $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, "
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 class ValidTXT
21 21
 {
22
-    const LOCAL="LOCAL";
23
-    const SEBRAE="SEBRAE";
22
+    const LOCAL = "LOCAL";
23
+    const SEBRAE = "SEBRAE";
24 24
    
25 25
     /**
26 26
      * Loads structure of txt from json file in storage folder
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (strtoupper($baselayout) === 'SEBRAE') {
36 36
             $comp = '_sebrae';
37 37
         }
38
-        $file = $path . '/txtstructure' . ($version*100) . $comp . '.json';
38
+        $file = $path . '/txtstructure' . ($version * 100) . $comp . '.json';
39 39
         if (!is_file($file)) {
40 40
             throw new \InvalidArgumentException("O arquivo de estrutura para a "
41 41
                 . "versão de layout indicada no TXT, não foi encontrado [$file].");
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
                 $errors[] = "ERRO: ($num) Essa referência não está definida. [$row]";
101 101
                 continue;
102 102
             }
103
-            $count = count($fields)-1;
104
-            $default = count(explode('|', $entities[$ref]))-1;
103
+            $count = count($fields) - 1;
104
+            $default = count(explode('|', $entities[$ref])) - 1;
105 105
             if ($default !== $count) {
106 106
                 $errors[] = "ERRO: ($num) O número de parâmetros na linha "
107 107
                     . "está errado (esperado #$default) -> (encontrado #$count). [ $row ] Esperado [ "
108
-                    . $entities[$ref]." ]";
108
+                    . $entities[$ref] . " ]";
109 109
                 continue;
110 110
             }
111 111
             foreach ($fields as $field) {
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
                     continue;
128 128
                 }
129 129
                 $newfield = preg_replace(
130
-                    '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]'.
131
-                    '|[\x00-\x7F][\x80-\xBF]+'.
132
-                    '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*'.
133
-                    '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})'.
130
+                    '/[\x00-\x08\x10\x0B\x0C\x0E-\x19\x7F]' .
131
+                    '|[\x00-\x7F][\x80-\xBF]+' .
132
+                    '|([\xC0\xC1]|[\xF0-\xFF])[\x80-\xBF]*' .
133
+                    '|[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})' .
134 134
                     '|[\xE0-\xEF](([\x80-\xBF](?![\x80-\xBF]))|(?![\x80-\xBF]{2})|[\x80-\xBF]{3,})/S',
135 135
                     '?',
136 136
                     $field
137 137
                 );
138
-                 $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]'.
138
+                 $newfield = preg_replace('/\xE0[\x80-\x9F][\x80-\xBF]' .
139 139
                     '|\xED[\xA0-\xBF][\x80-\xBF]/S', '?', $newfield);
140 140
                 if ($field != $newfield) {
141 141
                     $errors[] = "ERRO: ($num) Existem caracteres não UTF-8, não permitidos, "
Please login to merge, or discard this patch.
src/Convert.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 class Convert
23 23
 {
24
-    const LOCAL="LOCAL";
25
-    const SEBRAE="SEBRAE";
24
+    const LOCAL = "LOCAL";
25
+    const SEBRAE = "SEBRAE";
26 26
     
27 27
     protected $txt;
28 28
     protected $dados;
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
             if (substr($linha, 0, 2) == 'A|') {
124 124
                 $resp[$xCount]['init'] = $iCount;
125 125
                 if ($xCount > 0) {
126
-                    $resp[$xCount -1]['fim'] = $iCount;
126
+                    $resp[$xCount - 1]['fim'] = $iCount;
127 127
                 }
128 128
                 $xCount += 1;
129 129
             }
130 130
             $iCount += 1;
131 131
         }
132
-        $resp[$xCount-1]['fim'] = $iCount;
132
+        $resp[$xCount - 1]['fim'] = $iCount;
133 133
         foreach ($resp as $marc) {
134
-            $length = $marc['fim']-$marc['init'];
134
+            $length = $marc['fim'] - $marc['init'];
135 135
             $aNotas[] = array_slice($array, $marc['init'], $length, false);
136 136
         }
137 137
         return $aNotas;
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
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 class Parser
23 23
 {
24
-    const LOCAL="LOCAL";
25
-    const SEBRAE="SEBRAE";
24
+    const LOCAL = "LOCAL";
25
+    const SEBRAE = "SEBRAE";
26 26
     
27 27
     /**
28 28
      * @var array
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             $comp = "_sebrae";
119 119
         }
120 120
         $this->baselayout = $baselayout;
121
-        $path = realpath(__DIR__."/../../storage/txtstructure$ver" . $comp . ".json");
121
+        $path = realpath(__DIR__ . "/../../storage/txtstructure$ver" . $comp . ".json");
122 122
         $this->structure = json_decode(file_get_contents($path), true);
123 123
         $this->make = new Make();
124 124
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if (empty($fields)) {
150 150
                 continue;
151 151
             }
152
-            $metodo = strtolower(str_replace(' ', '', $fields[0])).'Entity';
152
+            $metodo = strtolower(str_replace(' ', '', $fields[0])) . 'Entity';
153 153
             if (!method_exists(__CLASS__, $metodo)) {
154 154
                 throw DocumentsException::wrongDocument(16, $lin); //campo não definido
155 155
             }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     protected static function fieldsToStd($dfls, $struct)
169 169
     {
170 170
         $sfls = explode('|', $struct);
171
-        $len = count($sfls)-1;
171
+        $len = count($sfls) - 1;
172 172
         $std = new \stdClass();
173 173
         for ($i = 1; $i < $len; $i++) {
174 174
             $name = $sfls[$i];
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
         $this->stdPIS->CST = $std->CST;
1194 1194
         $this->stdPIS->vPIS = $std->vPIS;
1195 1195
         $this->stdPIS->qBCProd = $std->qBCProd;
1196
-        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1196
+        $this->stdPIS->vAliqProd = $std->vAliqProd;
1197 1197
         $this->buildQEntity();
1198 1198
     }
1199 1199
 
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
     protected function q10Entity($std)
1245 1245
     {
1246 1246
         $this->stdPIS->qBCProd = $std->qBCProd;
1247
-        $this->stdPIS->vAliqProd  = $std->vAliqProd;
1247
+        $this->stdPIS->vAliqProd = $std->vAliqProd;
1248 1248
         $this->buildQEntity();
1249 1249
     }
1250 1250
 
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
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                     //205 NFe Denegada
258 258
                     //301 Uso denegado por irregularidade fiscal do emitente
259 259
                     //302 Uso denegado por irregularidade fiscal do destinatário
260
-                    $cstatpermit = ['100', '150', '110', '205', '301','302'];
260
+                    $cstatpermit = ['100', '150', '110', '205', '301', '302'];
261 261
                     if (!in_array($cStat, $cstatpermit)) {
262 262
                         throw DocumentsException::wrongDocument(4, "[$cStat] $xMotivo");
263 263
                     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         $resLote = $ret->getElementsByTagName('idLote')->item(0)->nodeValue;
304 304
         //extrai a rag retEvento da resposta (retorno da SEFAZ)
305 305
         $retEv = $ret->getElementsByTagName('retEvento')->item(0);
306
-        $cStat  = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
306
+        $cStat = $retEv->getElementsByTagName('cStat')->item(0)->nodeValue;
307 307
         $xMotivo = $retEv->getElementsByTagName('xMotivo')->item(0)->nodeValue;
308 308
         $tpEvento = $retEv->getElementsByTagName('tpEvento')->item(0)->nodeValue;
309 309
         $cStatValids = ['135', '136'];
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     {
340 340
         $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
341 341
                 . "<$nodename versao=\"$versao\" "
342
-                . "xmlns=\"".self::$urlPortal."\">";
342
+                . "xmlns=\"" . self::$urlPortal . "\">";
343 343
         $xml .= $first;
344 344
         $xml .= $second;
345 345
         $xml .= "</$nodename>";
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
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
         $tpEmis,
145 145
         $cDest
146 146
     ) {
147
-        $ver = $versao/100;
147
+        $ver = $versao / 100;
148 148
         $cscId = (int) $idToken;
149 149
         $csc = $token;
150 150
         if (strpos($url, '?p=') === false) {
151
-            $url = $url.'?p=';
151
+            $url = $url . '?p=';
152 152
         }
153 153
         if ($tpEmis != 9) {
154 154
             //emissão on-line
155 155
             $seq = "$chNFe|$ver|$tpAmb|$cscId";
156
-            $hash = strtoupper(sha1($seq.$csc));
156
+            $hash = strtoupper(sha1($seq . $csc));
157 157
             return "$url$seq|$hash";
158 158
         }
159 159
         //emissão off-line
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $valor = number_format($vNF, 2, '.', '');
163 163
         $digHex = self::str2Hex($digVal);
164 164
         $seq = "$chNFe|$ver|$tpAmb|$dia|$valor|$digHex|$cscId";
165
-        $hash = strtoupper(sha1($seq.$csc));
165
+        $hash = strtoupper(sha1($seq . $csc));
166 166
         return "$url$seq|$hash";
167 167
     }
168 168
 
Please login to merge, or discard this patch.
src/Tools.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
         }
341 341
         //monta a consulta
342 342
         $consulta = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
343
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
343
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
344 344
             . "<cUFAutor>$cUF</cUFAutor>";
345 345
         if ($this->typePerson === 'J') {
346 346
             $consulta .= "<CNPJ>$cnpj</CNPJ>";
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
             $dt = new \DateTime();
581 581
             $dhEvento = $dt->format('Y-m-d\TH:i:sP');
582 582
             $sSeqEvento = str_pad($evt->nSeqEvento, 2, "0", STR_PAD_LEFT);
583
-            $eventId = "ID".$evt->tpEvento.$evt->chave.$sSeqEvento;
583
+            $eventId = "ID" . $evt->tpEvento . $evt->chave . $sSeqEvento;
584 584
             $cOrgao = UFList::getCodeByUF($uf);
585 585
             $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
586 586
                 . "<infEvento Id=\"$eventId\">"
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
         $dt = new \DateTime();
728 728
         $dhEvento = $dt->format('Y-m-d\TH:i:sP');
729 729
         $sSeqEvento = str_pad($nSeqEvento, 2, "0", STR_PAD_LEFT);
730
-        $eventId = "ID".$tpEvento.$chave.$sSeqEvento;
730
+        $eventId = "ID" . $tpEvento . $chave . $sSeqEvento;
731 731
         $cOrgao = UFList::getCodeByUF($uf);
732 732
         $request = "<evento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
733 733
             . "<infEvento Id=\"$eventId\">"
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
             $this->canonical
760 760
         );
761 761
         $request = Strings::clearXmlString($request, true);
762
-        $lote = $dt->format('YmdHis').rand(0, 9);
762
+        $lote = $dt->format('YmdHis') . rand(0, 9);
763 763
         $request = "<envEvento xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
764 764
             . "<idLote>$lote</idLote>"
765 765
             . $request
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         $cnpj = $this->config->cnpj;
795 795
         //monta a consulta
796 796
         $request = "<distDFeInt xmlns=\"$this->urlPortal\" versao=\"$this->urlVersion\">"
797
-            . "<tpAmb>".$this->tpAmb."</tpAmb>"
797
+            . "<tpAmb>" . $this->tpAmb . "</tpAmb>"
798 798
             . "<cUFAutor>$cUF</cUFAutor>";
799 799
         if ($this->typePerson === 'J') {
800 800
             $request .= "<CNPJ>$cnpj</CNPJ>";
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
             . "<indOp>$indOp</indOp>"
853 853
             . "<raizCNPJ>$raizCNPJ</raizCNPJ>"
854 854
             . "<dadosCsc>"
855
-            . "<idCsc>".$this->config->CSCid."</idCsc>"
856
-            . "<codigoCsc>".$this->config->CSC."</codigoCsc>"
855
+            . "<idCsc>" . $this->config->CSCid . "</idCsc>"
856
+            . "<codigoCsc>" . $this->config->CSC . "</codigoCsc>"
857 857
             . "</dadosCsc>"
858 858
             . "</admCscNFCe>";
859 859
         }
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
         $dom->loadXML($nfe);
886 886
         //verifica a validade no webservice da SEFAZ
887 887
         $tpAmb = $dom->getElementsByTagName('tpAmb')->item(0)->nodeValue;
888
-        $infNFe  = $dom->getElementsByTagName('infNFe')->item(0);
888
+        $infNFe = $dom->getElementsByTagName('infNFe')->item(0);
889 889
         $chNFe = preg_replace('/[^0-9]/', '', $infNFe->getAttribute("Id"));
890 890
         $protocol = $dom->getElementsByTagName('nProt')->item(0)->nodeValue;
891 891
         $digval = $dom->getElementsByTagName('DigestValue')->item(0)->nodeValue;
Please login to merge, or discard this patch.