Passed
Push — master ( b04b3d...1df6f2 )
by Roberto
03:21 queued 10s
created
src/CTe/Dacanc.php 4 patches
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,9 +64,8 @@  discard block
 block discarded – undo
64 64
     * @param string $sPathLogo Caminho para o arquivo do logo
65 65
     * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S-
66 66
     * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF
67
-    * @param string $fonteDACTE Nome da fonte alternativa do DActe
68 67
     * @param array $aEnd array com o endereço do emitente
69
-    * @param number $mododebug 1-SIM e 0-Não (0 default)
68
+    * @param integer $mododebug 1-SIM e 0-Não (0 default)
70 69
     */
71 70
     public function __construct(
72 71
         $docXML = '',
@@ -142,7 +141,7 @@  discard block
 block discarded – undo
142 141
      * @param type $orientacao
143 142
      * @param type $papel
144 143
      * @param type $logoAlign
145
-     * @return type
144
+     * @return string
146 145
      */
147 146
     public function monta($orientacao = '', $papel = 'A4', $logoAlign = 'C', $classPDF = false)
148 147
     {
@@ -244,10 +243,10 @@  discard block
 block discarded – undo
244 243
     
245 244
     /**
246 245
      * header
247
-     * @param type $x
248
-     * @param type $y
249
-     * @param type $pag
250
-     * @return type
246
+     * @param integer $x
247
+     * @param integer $y
248
+     * @param integer $pag
249
+     * @return double
251 250
      */
252 251
     private function headerCCe($x, $y, $pag)
253 252
     {
@@ -437,7 +436,7 @@  discard block
 block discarded – undo
437 436
     
438 437
     /**
439 438
      * footer
440
-     * @param type $x
439
+     * @param integer $x
441 440
      * @param type $y
442 441
      */
443 442
     private function footerCCe($x, $y)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
  * @author    Roberto L. Machado <linux.rlm at gmail dot com>
16 16
  */
17 17
 
18
-use Exception;
19 18
 use NFePHP\DA\Legacy\Dom;
20 19
 use NFePHP\DA\Legacy\Pdf;
21 20
 use NFePHP\DA\Legacy\Common;
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@
 block discarded – undo
56 56
     private $infCanc;
57 57
     private $retCancCte;
58 58
     
59
-   /**
60
-    *__construct
61
-    * @param string $docXML Arquivo XML da cce
62
-    * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem
63
-    * @param string $sPapel Tamanho do papel (Ex. A4)
64
-    * @param string $sPathLogo Caminho para o arquivo do logo
65
-    * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S-
66
-    * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF
67
-    * @param string $fonteDACTE Nome da fonte alternativa do DActe
68
-    * @param array $aEnd array com o endereço do emitente
69
-    * @param number $mododebug 1-SIM e 0-Não (0 default)
70
-    */
59
+    /**
60
+     *__construct
61
+     * @param string $docXML Arquivo XML da cce
62
+     * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem
63
+     * @param string $sPapel Tamanho do papel (Ex. A4)
64
+     * @param string $sPathLogo Caminho para o arquivo do logo
65
+     * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S-
66
+     * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF
67
+     * @param string $fonteDACTE Nome da fonte alternativa do DActe
68
+     * @param array $aEnd array com o endereço do emitente
69
+     * @param number $mododebug 1-SIM e 0-Não (0 default)
70
+     */
71 71
     public function __construct(
72 72
         $docXML = '',
73 73
         $sOrientacao = '',
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
         $this->id = str_replace('ID', '', $this->infCanc->getAttribute("Id"));
129 129
         $this->chCTe = $this->infCanc->getElementsByTagName("chCTe")->item(0)->nodeValue;
130
-        $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14);
130
+        $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14);
131 131
         $this->tpAmb = $this->infCanc->getElementsByTagName("tpAmb")->item(0)->nodeValue;
132 132
         $this->xJust = $this->infCanc->getElementsByTagName("xJust")->item(0)->nodeValue;
133 133
         $this->dhEvento = $this->retCancCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $this->orientacao = $orientacao;
180 180
         $this->papel = $papel;
181 181
         $this->logoAlign = $logoAlign;
182
-        if ($classPDF!==false) {
182
+        if ($classPDF !== false) {
183 183
             $this->pdf = $classPDF;
184 184
         } else {
185 185
             $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             // posição inicial do relatorio
192 192
             $xInic = 1;
193 193
             $yInic = 1;
194
-            if ($this->papel =='A4') {
194
+            if ($this->papel == 'A4') {
195 195
                 $maxW = 210;
196 196
                 $maxH = 297;
197 197
             }
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
             // posição inicial do relatorio
203 203
             $xInic = 5;
204 204
             $yInic = 5;
205
-            if ($papel =='A4') {
205
+            if ($papel == 'A4') {
206 206
                 $maxH = 210;
207 207
                 $maxW = 297;
208 208
             }
209 209
         }
210 210
         //largura imprimivel em mm
211
-        $this->wPrint = $maxW-($margEsq+$xInic);
211
+        $this->wPrint = $maxW - ($margEsq + $xInic);
212 212
         //comprimento imprimivel em mm
213
-        $this->hPrint = $maxH-($margSup+$yInic);
213
+        $this->hPrint = $maxH - ($margSup + $yInic);
214 214
         // estabelece contagem de paginas
215 215
         $this->pdf->aliasNbPages();
216 216
         // fixa as margens
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
         //coloca o cabeçalho
231 231
         $y = $this->headerCCe($x, $y, $pag);
232 232
         //coloca os dados da CCe
233
-        $y = $this->bodyCCe($x, $y+15);
233
+        $y = $this->bodyCCe($x, $y + 15);
234 234
         //coloca os dados da CCe
235
-        $y = $this->footerCCe($x, $y+$this->hPrint-20);
235
+        $y = $this->footerCCe($x, $y + $this->hPrint - 20);
236 236
         //retorna o ID do evento
237
-        if ($classPDF!==false) {
238
-            $aR = ['id'=>$this->id,'classe_PDF'=>$this->pdf];
237
+        if ($classPDF !== false) {
238
+            $aR = ['id'=>$this->id, 'classe_PDF'=>$this->pdf];
239 239
             return $aR;
240 240
         } else {
241 241
             return $this->id;
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
         $maxW = $this->wPrint;
257 257
         //#############################################################
258 258
         //coluna esquerda identificação do emitente
259
-        $w = round($maxW*0.41, 0);// 80;
259
+        $w = round($maxW * 0.41, 0); // 80;
260 260
         if ($this->orientacao == 'P') {
261
-            $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
261
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
262 262
         } else {
263
-            $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'B');
263
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
264 264
         }
265 265
         $w1 = $w;
266
-        $h=32;
266
+        $h = 32;
267 267
         $oldY += $h;
268 268
         $this->pdf->textBox($x, $y, $w, $h);
269 269
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -271,147 +271,147 @@  discard block
 block discarded – undo
271 271
         if (is_file($this->logomarca)) {
272 272
             $logoInfo = getimagesize($this->logomarca);
273 273
             //largura da imagem em mm
274
-            $logoWmm = ($logoInfo[0]/72)*25.4;
274
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
275 275
             //altura da imagem em mm
276
-            $logoHmm = ($logoInfo[1]/72)*25.4;
277
-            if ($this->logoAlign=='L') {
278
-                $nImgW = round($w/3, 0);
279
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
280
-                $xImg = $x+1;
281
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
276
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
277
+            if ($this->logoAlign == 'L') {
278
+                $nImgW = round($w / 3, 0);
279
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
280
+                $xImg = $x + 1;
281
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
282 282
                 //estabelecer posições do texto
283
-                $x1 = round($xImg + $nImgW +1, 0);
284
-                $y1 = round($h/3+$y, 0);
285
-                $tw = round(2*$w/3, 0);
283
+                $x1 = round($xImg + $nImgW + 1, 0);
284
+                $y1 = round($h / 3 + $y, 0);
285
+                $tw = round(2 * $w / 3, 0);
286 286
             }
287
-            if ($this->logoAlign=='C') {
288
-                $nImgH = round($h/3, 0);
289
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
290
-                $xImg = round(($w-$nImgW)/2+$x, 0);
291
-                $yImg = $y+3;
287
+            if ($this->logoAlign == 'C') {
288
+                $nImgH = round($h / 3, 0);
289
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
290
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
291
+                $yImg = $y + 3;
292 292
                 $x1 = $x;
293 293
                 $y1 = round($yImg + $nImgH + 1, 0);
294 294
                 $tw = $w;
295 295
             }
296
-            if ($this->logoAlign=='R') {
297
-                $nImgW = round($w/3, 0);
298
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
299
-                $xImg = round($x+($w-(1+$nImgW)), 0);
300
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
296
+            if ($this->logoAlign == 'R') {
297
+                $nImgW = round($w / 3, 0);
298
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
299
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
300
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
301 301
                 $x1 = $x;
302
-                $y1 = round($h/3+$y, 0);
303
-                $tw = round(2*$w/3, 0);
302
+                $y1 = round($h / 3 + $y, 0);
303
+                $tw = round(2 * $w / 3, 0);
304 304
             }
305 305
             $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
306 306
         } else {
307 307
             $x1 = $x;
308
-            $y1 = round($h/3+$y, 0);
308
+            $y1 = round($h / 3 + $y, 0);
309 309
             $tw = $w;
310 310
         }
311 311
         //Nome emitente
312
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B');
313
-        $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:'');
312
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
313
+        $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : '');
314 314
         $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
315 315
         //endereço
316
-        $y1 = $y1+6;
317
-        $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'');
318
-        $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:'');
319
-        $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:'');
320
-        $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:'');
321
-        $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:'');
322
-        $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:'');
316
+        $y1 = $y1 + 6;
317
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
318
+        $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : '');
319
+        $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : '');
320
+        $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : '');
321
+        $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : '');
322
+        $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : '');
323 323
         $CEP = $this->format($CEP, "#####-###");
324
-        $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:'');
325
-        $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:'');
326
-        $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:'');
327
-        $email = (isset($this->aEnd['email'])?$this->aEnd['email']:'');
324
+        $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : '');
325
+        $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : '');
326
+        $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : '');
327
+        $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : '');
328 328
         $foneLen = strlen($fone);
329 329
         if ($foneLen > 0) {
330
-            $fone2 = substr($fone, 0, $foneLen-4);
331
-            $fone1 = substr($fone, 0, $foneLen-8);
330
+            $fone2 = substr($fone, 0, $foneLen - 4);
331
+            $fone1 = substr($fone, 0, $foneLen - 8);
332 332
             $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
333 333
         } else {
334 334
             $fone = '';
335 335
         }
336 336
         if ($email != '') {
337
-            $email = 'Email: '.$email;
337
+            $email = 'Email: ' . $email;
338 338
         }
339 339
         $texto = "";
340
-        $tmp_txt=trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":''));
341
-        $tmp_txt=($tmp_txt=='SN'?'':$tmp_txt);
342
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
343
-        $tmp_txt=trim($bairro . ($bairro!='' && $CEP!=''?" - ":'') . $CEP);
344
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
345
-        $tmp_txt=$mun;
346
-        $tmp_txt.=($tmp_txt!='' && $UF!=''?" - ":'').$UF;
347
-        $tmp_txt.=($tmp_txt!='' && $fone!=''?" - ":'').$fone;
348
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
349
-        $tmp_txt=$email;
350
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
351
-        $this->pdf->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
340
+        $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : ''));
341
+        $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt);
342
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
343
+        $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP);
344
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
345
+        $tmp_txt = $mun;
346
+        $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF;
347
+        $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone;
348
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
349
+        $tmp_txt = $email;
350
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
351
+        $this->pdf->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
352 352
         //##################################################
353 353
         $w2 = round($maxW - $w, 0);
354 354
         $x += $w;
355 355
         $this->pdf->textBox($x, $y, $w2, $h);
356 356
         $y1 = $y + $h;
357
-        $aFont = array('font'=>$this->fontePadrao,'size'=>16,'style'=>'B');
358
-        $this->pdf->textBox($x, $y+2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, '');
359
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'I');
360
-        $this->pdf->textBox($x, $y+7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, '');
357
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B');
358
+        $this->pdf->textBox($x, $y + 2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, '');
359
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I');
360
+        $this->pdf->textBox($x, $y + 7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, '');
361 361
         $tsHora = $this->convertTime($this->dhEvento);
362
-        $texto = 'Criado em : '. date('d/m/Y   H:i:s', $tsHora);
363
-        $this->pdf->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
362
+        $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
363
+        $this->pdf->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
364 364
         $tsHora = $this->convertTime($this->dhRegEvento);
365
-        $texto = 'Prococolo: '.$this->nProt.'  -  Registrado na SEFAZ em: '.date('d/m/Y   H:i:s', $tsHora);
366
-        $this->pdf->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
365
+        $texto = 'Prococolo: ' . $this->nProt . '  -  Registrado na SEFAZ em: ' . date('d/m/Y   H:i:s', $tsHora);
366
+        $this->pdf->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
367 367
         //####################################################
368 368
         $x = $oldX;
369 369
         $this->pdf->textBox($x, $y1, $maxW, 33);
370
-        $sY = $y1+23;
370
+        $sY = $y1 + 23;
371 371
         $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta '
372 372
                 . 'comunicar-lhe que o Conhecimento de Transporte Eletrônico, abaixo '
373 373
                 . 'referenciada, encontra-se cancelada, solicitamos que sejam aplicadas '
374 374
                 . 'essas correções ao executar seus lançamentos fiscais.';
375
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'');
376
-        $this->pdf->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
375
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
376
+        $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
377 377
         //############################################
378 378
         $x = $oldX;
379 379
         $y = $y1;
380 380
         $numNF = substr($this->chCTe, 25, 9);
381 381
         $serie = substr($this->chCTe, 22, 3);
382 382
         $numNF = $this->format($numNF, "###.###.###");
383
-        $texto = "Conhecimento: " . $numNF .'  -   Série: '.$serie;
384
-        $this->pdf->textBox($x+2, $y+11, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
383
+        $texto = "Conhecimento: " . $numNF . '  -   Série: ' . $serie;
384
+        $this->pdf->textBox($x + 2, $y + 11, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
385 385
         $bW = 87;
386 386
         $bH = 15;
387 387
         $x = 55;
388
-        $y = $y1+10;
388
+        $y = $y1 + 10;
389 389
         $w = $maxW;
390 390
         $this->pdf->setFillColor(0, 0, 0);
391
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH);
391
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH);
392 392
         $this->pdf->setFillColor(255, 255, 255);
393
-        $y1 = $y+2+$bH;
394
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'');
393
+        $y1 = $y + 2 + $bH;
394
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
395 395
         $texto = $this->format($this->chCTe, $this->formatoChave);
396
-        $this->pdf->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
396
+        $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
397 397
         $retVal = $sY;
398 398
         //indicar sem valor
399 399
         if ($this->tpAmb != 1) {
400 400
             $x = 10;
401 401
             if ($this->orientacao == 'P') {
402
-                $y = round($this->hPrint*2/3, 0);
402
+                $y = round($this->hPrint * 2 / 3, 0);
403 403
             } else {
404
-                $y = round($this->hPrint/2, 0);
404
+                $y = round($this->hPrint / 2, 0);
405 405
             }
406 406
             $h = 5;
407
-            $w = $maxW-(2*$x);
407
+            $w = $maxW - (2 * $x);
408 408
             $this->pdf->setTextColor(90, 90, 90);
409 409
             $texto = "SEM VALOR FISCAL";
410
-            $aFont = array('font'=>$this->fontePadrao,'size'=>48,'style'=>'B');
410
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
411 411
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
412
-            $aFont = array('font'=>$this->fontePadrao,'size'=>30,'style'=>'B');
412
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
413 413
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
414
-            $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
414
+            $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
415 415
             $this->pdf->setTextColor(0, 0, 0);
416 416
         }
417 417
         return $retVal;
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
     {
427 427
         $maxW = $this->wPrint;
428 428
         $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
429
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'B');
429
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
430 430
         $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
431 431
         $y += 5;
432 432
         $this->pdf->textBox($x, $y, $maxW, 210);
433 433
         $texto = $this->xJust;
434
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B');
435
-        $this->pdf->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
434
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
435
+        $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
436 436
     }
437 437
     
438 438
     /**
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
                 . "validade fiscal.\n O Protocolo deve ser recebido e mantido"
450 450
                 . " em arquivo eletrônico XML e pode ser consultada através dos"
451 451
                 . " Portais das SEFAZ.";
452
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'I');
452
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I');
453 453
         $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
454
-        $y = $this->hPrint -4;
455
-        $texto = "Impresso em  ". date('d/m/Y   H:i:s');
456
-        $w = $this->wPrint-4;
457
-        $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
454
+        $y = $this->hPrint - 4;
455
+        $texto = "Impresso em  " . date('d/m/Y   H:i:s');
456
+        $w = $this->wPrint - 4;
457
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
458 458
         $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
459 459
         $texto = "DaCanccteNFePHP ver. "
460 460
             . $this->version
461 461
             .  "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
462
-        $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
462
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
463 463
         $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org');
464 464
     }
465 465
     
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/makefont/makefont.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -7,6 +7,9 @@  discard block
 block discarded – undo
7 7
 * Author:  Olivier PLATHEY                                                     *
8 8
 *******************************************************************************/
9 9
 
10
+/**
11
+ * @param string $enc
12
+ */
10 13
 function readMap($enc)
11 14
 {
12 15
     //Read a map file
@@ -159,6 +162,9 @@  discard block
 block discarded – undo
159 162
     return $fm;
160 163
 }
161 164
 
165
+/**
166
+ * @param boolean $symbolic
167
+ */
162 168
 function makeFontDescriptor($fm, $symbolic)
163 169
 {
164 170
     //Ascent
@@ -263,6 +269,11 @@  discard block
 block discarded – undo
263 269
     return rtrim($s);
264 270
 }
265 271
 
272
+/**
273
+ * @param string $file
274
+ * @param string $s
275
+ * @param string $mode
276
+ */
266 277
 function saveToFile($file, $s, $mode)
267 278
 {
268 279
     $f = fopen($file, 'w'.$mode);
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
 function readMap($enc)
11 11
 {
12 12
     //Read a map file
13
-    $file = dirname(__FILE__).'/'.strtolower($enc).'.map';
13
+    $file = dirname(__FILE__) . '/' . strtolower($enc) . '.map';
14 14
     $a = file($file);
15 15
     if (empty($a)) {
16
-        die('<b>Error:</b> encoding not found: '.$enc);
16
+        die('<b>Error:</b> encoding not found: ' . $enc);
17 17
     }
18 18
     $cc2gn = array();
19 19
     foreach ($a as $l) {
20
-        if ($l[0]=='!') {
20
+        if ($l[0] == '!') {
21 21
             $e = preg_split('/[ \\t]+/', rtrim($l));
22 22
             $cc = hexdec(substr($e[0], 1));
23 23
             $gn = $e[2];
24 24
             $cc2gn[$cc] = $gn;
25 25
         }
26 26
     }
27
-    for ($i=0; $i<=255; $i++) {
27
+    for ($i = 0; $i <= 255; $i++) {
28 28
         if (!isset($cc2gn[$i])) {
29
-            $cc2gn[$i]='.notdef';
29
+            $cc2gn[$i] = '.notdef';
30 30
         }
31 31
     }
32 32
     return $cc2gn;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
     ];
79 79
     foreach ($a as $l) {
80 80
         $e = explode(' ', rtrim($l));
81
-        if (count($e)<2) {
81
+        if (count($e) < 2) {
82 82
             continue;
83 83
         }
84 84
         $code = $e[0];
85 85
         $param = $e[1];
86 86
         if ($code == 'C') {
87 87
             //Character metrics
88
-            $cc = (int)$e[1];
88
+            $cc = (int) $e[1];
89 89
             $w = $e[4];
90 90
             $gn = $e[7];
91 91
             if (substr($gn, -4) == '20AC') {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 //Fix incorrect glyph name
96 96
                 foreach ($map as $c => $n) {
97 97
                     if ($n == $fix[$gn]) {
98
-                        $map[$c]=$gn;
98
+                        $map[$c] = $gn;
99 99
                     }
100 100
                 }
101 101
             }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             } else {
106 106
                 $widths[$gn] = $w;
107 107
                 if ($gn == 'X') {
108
-                    $fm['CapXHeight']=$e[13];
108
+                    $fm['CapXHeight'] = $e[13];
109 109
                 }
110 110
             }
111 111
             if ($gn == '.notdef') {
@@ -116,23 +116,23 @@  discard block
 block discarded – undo
116 116
         } elseif ($code == 'Weight') {
117 117
             $fm['Weight'] = $param;
118 118
         } elseif ($code == 'ItalicAngle') {
119
-            $fm['ItalicAngle'] = (double)$param;
119
+            $fm['ItalicAngle'] = (double) $param;
120 120
         } elseif ($code == 'Ascender') {
121
-            $fm['Ascender'] = (int)$param;
121
+            $fm['Ascender'] = (int) $param;
122 122
         } elseif ($code == 'Descender') {
123
-            $fm['Descender'] = (int)$param;
123
+            $fm['Descender'] = (int) $param;
124 124
         } elseif ($code == 'UnderlineThickness') {
125
-            $fm['UnderlineThickness'] = (int)$param;
125
+            $fm['UnderlineThickness'] = (int) $param;
126 126
         } elseif ($code == 'UnderlinePosition') {
127
-            $fm['UnderlinePosition'] = (int)$param;
127
+            $fm['UnderlinePosition'] = (int) $param;
128 128
         } elseif ($code == 'IsFixedPitch') {
129 129
             $fm['IsFixedPitch'] = ($param == 'true');
130 130
         } elseif ($code == 'FontBBox') {
131 131
             $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
132 132
         } elseif ($code == 'CapHeight') {
133
-            $fm['CapHeight'] = (int)$param;
133
+            $fm['CapHeight'] = (int) $param;
134 134
         } elseif ($code == 'StdVW') {
135
-            $fm['StdVW'] = (int)$param;
135
+            $fm['StdVW'] = (int) $param;
136 136
         }
137 137
     }
138 138
     if (!isset($fm['FontName'])) {
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
             $widths['Delta'] = $widths['increment'];
147 147
         }
148 148
         //Order widths according to map
149
-        for ($i=0; $i<=255; $i++) {
149
+        for ($i = 0; $i <= 255; $i++) {
150 150
             if (!isset($widths[$map[$i]])) {
151
-                echo '<b>Warning:</b> character '.$map[$i].' is missing<br>';
151
+                echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>';
152 152
                 $widths[$i] = $widths['.notdef'];
153 153
             } else {
154 154
                 $widths[$i] = $widths[$map[$i]];
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 function makeFontDescriptor($fm, $symbolic)
163 163
 {
164 164
     //Ascent
165
-    $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
-    $fd = "array('Ascent'=>".$asc;
165
+    $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
+    $fd = "array('Ascent'=>" . $asc;
167 167
     //Descent
168 168
     $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200);
169
-    $fd .= ",'Descent'=>".$desc;
169
+    $fd .= ",'Descent'=>" . $desc;
170 170
     //CapHeight
171 171
     if (isset($fm['CapHeight'])) {
172 172
         $ch = $fm['CapHeight'];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     } else {
176 176
         $ch = $asc;
177 177
     }
178
-    $fd .= ",'CapHeight'=>".$ch;
178
+    $fd .= ",'CapHeight'=>" . $ch;
179 179
     //Flags
180 180
     $flags = 0;
181 181
     if (isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) {
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
         $flags += 1 << 2;
186 186
     }
187 187
     if (!$symbolic) {
188
-        $flags += 1<< 5;
188
+        $flags += 1 << 5;
189 189
     }
190
-    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) {
190
+    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle'] != 0) {
191 191
         $flags += 1 << 6;
192 192
     }
193
-    $fd.=",'Flags'=>".$flags;
193
+    $fd .= ",'Flags'=>" . $flags;
194 194
     //FontBBox
195 195
     if (isset($fm['FontBBox'])) {
196 196
         $fbb = $fm['FontBBox'];
197 197
     } else {
198
-        $fbb = array(0,$desc-100,1000,$asc+100);
198
+        $fbb = array(0, $desc - 100, 1000, $asc + 100);
199 199
     }
200
-    $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
200
+    $fd .= ",'FontBBox'=>'[" . $fbb[0] . ' ' . $fbb[1] . ' ' . $fbb[2] . ' ' . $fbb[3] . "]'";
201 201
     //ItalicAngle
202 202
     $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
203
-    $fd .= ",'ItalicAngle'=>".$ia;
203
+    $fd .= ",'ItalicAngle'=>" . $ia;
204 204
     //StemV
205 205
     if (isset($fm['StdVW'])) {
206 206
         $stemv = $fm['StdVW'];
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
     } else {
210 210
         $stemv = 70;
211 211
     }
212
-    $fd .= ",'StemV'=>".$stemv;
212
+    $fd .= ",'StemV'=>" . $stemv;
213 213
     //MissingWidth
214 214
     if (isset($fm['MissingWidth'])) {
215
-        $fd .= ",'MissingWidth'=>".$fm['MissingWidth'];
215
+        $fd .= ",'MissingWidth'=>" . $fm['MissingWidth'];
216 216
     }
217 217
     $fd .= ')';
218 218
     return $fd;
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
     //Make character width array
224 224
     $s = "array(\n\t";
225 225
     $cw = $fm['Widths'];
226
-    for ($i=0; $i<=255; $i++) {
226
+    for ($i = 0; $i <= 255; $i++) {
227 227
         if (chr($i) == "'") {
228 228
             $s .= "'\\''";
229 229
         } elseif (chr($i) == "\\") {
230 230
             $s .= "'\\\\'";
231 231
         } elseif ($i >= 32 && $i <= 126) {
232
-            $s .= "'".chr($i)."'";
232
+            $s .= "'" . chr($i) . "'";
233 233
         } else {
234 234
             $s .= "chr($i)";
235 235
         }
236
-        $s .= '=>'.$fm['Widths'][$i];
236
+        $s .= '=>' . $fm['Widths'][$i];
237 237
         if ($i < 255) {
238 238
             $s .= ',';
239 239
         }
240
-        if (($i+1)%22==0) {
240
+        if (($i + 1) % 22 == 0) {
241 241
             $s .= "\n\t";
242 242
         }
243 243
     }
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
     $ref = readMap('cp1252');
252 252
     $s = '';
253 253
     $last = 0;
254
-    for ($i=32; $i<=255; $i++) {
255
-        if ($map[$i]!=$ref[$i]) {
256
-            if ($i!=$last+1) {
257
-                $s .= $i.' ';
254
+    for ($i = 32; $i <= 255; $i++) {
255
+        if ($map[$i] != $ref[$i]) {
256
+            if ($i != $last + 1) {
257
+                $s .= $i . ' ';
258 258
             }
259 259
             $last = $i;
260
-            $s .= '/'.$map[$i].' ';
260
+            $s .= '/' . $map[$i] . ' ';
261 261
         }
262 262
     }
263 263
     return rtrim($s);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
 function saveToFile($file, $s, $mode)
267 267
 {
268
-    $f = fopen($file, 'w'.$mode);
268
+    $f = fopen($file, 'w' . $mode);
269 269
     if (!$f) {
270
-        die('Can\'t write to file '.$file);
270
+        die('Can\'t write to file ' . $file);
271 271
     }
272 272
     fwrite($f, $s, strlen($s));
273 273
     fclose($f);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     //Check if font license allows embedding
291 291
     $f = fopen($file, 'rb');
292 292
     if (!$f) {
293
-        die('<b>Error:</b> Can\'t open '.$file);
293
+        die('<b>Error:</b> Can\'t open ' . $file);
294 294
     }
295 295
     //Extract number of tables
296 296
     fseek($f, 4, SEEK_CUR);
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     fseek($f, 6, SEEK_CUR);
299 299
     //Seek OS/2 table
300 300
     $found = false;
301
-    for ($i=0; $i<$nb; $i++) {
302
-        if (fread($f, 4)=='OS/2') {
301
+    for ($i = 0; $i < $nb; $i++) {
302
+        if (fread($f, 4) == 'OS/2') {
303 303
             $found = true;
304 304
             break;
305 305
         }
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
     //Extract fsType flags
316 316
     fseek($f, 8, SEEK_CUR);
317 317
     $fsType = readShort($f);
318
-    $rl = ($fsType & 0x02)!=0;
319
-    $pp = ($fsType & 0x04)!=0;
320
-    $e = ($fsType & 0x08)!=0;
318
+    $rl = ($fsType & 0x02) != 0;
319
+    $pp = ($fsType & 0x04) != 0;
320
+    $e = ($fsType & 0x08) != 0;
321 321
     fclose($f);
322 322
     if ($rl && !$pp && !$e) {
323 323
         echo '<b>Warning:</b> font license does not allow embedding';
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
     if ($enc) {
342 342
         $map = readMap($enc);
343 343
         foreach ($patch as $cc => $gn) {
344
-            $map[$cc]=$gn;
344
+            $map[$cc] = $gn;
345 345
         }
346 346
     } else {
347
-        $map=array();
347
+        $map = array();
348 348
     }
349 349
     if (!file_exists($afmfile)) {
350
-        die('<b>Error:</b> AFM file not found: '.$afmfile);
350
+        die('<b>Error:</b> AFM file not found: ' . $afmfile);
351 351
     }
352 352
     $fm = readAFM($afmfile, $map);
353 353
     if ($enc) {
354 354
         $diff = makeFontEncoding($map);
355 355
     } else {
356
-        $diff='';
356
+        $diff = '';
357 357
     }
358 358
     $fd = makeFontDescriptor($fm, empty($map));
359 359
     //Find font type
360 360
     if ($fontfile) {
361 361
         $ext = strtolower(substr($fontfile, -3));
362 362
         if ($ext == 'ttf') {
363
-            $type='TrueType';
363
+            $type = 'TrueType';
364 364
         } elseif ($ext == 'pfb') {
365 365
             $type = 'Type1';
366 366
         } else {
367
-            die('<b>Error:</b> unrecognized font file extension: '.$ext);
367
+            die('<b>Error:</b> unrecognized font file extension: ' . $ext);
368 368
         }
369 369
     } else {
370
-        if ($type!='TrueType' && $type!='Type1') {
371
-            die('<b>Error:</b> incorrect font type: '.$type);
370
+        if ($type != 'TrueType' && $type != 'Type1') {
371
+            die('<b>Error:</b> incorrect font type: ' . $type);
372 372
         }
373 373
     }
374 374
     //Start generation
375
-    $s = '<?php'."\n";
376
-    $s .= '$type=\''.$type."';\n";
377
-    $s .= '$name=\''.$fm['FontName']."';\n";
378
-    $s .= '$desc='.$fd.";\n";
375
+    $s = '<?php' . "\n";
376
+    $s .= '$type=\'' . $type . "';\n";
377
+    $s .= '$name=\'' . $fm['FontName'] . "';\n";
378
+    $s .= '$desc=' . $fd . ";\n";
379 379
     if (!isset($fm['UnderlinePosition'])) {
380 380
         $fm['UnderlinePosition'] = -100;
381 381
     }
382 382
     if (!isset($fm['UnderlineThickness'])) {
383 383
         $fm['UnderlineThickness'] = 50;
384 384
     }
385
-    $s .= '$up='.$fm['UnderlinePosition'].";\n";
386
-    $s .= '$ut='.$fm['UnderlineThickness'].";\n";
385
+    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
386
+    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
387 387
     $w = makeWidthArray($fm);
388
-    $s .= '$cw='.$w.";\n";
389
-    $s .= '$enc=\''.$enc."';\n";
390
-    $s.= '$diff=\''.$diff."';\n";
388
+    $s .= '$cw=' . $w . ";\n";
389
+    $s .= '$enc=\'' . $enc . "';\n";
390
+    $s .= '$diff=\'' . $diff . "';\n";
391 391
     $basename = substr(basename($afmfile), 0, -4);
392 392
     if ($fontfile) {
393 393
         //Embedded font
394 394
         if (!file_exists($fontfile)) {
395
-            die('<b>Error:</b> font file not found: '.$fontfile);
395
+            die('<b>Error:</b> font file not found: ' . $fontfile);
396 396
         }
397
-        if ($type=='TrueType') {
397
+        if ($type == 'TrueType') {
398 398
             checkTTF($fontfile);
399 399
         }
400 400
         $f = fopen($fontfile, 'rb');
401 401
         if (!$f) {
402
-            die('<b>Error:</b> Can\'t open '.$fontfile);
402
+            die('<b>Error:</b> Can\'t open ' . $fontfile);
403 403
         }
404 404
         $file = fread($f, filesize($fontfile));
405 405
         fclose($f);
406 406
         if ($type == 'Type1') {
407 407
             //Find first two sections and discard third one
408
-            $header = (ord($file[0])==128);
408
+            $header = (ord($file[0]) == 128);
409 409
             if ($header) {
410 410
                 //Strip first binary header
411 411
                 $file = substr($file, 6);
@@ -414,38 +414,38 @@  discard block
 block discarded – undo
414 414
             if (!$pos) {
415 415
                 die('<b>Error:</b> font file does not seem to be valid Type1');
416 416
             }
417
-            $size1 = $pos+6;
418
-            if ($header && ord($file[$size1])==128) {
417
+            $size1 = $pos + 6;
418
+            if ($header && ord($file[$size1]) == 128) {
419 419
                 //Strip second binary header
420
-                $file = substr($file, 0, $size1).substr($file, $size1+6);
420
+                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
421 421
             }
422 422
             $pos = strpos($file, '00000000');
423 423
             if (!$pos) {
424 424
                 die('<b>Error:</b> font file does not seem to be valid Type1');
425 425
             }
426
-            $size2 = $pos-$size1;
427
-            $file = substr($file, 0, $size1+$size2);
426
+            $size2 = $pos - $size1;
427
+            $file = substr($file, 0, $size1 + $size2);
428 428
         }
429 429
         if (function_exists('gzcompress')) {
430
-            $cmp=$basename.'.z';
430
+            $cmp = $basename . '.z';
431 431
             saveToFile($cmp, gzcompress($file), 'b');
432
-            $s .= '$file=\''.$cmp."';\n";
433
-            echo 'Font file compressed ('.$cmp.')<br>';
432
+            $s .= '$file=\'' . $cmp . "';\n";
433
+            echo 'Font file compressed (' . $cmp . ')<br>';
434 434
         } else {
435
-            $s .= '$file=\''.basename($fontfile)."';\n";
435
+            $s .= '$file=\'' . basename($fontfile) . "';\n";
436 436
             echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
437 437
         }
438 438
         if ($type == 'Type1') {
439
-            $s .= '$size1='.$size1.";\n";
440
-            $s .= '$size2='.$size2.";\n";
439
+            $s .= '$size1=' . $size1 . ";\n";
440
+            $s .= '$size2=' . $size2 . ";\n";
441 441
         } else {
442
-            $s .= '$originalsize='.filesize($fontfile).";\n";
442
+            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
443 443
         }
444 444
     } else {
445 445
         //Not embedded font
446
-        $s .= '$file='."'';\n";
446
+        $s .= '$file=' . "'';\n";
447 447
     }
448
-    $s.="?>\n";
449
-    saveToFile($basename.'.php', $s, 't');
450
-    echo 'Font definition file generated ('.$basename.'.php'.')<br>';
448
+    $s .= "?>\n";
449
+    saveToFile($basename . '.php', $s, 't');
450
+    echo 'Font definition file generated (' . $basename . '.php' . ')<br>';
451 451
 }
Please login to merge, or discard this patch.
src/MDFe/Damdfe.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param string $sPathLogo Caminho para o arquivo do logo
72 72
      * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S-
73 73
      * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF
74
-     * @param string $fonteDAMDFE Nome da fonte alternativa do DAnfe
74
+     * @param string $fontePDF Nome da fonte alternativa do DAnfe
75 75
      * @param integer $mododebug 0-Não 1-Sim e 2-nada (2 default)
76 76
      */
77 77
     public function __construct(
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      * @param float $x
265 265
      * @param float $y
266 266
      * @param integer $pag
267
-     * @return string
267
+     * @return double
268 268
      */
269 269
     private function headerMDFePaisagem($x, $y, $pag)
270 270
     {
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
      * @param float $x
430 430
      * @param float $y
431 431
      * @param integer $pag
432
-     * @return string
432
+     * @return double
433 433
      */
434 434
     private function headerMDFeRetrato($x, $y, $pag)
435 435
     {
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @param float $x
594 594
      * @param float $y
595
-     * @return void
595
+     * @return double
596 596
      */
597 597
     private function bodyMDFe($x, $y)
598 598
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     protected $xml; // string XML NFe
31 31
     protected $logomarca = ''; // path para logomarca em jpg
32 32
     protected $errMsg = ''; // mesagens de erro
33
-    protected $errStatus = false;// status de erro TRUE um erro ocorreu false sem erros
33
+    protected $errStatus = false; // status de erro TRUE um erro ocorreu false sem erros
34 34
     protected $orientacao = 'P'; //orientação da DANFE P-Retrato ou L-Paisagem
35 35
     protected $papel = 'A4'; //formato do papel
36 36
     //destivo do arquivo pdf I-borwser, S-retorna o arquivo, D-força download, F-salva em arquivo local
Please login to merge, or discard this patch.
src/Legacy/FilesFolders.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -137,7 +137,6 @@
 block discarded – undo
137 137
     /**
138 138
      * listDir
139 139
      * Obtem todo o conteúdo de um diretorio, e que atendam ao critério indicado.
140
-     * @param string $dir Diretorio a ser pesquisado
141 140
      * @param string $fileMatch Critério de seleção pode ser usados coringas como *-nfe.xml
142 141
      * @param boolean $retpath se true retorna o path completo dos arquivos se false so retorna o nome dos arquivos
143 142
      * @return array com os nome dos arquivos que atendem ao critério estabelecido ou false
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 class FilesFolders
19 19
 {
20 20
     
21
-    protected static $ambientes = array('homologacao','producao');
21
+    protected static $ambientes = array('homologacao', 'producao');
22 22
     protected static $subdirs = array(
23 23
         'entradas',
24 24
         'assinadas',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             . DIRECTORY_SEPARATOR
70 70
             . $subdir;
71 71
         
72
-        if (! is_dir($path)) {
72
+        if (!is_dir($path)) {
73 73
             $msg = "Não existe o diretorio $path !";
74 74
             throw new RuntimeException($msg);
75 75
         }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         //monta a arvore de diretórios necessária e estabelece permissões de acesso
89 89
         self::createFolder($dirPath);
90 90
         foreach (self::$ambientes as $ambiente) {
91
-            $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente;
91
+            $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente;
92 92
             self::createFolder($folder);
93 93
             foreach (self::$subdirs as $subdir) {
94
-                $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente.DIRECTORY_SEPARATOR.$subdir;
94
+                $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente . DIRECTORY_SEPARATOR . $subdir;
95 95
                 self::createFolder($folder);
96 96
             }
97 97
         }
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function createFolder($folder = '')
107 107
     {
108
-        if (! is_dir($folder)) {
109
-            if (! mkdir($folder, 0777, true)) {
108
+        if (!is_dir($folder)) {
109
+            if (!mkdir($folder, 0777, true)) {
110 110
                 throw new RuntimeException(
111 111
                     "Não foi possivel criar o diretorio $folder. Verifique as permissões"
112 112
                 );
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
     public static function saveFile($path = '', $filename = '', $content = '')
125 125
     {
126 126
         self::createFolder($path);
127
-        $filePath = $path.DIRECTORY_SEPARATOR.$filename;
128
-        if (! file_put_contents($filePath, $content)) {
127
+        $filePath = $path . DIRECTORY_SEPARATOR . $filename;
128
+        if (!file_put_contents($filePath, $content)) {
129 129
             return false;
130 130
         }
131
-        if (! chmod($filePath, 0777)) {
131
+        if (!chmod($filePath, 0777)) {
132 132
             return false;
133 133
         }
134 134
         return true;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 "É necessário passar os parametros diretório e filtro!!!"
151 151
             );
152 152
         }
153
-        if (! is_dir($folder)) {
153
+        if (!is_dir($folder)) {
154 154
             throw new InvalidArgumentException(
155 155
                 "O diretório não existe $folder !!!"
156 156
             );
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
         $aList = array();
159 159
         $search = $folder;
160 160
         if (substr($folder, -1) == DIRECTORY_SEPARATOR) {
161
-            $search = substr($folder, 0, strlen($folder)-1);
161
+            $search = substr($folder, 0, strlen($folder) - 1);
162 162
         }
163
-        $searchmatch = $search.DIRECTORY_SEPARATOR.$fileMatch;
163
+        $searchmatch = $search . DIRECTORY_SEPARATOR . $fileMatch;
164 164
         $aGlob = glob($searchmatch);
165 165
         $aList = $aGlob;
166
-        if (! $retpath && ! empty($aGlob)) {
166
+        if (!$retpath && !empty($aGlob)) {
167 167
             $aList = array();
168 168
             foreach ($aGlob as $pathFile) {
169
-                $aList[] = str_replace($search.DIRECTORY_SEPARATOR, '', $pathFile);
169
+                $aList[] = str_replace($search . DIRECTORY_SEPARATOR, '', $pathFile);
170 170
             }
171 171
         }
172 172
         return $aList;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $comentDir = 'O diret&oacute;rio N&Atilde;O EXISTE';
188 188
         $corDir = $cRed;
189 189
         if (is_dir($path)) {
190
-            $filen = $path.DIRECTORY_SEPARATOR.'teste.txt';
190
+            $filen = $path . DIRECTORY_SEPARATOR . 'teste.txt';
191 191
             $comentDir = ' Sem permiss&atilde;o !!';
192 192
             if (file_put_contents($filen, "teste\r\n")) {
193 193
                 $corDir = $cGreen;
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public static function removeFolder($dirPath)
215 215
     {
216
-        $files = array_diff(scandir($dirPath), array('.','..'));
216
+        $files = array_diff(scandir($dirPath), array('.', '..'));
217 217
         foreach ($files as $file) {
218 218
             if (is_dir("$dirPath/$file")) {
219 219
                 self::removeFolder("$dirPath/$file");
220 220
             } else {
221
-                if (! unlink("$dirPath/$file")) {
221
+                if (!unlink("$dirPath/$file")) {
222 222
                     throw new RuntimeException(
223 223
                         "Falha! sem permissão de exclusão do arquivo $dirPath/$file"
224 224
                     );
225 225
                 }
226 226
             }
227 227
         }
228
-        if (! rmdir($dirPath)) {
228
+        if (!rmdir($dirPath)) {
229 229
             $msg = "Falha! sem permissão de exclusão do diretório $dirPath";
230 230
             throw new RuntimeException($msg);
231 231
         }
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
             $msg = "Um caminho para o arquivo deve ser passado!!";
246 246
             throw new InvalidArgumentException($msg);
247 247
         }
248
-        if (! is_file($pathFile)) {
248
+        if (!is_file($pathFile)) {
249 249
             $msg = "O arquivo indicado não foi localizado!! $pathFile";
250 250
             throw new InvalidArgumentException($msg);
251 251
         }
252
-        if (! is_readable($pathFile)) {
252
+        if (!is_readable($pathFile)) {
253 253
             $msg = "O arquivo indicado não pode ser lido. Permissões!! $pathFile";
254 254
             throw new RuntimeException($msg);
255 255
         }
Please login to merge, or discard this patch.
src/CTe/Daevento.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,6 @@
 block discarded – undo
15 15
  * @author    Roberto L. Machado <linux.rlm at gmail dot com>
16 16
  */
17 17
 
18
-use Exception;
19
-use NFePHP\DA\Legacy\Dom;
20 18
 use NFePHP\DA\Legacy\Pdf;
21 19
 use NFePHP\DA\Legacy\Common;
22 20
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,6 @@  discard block
 block discarded – undo
73 73
      * @param string $sPathLogo Caminho para o arquivo do logo
74 74
      * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S-
75 75
      * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF
76
-     * @param string $fonteDACTE Nome da fonte alternativa do DACTE
77 76
      * @param array $aEnd array com o endereço do emitente
78 77
      * @param integer $mododebug 1-SIM e 0-Não (0 default)
79 78
      */
@@ -165,7 +164,6 @@  discard block
 block discarded – undo
165 164
      * @param string $orientacao
166 165
      * @param string $papel
167 166
      * @param string $logoAlign
168
-     * @param string $situacao_externa
169 167
      * @param string $classPDF
170 168
      * @return string
171 169
      */
@@ -292,7 +290,7 @@  discard block
 block discarded – undo
292 290
      * @param integer $x
293 291
      * @param integer $y
294 292
      * @param integer $pag
295
-     * @return integer
293
+     * @return double
296 294
      */
297 295
     private function header(
298 296
         $x,
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
         $this->rinfEvento       = $this->retEvento->getElementsByTagName("infEvento")->item(0);
135 135
         $this->tpEvento         = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue;
136 136
         if (!in_array($this->tpEvento, array('110110', '110111'))) {
137
-            $this->errMsg = 'Evento não implementado '.$tpEvento.' !!';
137
+            $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!';
138 138
             $this->errStatus = true;
139 139
             return false;
140 140
         }
141 141
         $this->id = str_replace('ID', '', $this->infEvento->getAttribute("Id"));
142 142
         $this->chCTe = $this->infEvento->getElementsByTagName("chCTe")->item(0)->nodeValue;
143
-        $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14);
143
+        $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14);
144 144
         $this->tpAmb = $this->infEvento->getElementsByTagName("tpAmb")->item(0)->nodeValue;
145 145
         $this->cOrgao = $this->infEvento->getElementsByTagName("cOrgao")->item(0)->nodeValue;
146 146
         $this->xCorrecao = $this->infEvento->getElementsByTagName("xCorrecao")->item(0);
147
-        $this->xCorrecao=(empty($this->xCorrecao)?'':$this->xCorrecao->nodeValue);
147
+        $this->xCorrecao = (empty($this->xCorrecao) ? '' : $this->xCorrecao->nodeValue);
148 148
         $this->xCondUso = $this->infEvento->getElementsByTagName("xCondUso")->item(0);
149
-        $this->xCondUso=(empty($this->xCondUso)?'':$this->xCondUso->nodeValue);
150
-        $this->xJust =  $this->infEvento->getElementsByTagName("xJust")->item(0);
151
-        $this->xJust=(empty($this->xJust)?'':$this->xJust->nodeValue);
149
+        $this->xCondUso = (empty($this->xCondUso) ? '' : $this->xCondUso->nodeValue);
150
+        $this->xJust = $this->infEvento->getElementsByTagName("xJust")->item(0);
151
+        $this->xJust = (empty($this->xJust) ? '' : $this->xJust->nodeValue);
152 152
         $this->dhEvento = $this->infEvento->getElementsByTagName("dhEvento")->item(0)->nodeValue;
153 153
         $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue;
154 154
         $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue;
155
-        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue)?
156
-                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue:'';
157
-        $this->CPFDest =  !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue)?
158
-                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue:'';
155
+        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ?
156
+                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : '';
157
+        $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ?
158
+                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : '';
159 159
         $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue;
160 160
         $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue;
161 161
     }
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
         $this->orientacao = $orientacao;
220 220
         $this->papel = $papel;
221 221
         $this->logoAlign = $logoAlign;
222
-        if ($classPDF!==false) {
223
-            $this->pdf = $classPDF ;
222
+        if ($classPDF !== false) {
223
+            $this->pdf = $classPDF;
224 224
         } else {
225 225
             $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
226 226
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             // posição inicial do relatorio
233 233
             $xInic = 1;
234 234
             $yInic = 1;
235
-            if ($this->papel =='A4') { //A4 210x297mm
235
+            if ($this->papel == 'A4') { //A4 210x297mm
236 236
                 $maxW = 210;
237 237
                 $maxH = 297;
238 238
             }
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
             // posição inicial do relatorio
245 245
             $xInic = 5;
246 246
             $yInic = 5;
247
-            if ($papel =='A4') {
247
+            if ($papel == 'A4') {
248 248
                 //A4 210x297mm
249 249
                 $maxH = 210;
250 250
                 $maxW = 297;
251 251
             }
252 252
         }
253 253
         //largura imprimivel em mm
254
-        $this->wPrint = $maxW-($margEsq+$xInic);
254
+        $this->wPrint = $maxW - ($margEsq + $xInic);
255 255
         //comprimento imprimivel em mm
256
-        $this->hPrint = $maxH-($margSup+$yInic);
256
+        $this->hPrint = $maxH - ($margSup + $yInic);
257 257
         // estabelece contagem de paginas
258 258
         $this->pdf->aliasNbPages();
259 259
         // fixa as margens
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
         //coloca o cabeçalho
274 274
         $y = $this->header($x, $y, $pag, $situacao_externa);
275 275
         //coloca os dados da CCe
276
-        $y = $this->body($x, $y+15);
276
+        $y = $this->body($x, $y + 15);
277 277
         //coloca os dados da CCe
278
-        $y = $this->footer($x, $y+$this->hPrint-20);
278
+        $y = $this->footer($x, $y + $this->hPrint - 20);
279 279
         //retorna o ID do evento
280
-        if ($classPDF !==false) {
280
+        if ($classPDF !== false) {
281 281
             $aR = array(
282 282
                 'id'=>$this->id,
283 283
                 'classe_PDF'=>$this->pdf);
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
         $maxW = $this->wPrint;
305 305
         //####################################################################################
306 306
         //coluna esquerda identificação do emitente
307
-        $w = round($maxW*0.41, 0);// 80;
307
+        $w = round($maxW * 0.41, 0); // 80;
308 308
         if ($this->orientacao == 'P') {
309 309
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
310 310
         } else {
311 311
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
312 312
         }
313 313
         $w1 = $w;
314
-        $h=32;
314
+        $h = 32;
315 315
         $oldY += $h;
316 316
         $this->pdf->textBox($x, $y, $w, $h);
317 317
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -319,130 +319,130 @@  discard block
 block discarded – undo
319 319
         if (is_file($this->logomarca)) {
320 320
             $logoInfo = getimagesize($this->logomarca);
321 321
             //largura da imagem em mm
322
-            $logoWmm = ($logoInfo[0]/72)*25.4;
322
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
323 323
             //altura da imagem em mm
324
-            $logoHmm = ($logoInfo[1]/72)*25.4;
325
-            if ($this->logoAlign=='L') {
326
-                $nImgW = round($w/3, 0);
327
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
328
-                $xImg = $x+1;
329
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
324
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
325
+            if ($this->logoAlign == 'L') {
326
+                $nImgW = round($w / 3, 0);
327
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
328
+                $xImg = $x + 1;
329
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
330 330
                 //estabelecer posições do texto
331
-                $x1 = round($xImg + $nImgW +1, 0);
332
-                $y1 = round($h/3+$y, 0);
333
-                $tw = round(2*$w/3, 0);
331
+                $x1 = round($xImg + $nImgW + 1, 0);
332
+                $y1 = round($h / 3 + $y, 0);
333
+                $tw = round(2 * $w / 3, 0);
334 334
             }
335
-            if ($this->logoAlign=='C') {
336
-                $nImgH = round($h/3, 0);
337
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
338
-                $xImg = round(($w-$nImgW)/2+$x, 0);
339
-                $yImg = $y+3;
335
+            if ($this->logoAlign == 'C') {
336
+                $nImgH = round($h / 3, 0);
337
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
338
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
339
+                $yImg = $y + 3;
340 340
                 $x1 = $x;
341 341
                 $y1 = round($yImg + $nImgH + 1, 0);
342 342
                 $tw = $w;
343 343
             }
344
-            if ($this->logoAlign=='R') {
345
-                $nImgW = round($w/3, 0);
346
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
347
-                $xImg = round($x+($w-(1+$nImgW)), 0);
348
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
344
+            if ($this->logoAlign == 'R') {
345
+                $nImgW = round($w / 3, 0);
346
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
347
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
348
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
349 349
                 $x1 = $x;
350
-                $y1 = round($h/3+$y, 0);
351
-                $tw = round(2*$w/3, 0);
350
+                $y1 = round($h / 3 + $y, 0);
351
+                $tw = round(2 * $w / 3, 0);
352 352
             }
353 353
             $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
354 354
         } else {
355 355
             $x1 = $x;
356
-            $y1 = round($h/3+$y, 0);
356
+            $y1 = round($h / 3 + $y, 0);
357 357
             $tw = $w;
358 358
         }
359 359
         //Nome emitente
360 360
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
361
-        $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:'');
361
+        $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : '');
362 362
         $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
363 363
         //endereço
364
-        $y1 = $y1+6;
364
+        $y1 = $y1 + 6;
365 365
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
366
-        $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:'');
367
-        $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:'');
368
-        $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:'');
369
-        $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:'');
370
-        $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:'');
366
+        $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : '');
367
+        $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : '');
368
+        $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : '');
369
+        $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : '');
370
+        $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : '');
371 371
         $CEP = $this->formatField($CEP, "#####-###");
372
-        $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:'');
373
-        $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:'');
374
-        $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:'');
375
-        $email = (isset($this->aEnd['email'])?$this->aEnd['email']:'');
372
+        $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : '');
373
+        $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : '');
374
+        $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : '');
375
+        $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : '');
376 376
         $foneLen = strlen($fone);
377 377
         if ($foneLen > 0) {
378
-            $fone2 = substr($fone, 0, $foneLen-4);
379
-            $fone1 = substr($fone, 0, $foneLen-8);
378
+            $fone2 = substr($fone, 0, $foneLen - 4);
379
+            $fone1 = substr($fone, 0, $foneLen - 8);
380 380
             $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
381 381
         } else {
382 382
             $fone = '';
383 383
         }
384 384
         if ($email != '') {
385
-            $email = 'Email: '.$email;
385
+            $email = 'Email: ' . $email;
386 386
         }
387 387
         $texto = "";
388
-        $tmp_txt = trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":''));
389
-        $tmp_txt = ($tmp_txt=='SN'?'':$tmp_txt);
390
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
391
-        $tmp_txt = trim($bairro.($bairro!='' && $CEP!=''?" - ":'').$CEP);
392
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
388
+        $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : ''));
389
+        $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt);
390
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
391
+        $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP);
392
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
393 393
         $tmp_txt = $mun;
394
-        $tmp_txt.= ($tmp_txt!='' && $UF!=''?" - ":'').$UF;
395
-        $tmp_txt.= ($tmp_txt!='' && $fone!=''?" - ":'').$fone;
396
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
394
+        $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF;
395
+        $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone;
396
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
397 397
         $tmp_txt = $email;
398
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
399
-        $this->pdf->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
398
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
399
+        $this->pdf->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
400 400
         //##################################################
401 401
         $w2 = round($maxW - $w, 0);
402 402
         $x += $w;
403 403
         $this->pdf->textBox($x, $y, $w2, $h);
404 404
         $y1 = $y + $h;
405 405
         $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B');
406
-        if ($this->tpEvento=='110110') {
407
-            $texto='Representação Gráfica de CCe';
406
+        if ($this->tpEvento == '110110') {
407
+            $texto = 'Representação Gráfica de CCe';
408 408
         } else {
409
-            $texto='Representação Gráfica de Evento';
409
+            $texto = 'Representação Gráfica de Evento';
410 410
         }
411
-        $this->pdf->textBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
411
+        $this->pdf->textBox($x, $y + 2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
412 412
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I');
413
-        if ($this->tpEvento=='110110') {
414
-            $texto='(Carta de Correção Eletrônica)';
415
-        } elseif ($this->tpEvento=='110111') {
416
-            $texto='(Cancelamento de CTe)';
413
+        if ($this->tpEvento == '110110') {
414
+            $texto = '(Carta de Correção Eletrônica)';
415
+        } elseif ($this->tpEvento == '110111') {
416
+            $texto = '(Cancelamento de CTe)';
417 417
         }
418
-        $this->pdf->textBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
-        $texto = 'ID do Evento: '.$this->id;
418
+        $this->pdf->textBox($x, $y + 7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
+        $texto = 'ID do Evento: ' . $this->id;
420 420
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
421
-        $this->pdf->textBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
421
+        $this->pdf->textBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
422 422
         $tsHora = $this->convertTime($this->dhEvento);
423
-        $texto = 'Criado em : '. date('d/m/Y   H:i:s', $tsHora);
424
-        $this->pdf->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
423
+        $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
424
+        $this->pdf->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
425 425
         $tsHora = $this->convertTime($this->dhRegEvento);
426
-        $texto = 'Prococolo: '.$this->nProt.'  -  Registrado na SEFAZ em: '.date('d/m/Y   H:i:s', $tsHora);
427
-        $this->pdf->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
426
+        $texto = 'Prococolo: ' . $this->nProt . '  -  Registrado na SEFAZ em: ' . date('d/m/Y   H:i:s', $tsHora);
427
+        $this->pdf->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
428 428
         //####################################################
429 429
         $x = $oldX;
430 430
         $this->pdf->textBox($x, $y1, $maxW, 40);
431
-        $sY = $y1+40;
432
-        if ($this->tpEvento=='110110') {
431
+        $sY = $y1 + 40;
432
+        if ($this->tpEvento == '110110') {
433 433
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
434 434
                     . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, '
435 435
                     . 'contêm irregularidades que estão destacadas e suas respectivas '
436 436
                     . 'correções, solicitamos que sejam aplicadas essas correções ao '
437 437
                     . 'executar seus lançamentos fiscais.';
438
-        } elseif ($this->tpEvento=='110111') {
438
+        } elseif ($this->tpEvento == '110111') {
439 439
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
440 440
                     . 'desta comunicar-lhe que o  Conhecimento de Transporte, abaixo referenciado, está '
441 441
                     . 'cancelado, solicitamos que sejam aplicadas essas correções ao '
442 442
                     . 'executar seus lançamentos fiscais.';
443 443
         }
444 444
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
445
-        $this->pdf->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
445
+        $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
446 446
         //############################################
447 447
         $x = $oldX;
448 448
         $y = $y1;
@@ -450,45 +450,45 @@  discard block
 block discarded – undo
450 450
         $numNF = substr($this->chCTe, 25, 9);
451 451
         $serie = substr($this->chCTe, 22, 3);
452 452
         $numNF = $this->formatField($numNF, "###.###.###");
453
-        $texto = "Conhecimento: " . $numNF .'  -   Série: '.$serie;
454
-        $this->pdf->textBox($x+2, $y+19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
453
+        $texto = "Conhecimento: " . $numNF . '  -   Série: ' . $serie;
454
+        $this->pdf->textBox($x + 2, $y + 19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
455 455
         $bW = 87;
456 456
         $bH = 15;
457 457
         $x = 55;
458
-        $y = $y1+13;
458
+        $y = $y1 + 13;
459 459
         $w = $maxW;
460 460
         $this->pdf->setFillColor(0, 0, 0);
461
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH);
461
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH);
462 462
         $this->pdf->setFillColor(255, 255, 255);
463
-        $y1 = $y+2+$bH;
463
+        $y1 = $y + 2 + $bH;
464 464
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
465 465
         $texto = $this->formatField($this->chCTe, $this->formatoChave);
466
-        $this->pdf->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
-        $retVal = $sY+2;
468
-        if ($this->tpEvento=='110110') {
466
+        $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
+        $retVal = $sY + 2;
468
+        if ($this->tpEvento == '110110') {
469 469
             $x = $oldX;
470 470
             $this->pdf->textBox($x, $sY, $maxW, 15);
471 471
             $texto = $this->xCondUso;
472 472
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I');
473
-            $this->pdf->textBox($x+2, $sY+2, $maxW-2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
-            $retVal = $sY+2;
473
+            $this->pdf->textBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
+            $retVal = $sY + 2;
475 475
         }
476 476
         if ($this->tpAmb != 1) {
477 477
             $x = 10;
478 478
             if ($this->orientacao == 'P') {
479
-                $y = round($this->hPrint*2/3, 0);
479
+                $y = round($this->hPrint * 2 / 3, 0);
480 480
             } else {
481
-                $y = round($this->hPrint/2, 0);
481
+                $y = round($this->hPrint / 2, 0);
482 482
             }
483 483
             $h = 5;
484
-            $w = $maxW-(2*$x);
484
+            $w = $maxW - (2 * $x);
485 485
             $this->pdf->setTextColor(90, 90, 90);
486 486
             $texto = "SEM VALOR FISCAL";
487 487
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
488 488
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
489 489
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
490 490
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
491
-            $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
491
+            $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
492 492
             $this->pdf->setTextColor(0, 0, 0);
493 493
         }
494 494
         return $retVal;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
     private function body($x, $y)
503 503
     {
504 504
         $maxW = $this->wPrint;
505
-        if ($this->tpEvento=='110110') {
505
+        if ($this->tpEvento == '110110') {
506 506
             $texto = 'CORREÇÕES A SEREM CONSIDERADAS';
507 507
         } else {
508 508
             $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
         $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
512 512
         $y += 5;
513 513
         $this->pdf->textBox($x, $y, $maxW, 190);
514
-        if ($this->tpEvento=='110110') {
514
+        if ($this->tpEvento == '110110') {
515 515
             $texto = $this->xCorrecao;
516
-        } elseif ($this->tpEvento=='110111') {
516
+        } elseif ($this->tpEvento == '110111') {
517 517
             $texto = $this->xJust;
518 518
         }
519 519
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
520
-        $this->pdf->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
520
+        $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
521 521
     }
522 522
     
523 523
     /**
@@ -528,12 +528,12 @@  discard block
 block discarded – undo
528 528
     private function footer($x, $y)
529 529
     {
530 530
         $w = $this->wPrint;
531
-        if ($this->tpEvento=='110110') {
531
+        if ($this->tpEvento == '110110') {
532 532
             $texto = "Este documento é uma representação gráfica da CCe e foi "
533 533
                     . "impresso apenas para sua informação e não possue validade fiscal."
534 534
                     . "\n A CCe deve ser recebida e mantida em arquivo eletrônico XML e "
535 535
                     . "pode ser consultada através dos Portais das SEFAZ.";
536
-        } elseif ($this->tpEvento=='110111') {
536
+        } elseif ($this->tpEvento == '110111') {
537 537
             $texto = "Este documento é uma representação gráfica do evento de CTe e foi "
538 538
                     . "impresso apenas para sua informação e não possue validade fiscal."
539 539
                     . "\n O Evento deve ser recebido e mantido em arquivo eletrônico XML e "
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
         }
542 542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I');
543 543
         $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
544
-        $y = $this->hPrint -4;
545
-        $texto = "Impresso em  ". date('d/m/Y   H:i:s');
546
-        $w = $this->wPrint-4;
544
+        $y = $this->hPrint - 4;
545
+        $texto = "Impresso em  " . date('d/m/Y   H:i:s');
546
+        $w = $this->wPrint - 4;
547 547
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
548 548
         $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
549 549
         $texto = "Daevento ver. " . $this->version
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/courier.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-for ($i=0; $i<=255; $i++) {
3
-    $fpdf_charwidths['courier'][chr($i)]=600;
2
+for ($i = 0; $i <= 255; $i++) {
3
+    $fpdf_charwidths['courier'][chr($i)] = 600;
4 4
 }
5
-$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
6
-$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
7
-$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
5
+$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier'];
6
+$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier'];
7
+$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier'];
Please login to merge, or discard this patch.
src/Legacy/Dom.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (substr($xmlString, 0, 1) != '<') {
36 36
             throw new InvalidArgumentException($msg);
37 37
         }
38
-        if (! $this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
38
+        if (!$this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
39 39
             throw new InvalidArgumentException($msg);
40 40
         }
41 41
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         if (empty($node)) {
77 77
             return '';
78 78
         }
79
-        $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
79
+        $texto = !empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
80 80
             $node->getElementsByTagName($name)->item(0)->nodeValue : '';
81 81
         return html_entity_decode($texto, ENT_QUOTES, 'UTF-8');
82 82
     }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
     public function getChave($nodeName = 'infNFe')
106 106
     {
107 107
         $node = $this->getElementsByTagName($nodeName)->item(0);
108
-        if (! empty($node)) {
108
+        if (!empty($node)) {
109 109
             $chaveId = $node->getAttribute("Id");
110
-            $chave =  preg_replace('/[^0-9]/', '', $chaveId);
110
+            $chave = preg_replace('/[^0-9]/', '', $chaveId);
111 111
             return $chave;
112 112
         }
113 113
         return '';
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function addArrayChild(&$parent, $arr)
198 198
     {
199 199
         $num = 0;
200
-        if (! empty($arr) && ! empty($parent)) {
200
+        if (!empty($arr) && !empty($parent)) {
201 201
             foreach ($arr as $node) {
202 202
                 $this->appChild($parent, $node, '');
203 203
                 $num++;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@
 block discarded – undo
67 67
     
68 68
     /**
69 69
      * getValue
70
-     * @param DOMElement $node
70
+     * @param \DOMNode $node
71 71
      * @param string $name
72 72
      * @return string
73 73
      */
Please login to merge, or discard this patch.
src/NFe/Danfce.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,8 +223,8 @@
 block discarded – undo
223 223
         //retorna o ID na NFe
224 224
         if ($classPdf!==false) {
225 225
             $aR = [
226
-             'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
227
-             'classe_PDF'=>$this->pdf
226
+                'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
227
+                'classe_PDF'=>$this->pdf
228 228
             ];
229 229
             return $aR;
230 230
         } else {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
  * @link      http://github.com/nfephp-org/sped-da for the canonical source repository
14 14
  * @author    Roberto Spadim <roberto at spadim dot com dot br>
15 15
  */
16
-use Exception;
17 16
 use InvalidArgumentException;
18 17
 use NFePHP\DA\Legacy\Dom;
19 18
 use NFePHP\DA\Legacy\Pdf;
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
      *
95 95
      * @param string $docXML
96 96
      * @param string $sPathLogo
97
-     * @param string $mododebug
97
+     * @param integer $mododebug
98 98
      * @param string $idToken
99
-     * @param string $Token
99
+     * @param string $emitToken
100 100
      */
101 101
     public function __construct(
102 102
         $docXML = '',
@@ -1074,6 +1074,9 @@  discard block
 block discarded – undo
1074 1074
         return $texto;
1075 1075
     }
1076 1076
     
1077
+    /**
1078
+     * @param string $tBand
1079
+     */
1077 1080
     protected static function getCardName($tBand)
1078 1081
     {
1079 1082
         switch ($tBand) {
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 {
26 26
     protected $papel;
27 27
     protected $xml; // string XML NFe
28
-    protected $logomarca=''; // path para logomarca em jpg
29
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
30
-    protected $debugMode=0; //ativa ou desativa o modo de debug
28
+    protected $logomarca = ''; // path para logomarca em jpg
29
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
30
+    protected $debugMode = 0; //ativa ou desativa o modo de debug
31 31
     protected $tpImp; //ambiente
32
-    protected $fontePadrao='Times';
32
+    protected $fontePadrao = 'Times';
33 33
     protected $nfeProc;
34 34
     protected $nfe;
35 35
     protected $infNFe;
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $this->textoAdic = '';
168 168
         if (isset($this->infAdic)) {
169 169
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
170
-            'Inf. Contribuinte: '.
170
+            'Inf. Contribuinte: ' .
171 171
             trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
172 172
             if (!empty($this->textoAdic)) {
173 173
                 $this->textoAdic = str_replace(";", "\n", $this->textoAdic);
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
         //total inicial de paginas
217 217
         $totPag = 1;
218 218
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
219
-        $this->wPrint = $maxW-($margEsq*2);
219
+        $this->wPrint = $maxW - ($margEsq * 2);
220 220
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
221 221
         //superior e inferior
222
-        $this->hPrint = $maxH-$margSup-$margInf;
222
+        $this->hPrint = $maxH - $margSup - $margInf;
223 223
         // estabelece contagem de paginas
224 224
         $this->pdf->aliasNbPages();
225 225
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
         $this->pdf->setLineWidth(0.1); // define a largura da linha
231 231
         $this->pdf->setTextColor(0, 0, 0);
232 232
         $this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
233
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
234
-        $hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
235
-        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto
233
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
234
+        $hcabecalhoSecundario = 10 + 3; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
235
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
236 236
         $hTotal = 12; //box total (FIXO)
237
-        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos
237
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3; //para pagamentos
238 238
         if (!empty($this->vTroco)) {
239 239
             $hpagamentos += $hLinha;
240 240
         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
268 268
         $y = $this->pagamentosDANFE($x, $y, $hpagamentos);
269 269
         //COLOCA MENSAGEM FISCAL
270
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
270
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
271 271
         $y = $this->fiscalDANFE($x, $y, $hmsgfiscal);
272 272
         //COLOCA CONSUMIDOR
273 273
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         }
287 287
         
288 288
         //retorna o ID na NFe
289
-        if ($classPdf!==false) {
289
+        if ($classPdf !== false) {
290 290
             $aR = [
291 291
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
292 292
              'classe_PDF'=>$this->pdf
@@ -306,14 +306,14 @@  discard block
 block discarded – undo
306 306
         $emitIM     = $this->getTagValue($this->emit, "IM");
307 307
         $emitFone = $this->getTagValue($this->enderEmit, "fone");
308 308
         $foneLen = strlen($emitFone);
309
-        if ($foneLen>0) {
309
+        if ($foneLen > 0) {
310 310
             $ddd = substr($emitFone, 0, 2);
311 311
             $fone1 = substr($emitFone, -8);
312 312
             $digito9 = ' ';
313 313
             if ($foneLen == 11) {
314 314
                 $digito9 = substr($emitFone, 2, 1);
315 315
             }
316
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
316
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
317 317
         } else {
318 318
             $emitFone = '';
319 319
         }
@@ -327,18 +327,18 @@  discard block
 block discarded – undo
327 327
         // CONFIGURAÇÃO DE POSIÇÃO
328 328
         $margemInterna = $this->margemInterna;
329 329
         $maxW = $this->wPrint;
330
-        $h = $h-($margemInterna);
330
+        $h = $h - ($margemInterna);
331 331
         //COLOCA LOGOMARCA
332 332
         if (is_file($this->logomarca)) {
333 333
             $xImg = $margemInterna;
334 334
             $yImg = $margemInterna + 1;
335 335
             $this->pdf->image($this->logomarca, $xImg, $yImg, 30, 22.5);
336
-            $xRs = ($maxW*0.4) + $margemInterna;
337
-            $wRs = ($maxW*0.6);
336
+            $xRs = ($maxW * 0.4) + $margemInterna;
337
+            $wRs = ($maxW * 0.6);
338 338
             $alignEmit = 'L';
339 339
         } else {
340 340
             $xRs = $margemInterna;
341
-            $wRs = ($maxW*1);
341
+            $wRs = ($maxW * 1);
342 342
             $alignEmit = 'L';
343 343
         }
344 344
         //COLOCA RAZÃO SOCIAL
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
     {
359 359
         $margemInterna = $this->margemInterna;
360 360
         $maxW = $this->wPrint;
361
-        $w = ($maxW*1);
361
+        $w = ($maxW * 1);
362 362
         $hBox1 = 7;
363 363
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
364 364
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
         $margemInterna = $this->margemInterna;
376 376
         $maxW = $this->wPrint;
377 377
         $qtdItens = $this->det->length;
378
-        $w = ($maxW*1);
378
+        $w = ($maxW * 1);
379 379
         $hLinha = $this->hLinha;
380 380
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
381
-        $wBoxCod = $w*0.17;
381
+        $wBoxCod = $w * 0.17;
382 382
         $texto = "CÓDIGO";
383 383
         $this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
384
-        $wBoxDescricao = $w*0.43;
384
+        $wBoxDescricao = $w * 0.43;
385 385
         $xBoxDescricao = $wBoxCod + $x;
386 386
         $texto = "DESCRICÃO";
387 387
         $this->pdf->textBox(
@@ -397,19 +397,19 @@  discard block
 block discarded – undo
397 397
             '',
398 398
             false
399 399
         );
400
-        $wBoxQt = $w*0.08;
400
+        $wBoxQt = $w * 0.08;
401 401
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
402 402
         $texto = "QT";
403 403
         $this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
404
-        $wBoxUn = $w*0.06;
404
+        $wBoxUn = $w * 0.06;
405 405
         $xBoxUn = $wBoxQt + $xBoxQt;
406 406
         $texto = "UN";
407 407
         $this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
408
-        $wBoxVl = $w*0.13;
408
+        $wBoxVl = $w * 0.13;
409 409
         $xBoxVl = $wBoxUn + $xBoxUn;
410 410
         $texto = "VALOR";
411 411
         $this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
412
-        $wBoxTotal = $w*0.13;
412
+        $wBoxTotal = $w * 0.13;
413 413
         $xBoxTotal = $wBoxVl + $xBoxVl;
414 414
         $texto = "TOTAL";
415 415
         $this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -429,9 +429,9 @@  discard block
 block discarded – undo
429 429
                 $vUnCom     = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", ".");
430 430
                 $vProd      = number_format($this->getTagValue($prod, "vProd"), 2, ",", ".");
431 431
                 //COLOCA PRODUTO
432
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
432
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
433 433
                 //COLOCA PRODUTO CÓDIGO
434
-                $wBoxCod = $w*0.17;
434
+                $wBoxCod = $w * 0.17;
435 435
                 $texto = $cProd;
436 436
                 $this->pdf->textBox(
437 437
                     $x,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
                     false
448 448
                 );
449 449
                 //COLOCA PRODUTO DESCRIÇÃO
450
-                $wBoxDescricao = $w*0.43;
450
+                $wBoxDescricao = $w * 0.43;
451 451
                 $xBoxDescricao = $wBoxCod + $x;
452 452
                 $texto = $xProd;
453 453
                 $this->pdf->textBox(
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                     false
465 465
                 );
466 466
                 //COLOCA PRODUTO QUANTIDADE
467
-                $wBoxQt = $w*0.08;
467
+                $wBoxQt = $w * 0.08;
468 468
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
469 469
                 $texto = $qCom;
470 470
                 $this->pdf->textBox(
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                     false
482 482
                 );
483 483
                 //COLOCA PRODUTO UNIDADE
484
-                $wBoxUn = $w*0.06;
484
+                $wBoxUn = $w * 0.06;
485 485
                 $xBoxUn = $wBoxQt + $xBoxQt;
486 486
                 $texto = $uCom;
487 487
                 $this->pdf->textBox(
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                     false
499 499
                 );
500 500
                 //COLOCA PRODUTO VL UNITÁRIO
501
-                $wBoxVl = $w*0.13;
501
+                $wBoxVl = $w * 0.13;
502 502
                 $xBoxVl = $wBoxUn + $xBoxUn;
503 503
                 $texto = $vUnCom;
504 504
                 $this->pdf->textBox(
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                     false
516 516
                 );
517 517
                 //COLOCA PRODUTO VL TOTAL
518
-                $wBoxTotal = $w*0.13;
518
+                $wBoxTotal = $w * 0.13;
519 519
                 $xBoxTotal = $wBoxVl + $xBoxVl;
520 520
                 $texto = $vProd;
521 521
                 $this->pdf->textBox(
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
         $margemInterna = $this->margemInterna;
543 543
         $maxW = $this->wPrint;
544 544
         $hLinha = 3;
545
-        $wColEsq = ($maxW*0.7);
546
-        $wColDir = ($maxW*0.3);
545
+        $wColEsq = ($maxW * 0.7);
546
+        $wColDir = ($maxW * 0.3);
547 547
         $xValor = $x + $wColEsq;
548 548
         $qtdItens = $this->det->length;
549 549
         $vProd = $this->getTagValue($this->ICMSTot, "vProd");
@@ -564,28 +564,28 @@  discard block
 block discarded – undo
564 564
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
565 565
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
566 566
         $this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
567
-        $yDesconto = $y + ($hLinha*2);
567
+        $yDesconto = $y + ($hLinha * 2);
568 568
         $texto = "Descontos";
569 569
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
570 570
         $this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
571 571
         $texto = "R$ " . $vDesc;
572 572
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
573 573
         $this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
574
-        $yFrete= $y + ($hLinha*3);
574
+        $yFrete = $y + ($hLinha * 3);
575 575
         $texto = "Frete";
576 576
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
577 577
         $this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
578 578
         $texto = "R$ " . $vFrete;
579 579
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
580 580
         $this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
581
-        $yTotalFinal = $y + ($hLinha*4);
581
+        $yTotalFinal = $y + ($hLinha * 4);
582 582
         $texto = "Total";
583 583
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
584 584
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
585 585
         $texto = "R$ " . $vNF;
586 586
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
587 587
         $this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
588
-        $yTotalFinal = $y + ($hLinha*5);
588
+        $yTotalFinal = $y + ($hLinha * 5);
589 589
         $texto = "Informação dos Tributos Totais Incidentes";
590 590
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
591 591
         $this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -600,16 +600,16 @@  discard block
 block discarded – undo
600 600
         $margemInterna = $this->margemInterna;
601 601
         $maxW = $this->wPrint;
602 602
         $qtdPgto = $this->pag->length;
603
-        $w = ($maxW*1);
603
+        $w = ($maxW * 1);
604 604
         $hLinha = $this->hLinha;
605
-        $wColEsq = ($maxW*0.7);
606
-        $wColDir = ($maxW*0.3);
605
+        $wColEsq = ($maxW * 0.7);
606
+        $wColDir = ($maxW * 0.3);
607 607
         $xValor = $x + $wColEsq;
608 608
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
609
-        $wBoxEsq = $w*0.7;
609
+        $wBoxEsq = $w * 0.7;
610 610
         $texto = "FORMA DE PAGAMENTO";
611 611
         $this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
612
-        $wBoxDir = $w*0.3;
612
+        $wBoxDir = $w * 0.3;
613 613
         $xBoxDescricao = $x + $wBoxEsq;
614 614
         $texto = "VALOR PAGO";
615 615
         $this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                     $tBandNome = self::getCardName($tBand);
632 632
                 }
633 633
                 //COLOCA PRODUTO
634
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
634
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
635 635
                 //COLOCA PRODUTO CÓDIGO
636 636
                 $texto = $tPagNome;
637 637
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
             }
656 656
             
657 657
             if (!empty($this->vTroco)) {
658
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
658
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
659 659
                 //COLOCA PRODUTO CÓDIGO
660 660
                 $texto = 'Troco';
661 661
                 $this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
         $y += 6;
685 685
         $margemInterna = $this->margemInterna;
686 686
         $maxW = $this->wPrint;
687
-        $w = ($maxW*1);
687
+        $w = ($maxW * 1);
688 688
         $hLinha = $this->hLinha;
689 689
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
690 690
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -716,19 +716,19 @@  discard block
 block discarded – undo
716 716
         $dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s');
717 717
         $texto = "ÁREA DE MENSAGEM FISCAL";
718 718
         $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
719
-        $yTex1 = $y + ($hLinha*1);
720
-        $hTex1 = $hLinha*2;
721
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor";
719
+        $yTex1 = $y + ($hLinha * 1);
720
+        $hTex1 = $hLinha * 2;
721
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmiLocalFormat . " - Via Consumidor";
722 722
         $this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
723
-        $yTex2 = $y + ($hLinha*3);
724
-        $hTex2 = $hLinha*2;
723
+        $yTex2 = $y + ($hLinha * 3);
724
+        $hTex2 = $hLinha * 2;
725 725
         
726 726
         $texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : '';
727 727
         $this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
728 728
         $texto = "CHAVE DE ACESSO";
729
-        $yTit2 = $y + ($hLinha*5);
729
+        $yTit2 = $y + ($hLinha * 5);
730 730
         $this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
731
-        $yTex3 = $y + ($hLinha*6);
731
+        $yTex3 = $y + ($hLinha * 6);
732 732
         $texto = $chNFe;
733 733
         $this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
734 734
     }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         $y += 6;
739 739
         $margemInterna = $this->margemInterna;
740 740
         $maxW = $this->wPrint;
741
-        $w = ($maxW*1);
741
+        $w = ($maxW * 1);
742 742
         $hLinha = $this->hLinha;
743 743
         $aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
744 744
         $aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
755 755
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
756 756
                     : '';
757
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
757
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
758 758
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
759 759
             $consNome = $this->getTagValue($this->dest, "xNome");
760 760
             $consLgr = $this->getTagValue($enderDest, "xLgr");
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
             $yTex1 = $y + $hLinha;
795 795
             $texto = $consNome;
796 796
             if (!empty($consDoc)) {
797
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
798
-                $this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
797
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
798
+                $this->pdf->textBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
799 799
             }
800 800
         } else {
801 801
             $yTex1 = $y + $hLinha;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $y += 6;
810 810
         $margemInterna = $this->margemInterna;
811 811
         $maxW = $this->wPrint;
812
-        $w = ($maxW*1)+4;
812
+        $w = ($maxW * 1) + 4;
813 813
         $hLinha = $this->hLinha;
814 814
         $hBoxLinha = $this->hBoxLinha;
815 815
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
         $nProt = '';
819 819
         if (isset($this->nfeProc)) {
820 820
             $nProt = $this->getTagValue($this->nfeProc, "nProt");
821
-            $dhRecbto  = $this->getTagValue($this->nfeProc, "dhRecbto");
821
+            $dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto");
822 822
         }
823 823
         $barcode = new Barcode();
824 824
         $bobj = $barcode->getBarcodeObj(
@@ -832,15 +832,15 @@  discard block
 block discarded – undo
832 832
         $qrcode = $bobj->getPngData();
833 833
         $wQr = 50;
834 834
         $hQr = 50;
835
-        $yQr = ($y+$margemInterna);
836
-        $xQr = ($w/2) - ($wQr/2);
835
+        $yQr = ($y + $margemInterna);
836
+        $xQr = ($w / 2) - ($wQr / 2);
837 837
         // prepare a base64 encoded "data url"
838 838
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
839 839
         $info = getimagesize($pic);
840 840
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
841 841
         $dt = new DateTime($dhRecbto);
842
-        $yQr = ($yQr+$hQr+$margemInterna);
843
-        $this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
842
+        $yQr = ($yQr + $hQr + $margemInterna);
843
+        $this->pdf->textBox($x, $yQr, $w - 4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
844 844
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
845 845
     }
846 846
    
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
         $heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
859 859
                 
860 860
         // seta o textbox do texto adicional
861
-        $this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
861
+        $this->pdf->textBox($x, $y + 3, $w - 2, $hLinha - 3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false);
862 862
     }
863 863
     
864 864
     /**
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
         if ($startPos === false) {
919 919
             return $cdata;
920 920
         }
921
-        for ($x=$len; $x>0; $x--) {
921
+        for ($x = $len; $x > 0; $x--) {
922 922
             if (substr($cdata, $x, 1) == '>') {
923 923
                 $endPos = $x;
924 924
                 break;
@@ -929,15 +929,15 @@  discard block
 block discarded – undo
929 929
         } else {
930 930
             $parte1 = '';
931 931
         }
932
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
932
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
933 933
         if ($endPos < $len) {
934 934
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
935 935
         } else {
936 936
             $parte3 = '';
937 937
         }
938
-        $texto = trim($parte1).' '.trim($parte3);
938
+        $texto = trim($parte1) . ' ' . trim($parte3);
939 939
         if (strpos($parte2, '<CDATA>') === false) {
940
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
940
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
941 941
         } else {
942 942
             $cdata = $parte2;
943 943
         }
@@ -1009,15 +1009,15 @@  discard block
 block discarded – undo
1009 1009
         //grupo CADATA infCpl
1010 1010
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1011 1011
         $r = $dom->getElementsByTagName('receptor')->item(0);
1012
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1013
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1014
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1015
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1016
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1017
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1018
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1019
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1020
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1012
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1013
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1014
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1015
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1016
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1017
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1018
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1019
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1020
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1021 1021
         if (isset($t)) {
1022 1022
             if ($t->hasAttributes()) {
1023 1023
                 $texto .= " Transmissor ";
Please login to merge, or discard this patch.
src/NFe/Daevento.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
  * @author    Roberto L. Machado <linux.rlm at gmail dot com>
16 16
  */
17 17
 
18
-use Exception;
19 18
 use NFePHP\DA\Legacy\Dom;
20 19
 use NFePHP\DA\Legacy\Pdf;
21 20
 use NFePHP\DA\Legacy\Common;
Please login to merge, or discard this patch.
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
      * @param string $sPathLogo   Caminho para o arquivo do logo
75 75
      * @param string $sDestino    Destino do PDF I-browser D-download S-string F-salva
76 76
      * @param string $sDirPDF     Caminho para o diretorio de armazenamento dos arquivos PDF
77
-     * @param string $fonteDANFE  Nome da fonte alternativa
77
+     * @param string $fontePDF  Nome da fonte alternativa
78 78
      * @param array  $aEnd        array com o endereço do emitente
79
-     * @param number $mododebug   0-Não 1-Sim e 2-nada (2 default)
79
+     * @param integer $mododebug   0-Não 1-Sim e 2-nada (2 default)
80 80
      */
81 81
     public function __construct(
82 82
         $docXML = '',
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      * @param  string  $papel
171 171
      * @param  string  $logoAlign
172 172
      * @param  boolean $classe_pdf
173
-     * @return number
173
+     * @return string
174 174
      */
175 175
     public function monta($orientacao = '', $papel = 'A4', $logoAlign = 'C', $classe_pdf = false)
176 176
     {
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
     /**
267 267
      * header
268
-     * @param  number $x
269
-     * @param  number $y
270
-     * @param  number $pag
268
+     * @param  integer $x
269
+     * @param  integer $y
270
+     * @param  integer $pag
271 271
      * @return number
272 272
      */
273 273
     private function header($x, $y, $pag)
@@ -497,8 +497,8 @@  discard block
 block discarded – undo
497 497
     /**
498 498
      * body
499 499
      *
500
-     * @param number $x
501
-     * @param number $y
500
+     * @param integer $x
501
+     * @param double $y
502 502
      */
503 503
     private function body($x, $y)
504 504
     {
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     /**
525 525
      * footer
526 526
      *
527
-     * @param number $x
527
+     * @param integer $x
528 528
      * @param number $y
529 529
      */
530 530
     private function footer($x, $y)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $this->retEvento = $this->dom->getElementsByTagName("retEvento")->item(0);
135 135
         $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0);
136 136
         $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue;
137
-        if (!in_array($this->tpEvento, ['110110','110111'])) {
137
+        if (!in_array($this->tpEvento, ['110110', '110111'])) {
138 138
             $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!';
139 139
             $this->errStatus = true;
140 140
             return false;
@@ -154,11 +154,9 @@  discard block
 block discarded – undo
154 154
         $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue;
155 155
         $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue;
156 156
         $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ?
157
-            $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue :
158
-            '';
157
+            $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : '';
159 158
         $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ?
160
-            $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue :
161
-            '';
159
+            $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : '';
162 160
         $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue;
163 161
         $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue;
164 162
     }
@@ -279,9 +277,9 @@  discard block
 block discarded – undo
279 277
         // coluna esquerda identificação do emitente
280 278
         $w = round($maxW * 0.41, 0); // 80;
281 279
         if ($this->orientacao == 'P') {
282
-            $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
280
+            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
283 281
         } else {
284
-            $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'B'];
282
+            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
285 283
         }
286 284
         $w1 = $w;
287 285
         $h = 32;
@@ -433,7 +431,7 @@  discard block
 block discarded – undo
433 431
                     . 'abaixo referenciada, está cancelada, solicitamos que sejam '
434 432
                     . 'aplicadas essas correções ao executar seus lançamentos fiscais.';
435 433
         }
436
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
434
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
437 435
         $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
438 436
         // ############################################
439 437
         $x = $oldX;
@@ -444,7 +442,7 @@  discard block
 block discarded – undo
444 442
         if ($this->CPFDest != '') {
445 443
             $texto = 'CPF do Destinatário: ' . $this->formatField($this->CPFDest, "###.###.###-##");
446 444
         }
447
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
445
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
448 446
         $this->pdf->textBox($x + 2, $y + 13, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
449 447
         $numNF = substr($this->chNFe, 25, 9);
450 448
         $serie = substr($this->chNFe, 22, 3);
@@ -460,7 +458,7 @@  discard block
 block discarded – undo
460 458
         $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chNFe, $bW, $bH);
461 459
         $this->pdf->setFillColor(255, 255, 255);
462 460
         $y1 = $y + 2 + $bH;
463
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
461
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
464 462
         $texto = $this->formatField($this->chNFe, $this->formatoChave);
465 463
         $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
466 464
         $retVal = $sY + 2;
@@ -468,7 +466,7 @@  discard block
 block discarded – undo
468 466
             $x = $oldX;
469 467
             $this->pdf->textBox($x, $sY, $maxW, 15);
470 468
             $texto = $this->xCondUso;
471
-            $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'I'];
469
+            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
472 470
             $this->pdf->textBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
473 471
             $retVal = $sY + 2;
474 472
         }
@@ -484,9 +482,9 @@  discard block
 block discarded – undo
484 482
             $w = $maxW - (2 * $x);
485 483
             $this->pdf->setTextColor(90, 90, 90);
486 484
             $texto = "SEM VALOR FISCAL";
487
-            $aFont = ['font' => $this->fontePadrao,'size' => 48,'style' => 'B'];
485
+            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
488 486
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
489
-            $aFont = ['font' => $this->fontePadrao,'size' => 30,'style' => 'B'];
487
+            $aFont = ['font' => $this->fontePadrao, 'size' => 30, 'style' => 'B'];
490 488
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
491 489
             $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
492 490
             $this->pdf->setTextColor(0, 0, 0);
@@ -508,7 +506,7 @@  discard block
 block discarded – undo
508 506
         } else {
509 507
             $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
510 508
         }
511
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'B'];
509
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
512 510
         $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
513 511
         $y += 5;
514 512
         $this->pdf->textBox($x, $y, $maxW, 190);
@@ -517,7 +515,7 @@  discard block
 block discarded – undo
517 515
         } elseif ($this->tpEvento == '110111') {
518 516
             $texto = $this->xJust;
519 517
         }
520
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
518
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
521 519
         $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
522 520
     }
523 521
 
@@ -542,15 +540,15 @@  discard block
 block discarded – undo
542 540
                     . "eletrônico XML e pode ser consultada através dos Portais "
543 541
                     . "das SEFAZ.";
544 542
         }
545
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'I'];
543
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'I'];
546 544
         $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
547 545
         $y = $this->hPrint - 4;
548 546
         $texto = "Impresso em  " . date('d/m/Y   H:i:s');
549 547
         $w = $this->wPrint - 4;
550
-        $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
548
+        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
551 549
         $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
552 550
         $texto = "Daevento ver. " . $this->version . "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
553
-        $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
551
+        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
554 552
         $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org');
555 553
     }
556 554
 
Please login to merge, or discard this patch.