Completed
Push — master ( 5bdcba...189d26 )
by Roberto
04:56 queued 02:29
created
src/Legacy/FPDF/Fpdf.php 2 patches
Doc Comments   +52 added lines patch added patch discarded remove patch
@@ -170,6 +170,9 @@  discard block
 block discarded – undo
170 170
         $this->pdfVersion='1.3';
171 171
     }
172 172
     
173
+    /**
174
+     * @param integer $right
175
+     */
173 176
     public function setMargins($left, $top, $right = null)
174 177
     {
175 178
         //Set left, top and right margins
@@ -202,6 +205,9 @@  discard block
 block discarded – undo
202 205
         $this->rMargin = $margin;
203 206
     }
204 207
     
208
+    /**
209
+     * @param boolean $auto
210
+     */
205 211
     public function setAutoPageBreak($auto, $margin = 0)
206 212
     {
207 213
         //Set auto page break mode and triggering margin
@@ -210,6 +216,9 @@  discard block
 block discarded – undo
210 216
         $this->pageBreakTrigger = $this->h-$margin;
211 217
     }
212 218
     
219
+    /**
220
+     * @param string $zoom
221
+     */
213 222
     public function setDisplayMode($zoom, $layout = 'continuous')
214 223
     {
215 224
         //Set display mode in viewer
@@ -225,6 +234,9 @@  discard block
 block discarded – undo
225 234
         }
226 235
     }
227 236
     
237
+    /**
238
+     * @param boolean $compress
239
+     */
228 240
     public function setCompression($compress)
229 241
     {
230 242
         //Set page compression
@@ -286,6 +298,9 @@  discard block
 block discarded – undo
286 298
         $this->aliasNbPages=$alias;
287 299
     }
288 300
     
301
+    /**
302
+     * @param string $msg
303
+     */
289 304
     public function error($msg)
290 305
     {
291 306
         throw new Exception($msg);
@@ -401,6 +416,11 @@  discard block
 block discarded – undo
401 416
         return $this->page;
402 417
     }
403 418
     
419
+    /**
420
+     * @param integer $r
421
+     * @param integer $g
422
+     * @param integer $b
423
+     */
404 424
     public function setDrawColor($r, $g = null, $b = null)
405 425
     {
406 426
         //Set color for all stroking operations
@@ -414,6 +434,11 @@  discard block
 block discarded – undo
414 434
         }
415 435
     }
416 436
     
437
+    /**
438
+     * @param integer $r
439
+     * @param integer $g
440
+     * @param integer $b
441
+     */
417 442
     public function setFillColor($r, $g = null, $b = null)
418 443
     {
419 444
         //Set color for all filling operations
@@ -428,6 +453,11 @@  discard block
 block discarded – undo
428 453
         }
429 454
     }
430 455
     
456
+    /**
457
+     * @param integer $r
458
+     * @param integer $g
459
+     * @param integer $b
460
+     */
431 461
     public function settextColor($r, $g = null, $b = null)
432 462
     {
433 463
         //Set color for text
@@ -654,6 +684,10 @@  discard block
 block discarded – undo
654 684
         $this->links[$link] = [$page, $y];
655 685
     }
656 686
     
687
+    /**
688
+     * @param double $y
689
+     * @param string $link
690
+     */
657 691
     public function link($x, $y, $w, $h, $link)
658 692
     {
659 693
         //Put a link on the page
@@ -666,6 +700,11 @@  discard block
 block discarded – undo
666 700
         ];
667 701
     }
668 702
     
703
+    /**
704
+     * @param double $x
705
+     * @param double $y
706
+     * @param string $txt
707
+     */
669 708
     public function text($x, $y, $txt)
670 709
     {
671 710
         //Output a string
@@ -990,6 +1029,9 @@  discard block
 block discarded – undo
990 1029
         }
991 1030
     }
992 1031
     
1032
+    /**
1033
+     * @param string $file
1034
+     */
993 1035
     public function image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '')
994 1036
     {
995 1037
         //Put an image on the page
@@ -1195,6 +1237,9 @@  discard block
 block discarded – undo
1195 1237
     }
1196 1238
     
1197 1239
     
1240
+    /**
1241
+     * @param string $format
1242
+     */
1198 1243
     protected function getpageformat($format)
1199 1244
     {
1200 1245
         $format=strtolower($format);
@@ -1215,6 +1260,10 @@  discard block
 block discarded – undo
1215 1260
     }
1216 1261
     
1217 1262
     
1263
+    /**
1264
+     * @param string $orientation
1265
+     * @param string $format
1266
+     */
1218 1267
     protected function beginPage($orientation, $format)
1219 1268
     {
1220 1269
         $this->page++;
@@ -1360,6 +1409,9 @@  discard block
 block discarded – undo
1360 1409
     }
1361 1410
     
1362 1411
     
1412
+    /**
1413
+     * @param string $file
1414
+     */
1363 1415
     protected function parsePNG($file)
1364 1416
     {
1365 1417
         //Extract info from a PNG file
Please login to merge, or discard this patch.
Spacing   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -8,64 +8,64 @@  discard block
 block discarded – undo
8 8
 {
9 9
     const FPDF_VERSION = '1.6';
10 10
     
11
-    public $page;               //current page number
12
-    public $n;                  //current object number
13
-    public $offsets;            //array of object offsets
14
-    public $buffer;             //buffer holding in-memory PDF
15
-    public $pages;              //array containing pages
16
-    public $state;              //current document state
17
-    public $compress;           //compression flag
18
-    public $k;                  //scale factor (number of points in user unit)
19
-    public $defOrientation;     //default orientation
20
-    public $curOrientation;     //current orientation
21
-    public $pageFormats;        //available page formats
22
-    public $defPageFormat;      //default page format
23
-    public $curPageFormat;      //current page format
24
-    public $pageSizes;          //array storing non-default page sizes
11
+    public $page; //current page number
12
+    public $n; //current object number
13
+    public $offsets; //array of object offsets
14
+    public $buffer; //buffer holding in-memory PDF
15
+    public $pages; //array containing pages
16
+    public $state; //current document state
17
+    public $compress; //compression flag
18
+    public $k; //scale factor (number of points in user unit)
19
+    public $defOrientation; //default orientation
20
+    public $curOrientation; //current orientation
21
+    public $pageFormats; //available page formats
22
+    public $defPageFormat; //default page format
23
+    public $curPageFormat; //current page format
24
+    public $pageSizes; //array storing non-default page sizes
25 25
     public $wPt;
26
-    public $hPt;           //dimensions of current page in points
26
+    public $hPt; //dimensions of current page in points
27 27
     public $w;
28
-    public $h;               //dimensions of current page in user unit
29
-    public $lMargin;            //left margin
30
-    public $tMargin;            //top margin
31
-    public $rMargin;            //right margin
32
-    public $bMargin;            //page break margin
33
-    public $cMargin;            //cell margin
28
+    public $h; //dimensions of current page in user unit
29
+    public $lMargin; //left margin
30
+    public $tMargin; //top margin
31
+    public $rMargin; //right margin
32
+    public $bMargin; //page break margin
33
+    public $cMargin; //cell margin
34 34
     public $x;
35
-    public $y;               //current position in user unit
36
-    public $lasth;              //height of last printed cell
37
-    public $lineWidth;          //line width in user unit
38
-    public $coreFonts;          //array of standard font names
39
-    public $fonts;              //array of used fonts
40
-    public $fontFiles;          //array of font files
41
-    public $diffs;              //array of encoding differences
42
-    public $fontFamily;         //current font family
43
-    public $fontStyle;          //current font style
44
-    public $underline;          //underlining flag
45
-    public $currentFont;        //current font info
46
-    public $fontSizePt;         //current font size in points
47
-    public $fontSize;           //current font size in user unit
48
-    public $drawColor;          //commands for drawing color
49
-    public $fillColor;          //commands for filling color
50
-    public $textColor;          //commands for text color
51
-    public $colorFlag;          //indicates whether fill and text colors are different
52
-    public $ws;                 //word spacing
53
-    public $images;             //array of used images
54
-    public $PageLinks;          //array of links in pages
55
-    public $links;              //array of internal links
56
-    public $autoPageBreak;      //automatic page breaking
57
-    public $pageBreakTrigger;   //threshold used to trigger page breaks
58
-    public $inHeader;           //flag set when processing header
59
-    public $inFooter;           //flag set when processing footer
60
-    public $zoomMode;           //zoom display mode
61
-    public $layoutMode;         //layout display mode
62
-    public $title;              //title
63
-    public $subject;            //subject
64
-    public $author;             //author
65
-    public $keywords;           //keywords
66
-    public $creator;            //creator
67
-    public $aliasNbPages;       //alias for total number of pages
68
-    public $pdfVersion;         //PDF version number
35
+    public $y; //current position in user unit
36
+    public $lasth; //height of last printed cell
37
+    public $lineWidth; //line width in user unit
38
+    public $coreFonts; //array of standard font names
39
+    public $fonts; //array of used fonts
40
+    public $fontFiles; //array of font files
41
+    public $diffs; //array of encoding differences
42
+    public $fontFamily; //current font family
43
+    public $fontStyle; //current font style
44
+    public $underline; //underlining flag
45
+    public $currentFont; //current font info
46
+    public $fontSizePt; //current font size in points
47
+    public $fontSize; //current font size in user unit
48
+    public $drawColor; //commands for drawing color
49
+    public $fillColor; //commands for filling color
50
+    public $textColor; //commands for text color
51
+    public $colorFlag; //indicates whether fill and text colors are different
52
+    public $ws; //word spacing
53
+    public $images; //array of used images
54
+    public $PageLinks; //array of links in pages
55
+    public $links; //array of internal links
56
+    public $autoPageBreak; //automatic page breaking
57
+    public $pageBreakTrigger; //threshold used to trigger page breaks
58
+    public $inHeader; //flag set when processing header
59
+    public $inFooter; //flag set when processing footer
60
+    public $zoomMode; //zoom display mode
61
+    public $layoutMode; //layout display mode
62
+    public $title; //title
63
+    public $subject; //subject
64
+    public $author; //author
65
+    public $keywords; //keywords
66
+    public $creator; //creator
67
+    public $aliasNbPages; //alias for total number of pages
68
+    public $pdfVersion; //PDF version number
69 69
     
70 70
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
71 71
     {
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
         if ($unit == 'pt') {
117 117
             $this->k = 1;
118 118
         } elseif ($unit == 'mm') {
119
-            $this->k = 72/25.4;
119
+            $this->k = 72 / 25.4;
120 120
         } elseif ($unit == 'cm') {
121
-            $this->k = 72/2.54;
121
+            $this->k = 72 / 2.54;
122 122
         } elseif ($unit == 'in') {
123 123
             $this->k = 72;
124 124
         } else {
125
-            $this->error('Incorrect unit: '.$unit);
125
+            $this->error('Incorrect unit: ' . $unit);
126 126
         }
127 127
         //Page format
128 128
         $this->pageFormats = [
129
-            'a3' => [841.89,1190.55],
130
-            'a4' => [595.28,841.89],
131
-            'a5' => [420.94,595.28],
132
-            'letter' => [612,792],
133
-            'legal' => [612,1008]
129
+            'a3' => [841.89, 1190.55],
130
+            'a4' => [595.28, 841.89],
131
+            'a5' => [420.94, 595.28],
132
+            'letter' => [612, 792],
133
+            'legal' => [612, 1008]
134 134
         ];
135 135
         if (is_string($format)) {
136 136
             $format = $this->getpageformat($format);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         //Page orientation
141 141
         $orientation = strtolower($orientation);
142 142
         if ($orientation == 'p' || $orientation == 'portrait') {
143
-            $this->defOrientation='P';
143
+            $this->defOrientation = 'P';
144 144
             $this->w = $this->defPageFormat[0];
145 145
             $this->h = $this->defPageFormat[1];
146 146
         } elseif ($orientation == 'l' || $orientation == 'landscape') {
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
             $this->w = $this->defPageFormat[1];
149 149
             $this->h = $this->defPageFormat[0];
150 150
         } else {
151
-            $this->error('Incorrect orientation: '.$orientation);
151
+            $this->error('Incorrect orientation: ' . $orientation);
152 152
         }
153 153
         $this->curOrientation = $this->defOrientation;
154
-        $this->wPt = $this->w*$this->k;
155
-        $this->hPt = $this->h*$this->k;
154
+        $this->wPt = $this->w * $this->k;
155
+        $this->hPt = $this->h * $this->k;
156 156
         //Page margins (1 cm)
157
-        $margin = 28.35/$this->k;
157
+        $margin = 28.35 / $this->k;
158 158
         $this->setMargins($margin, $margin);
159 159
         //Interior cell margin (1 mm)
160
-        $this->cMargin = $margin/10;
160
+        $this->cMargin = $margin / 10;
161 161
         //Line width (0.2 mm)
162
-        $this->lineWidth = .567/$this->k;
162
+        $this->lineWidth = .567 / $this->k;
163 163
         //Automatic page break
164
-        $this->setAutoPageBreak(true, 2*$margin);
164
+        $this->setAutoPageBreak(true, 2 * $margin);
165 165
         //Full width display mode
166 166
         $this->setDisplayMode('fullwidth');
167 167
         //Enable compression
168 168
         $this->setCompression(true);
169 169
         //Set default PDF version number
170
-        $this->pdfVersion='1.3';
170
+        $this->pdfVersion = '1.3';
171 171
     }
172 172
     
173 173
     public function setMargins($left, $top, $right = null)
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
         if ($right === null) {
179 179
             $right = $left;
180 180
         }
181
-        $this->rMargin=$right;
181
+        $this->rMargin = $right;
182 182
     }
183 183
     
184 184
     public function setLeftMargin($margin)
@@ -207,21 +207,21 @@  discard block
 block discarded – undo
207 207
         //Set auto page break mode and triggering margin
208 208
         $this->autoPageBreak = $auto;
209 209
         $this->bMargin = $margin;
210
-        $this->pageBreakTrigger = $this->h-$margin;
210
+        $this->pageBreakTrigger = $this->h - $margin;
211 211
     }
212 212
     
213 213
     public function setDisplayMode($zoom, $layout = 'continuous')
214 214
     {
215 215
         //Set display mode in viewer
216
-        if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
216
+        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
217 217
             $this->zoomMode = $zoom;
218 218
         } else {
219
-            $this->error('Incorrect zoom display mode: '.$zoom);
219
+            $this->error('Incorrect zoom display mode: ' . $zoom);
220 220
         }
221
-        if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
221
+        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') {
222 222
             $this->layoutMode = $layout;
223 223
         } else {
224
-            $this->error('Incorrect layout display mode: '.$layout);
224
+            $this->error('Incorrect layout display mode: ' . $layout);
225 225
         }
226 226
     }
227 227
     
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         if ($isUTF8) {
260 260
             $author = $this->utf8Toutf16($author);
261 261
         }
262
-        $this->author=$author;
262
+        $this->author = $author;
263 263
     }
264 264
     
265 265
     public function setKeywords($keywords, $isUTF8 = false)
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     public function aliasNbPages($alias = '{nb}')
284 284
     {
285 285
         //Define an alias for total number of pages
286
-        $this->aliasNbPages=$alias;
286
+        $this->aliasNbPages = $alias;
287 287
     }
288 288
     
289 289
     public function error($msg)
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             $this->open();
323 323
         }
324 324
         $family = $this->fontFamily;
325
-        $style = $this->fontStyle.($this->underline ? 'U' : '');
325
+        $style = $this->fontStyle . ($this->underline ? 'U' : '');
326 326
         $size = $this->fontSizePt;
327 327
         $lw = $this->lineWidth;
328 328
         $dc = $this->drawColor;
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
         $this->out('2 J');
344 344
         //Set line width
345 345
         $this->lineWidth = $lw;
346
-        $this->out(sprintf('%.2F w', $lw*$this->k));
346
+        $this->out(sprintf('%.2F w', $lw * $this->k));
347 347
         //Set font
348 348
         if ($family) {
349 349
             $this->setFont($family, $style, $size);
350 350
         }
351 351
         //Set colors
352 352
         $this->drawColor = $dc;
353
-        if ($dc!='0 G') {
353
+        if ($dc != '0 G') {
354 354
             $this->out($dc);
355 355
         }
356 356
         $this->fillColor = $fc;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         //Restore line width
367 367
         if ($this->lineWidth != $lw) {
368 368
             $this->lineWidth = $lw;
369
-            $this->out(sprintf('%.2F w', $lw*$this->k));
369
+            $this->out(sprintf('%.2F w', $lw * $this->k));
370 370
         }
371 371
         //Restore font
372 372
         if ($family) {
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
     public function setDrawColor($r, $g = null, $b = null)
405 405
     {
406 406
         //Set color for all stroking operations
407
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
408
-            $this->drawColor = sprintf('%.3F G', $r/255);
407
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
408
+            $this->drawColor = sprintf('%.3F G', $r / 255);
409 409
         } else {
410
-            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255);
410
+            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
411 411
         }
412 412
         if ($this->page > 0) {
413 413
             $this->out($this->drawColor);
@@ -417,10 +417,10 @@  discard block
 block discarded – undo
417 417
     public function setFillColor($r, $g = null, $b = null)
418 418
     {
419 419
         //Set color for all filling operations
420
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
421
-            $this->fillColor = sprintf('%.3F g', $r/255);
420
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
421
+            $this->fillColor = sprintf('%.3F g', $r / 255);
422 422
         } else {
423
-            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
423
+            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
424 424
         }
425 425
         $this->colorFlag = ($this->fillColor != $this->textColor);
426 426
         if ($this->page > 0) {
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
     public function settextColor($r, $g = null, $b = null)
432 432
     {
433 433
         //Set color for text
434
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
435
-            $this->textColor = sprintf('%.3F g', $r/255);
434
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
435
+            $this->textColor = sprintf('%.3F g', $r / 255);
436 436
         } else {
437
-            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
437
+            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
438 438
         }
439 439
         $this->colorFlag = ($this->fillColor != $this->textColor);
440 440
     }
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
     public function getStringWidth($s)
443 443
     {
444 444
         //Get width of a string in the current font
445
-        $s = (string)$s;
446
-        $cw =& $this->currentFont['cw'];
445
+        $s = (string) $s;
446
+        $cw = & $this->currentFont['cw'];
447 447
         $w = 0;
448 448
         $l = strlen($s);
449
-        for ($i=0; $i<$l; $i++) {
449
+        for ($i = 0; $i < $l; $i++) {
450 450
             $w += $cw[$s[$i]];
451 451
         }
452
-        return $w*$this->fontSize/1000;
452
+        return $w * $this->fontSize / 1000;
453 453
     }
454 454
     
455 455
     public function setLineWidth($width)
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         //Set line width
458 458
         $this->lineWidth = $width;
459 459
         if ($this->page > 0) {
460
-            $this->out(sprintf('%.2F w', $width*$this->k));
460
+            $this->out(sprintf('%.2F w', $width * $this->k));
461 461
         }
462 462
     }
463 463
     
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
         $this->out(
468 468
             sprintf(
469 469
                 '%.2F %.2F m %.2F %.2F l S',
470
-                $x1*$this->k,
471
-                ($this->h-$y1)*$this->k,
472
-                $x2*$this->k,
473
-                ($this->h-$y2)*$this->k
470
+                $x1 * $this->k,
471
+                ($this->h - $y1) * $this->k,
472
+                $x2 * $this->k,
473
+                ($this->h - $y2) * $this->k
474 474
             )
475 475
         );
476 476
     }
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
         $this->out(
489 489
             sprintf(
490 490
                 '%.2F %.2F %.2F %.2F re %s',
491
-                $x*$this->k,
492
-                ($this->h-$y)*$this->k,
493
-                $w*$this->k,
494
-                -$h*$this->k,
491
+                $x * $this->k,
492
+                ($this->h - $y) * $this->k,
493
+                $w * $this->k,
494
+                -$h * $this->k,
495 495
                 $op
496 496
             )
497 497
         );
@@ -502,24 +502,24 @@  discard block
 block discarded – undo
502 502
         //Add a TrueType or Type1 font
503 503
         $family = strtolower($family);
504 504
         if ($file == '') {
505
-            $file = str_replace(' ', '', $family).strtolower($style).'.php';
505
+            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
506 506
         }
507
-        if ($family=='arial') {
508
-            $family='helvetica';
507
+        if ($family == 'arial') {
508
+            $family = 'helvetica';
509 509
         }
510 510
         $style = strtoupper($style);
511 511
         if ($style == 'IB') {
512 512
             $style = 'BI';
513 513
         }
514
-        $fontkey = $family.$style;
514
+        $fontkey = $family . $style;
515 515
         if (isset($this->fonts[$fontkey])) {
516 516
             return;
517 517
         }
518
-        include $this->getFontPath().$file;
518
+        include $this->getFontPath() . $file;
519 519
         if (!isset($name)) {
520 520
             $this->error('Could not include font definition file');
521 521
         }
522
-        $i = count($this->fonts)+1;
522
+        $i = count($this->fonts) + 1;
523 523
         $this->fonts[$fontkey] = [
524 524
             'i'=>$i,
525 525
             'type'=>$type,
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
             //Search existing encodings
536 536
             $d = 0;
537 537
             $nb = count($this->diffs);
538
-            for ($i=1; $i<=$nb; $i++) {
538
+            for ($i = 1; $i <= $nb; $i++) {
539 539
                 if ($this->diffs[$i] == $diff) {
540 540
                     $d = $i;
541 541
                     break;
542 542
                 }
543 543
             }
544 544
             if ($d == 0) {
545
-                $d = $nb+1;
545
+                $d = $nb + 1;
546 546
                 $this->diffs[$d] = $diff;
547 547
             }
548 548
             $this->fonts[$fontkey]['diff'] = $d;
549 549
         }
550 550
         if ($file) {
551
-            if ($type=='TrueType') {
551
+            if ($type == 'TrueType') {
552 552
                 $this->fontFiles[$file] = ['length1'=>$originalsize];
553 553
             } else {
554 554
                 $this->fontFiles[$file] = ['length1'=>$size1, 'length2'=>$size2];
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
             $size = $this->fontSizePt;
584 584
         }
585 585
         //Test if font is already selected
586
-        if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) {
586
+        if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) {
587 587
             return;
588 588
         }
589 589
         //Test if used for the first time
590
-        $fontkey = $family.$style;
590
+        $fontkey = $family . $style;
591 591
         if (!isset($this->fonts[$fontkey])) {
592 592
             //Check if one of the standard fonts
593 593
             if (isset($this->coreFonts[$fontkey])) {
594 594
                 if (!isset($fpdf_charwidths[$fontkey])) {
595 595
                     //Load metric file
596
-                    $file=$family;
597
-                    if ($family=='times' || $family=='helvetica') {
596
+                    $file = $family;
597
+                    if ($family == 'times' || $family == 'helvetica') {
598 598
                         $file .= strtolower($style);
599 599
                     }
600
-                    include $this->getFontPath().$file.'.php';
600
+                    include $this->getFontPath() . $file . '.php';
601 601
                     if (!isset($fpdf_charwidths[$fontkey])) {
602 602
                         $this->error('Could not include font metric file');
603 603
                     }
604 604
                 }
605
-                $i = count($this->fonts)+1;
605
+                $i = count($this->fonts) + 1;
606 606
                 $name = $this->coreFonts[$fontkey];
607 607
                 $cw = $fpdf_charwidths[$fontkey];
608 608
                 $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw];
609 609
             } else {
610
-                $this->error('Undefined font: '.$family.' '.$style);
610
+                $this->error('Undefined font: ' . $family . ' ' . $style);
611 611
             }
612 612
         }
613 613
         //Select it
614 614
         $this->fontFamily = $family;
615 615
         $this->fontStyle = $style;
616 616
         $this->fontSizePt = $size;
617
-        $this->fontSize = $size/$this->k;
618
-        $this->currentFont =& $this->fonts[$fontkey];
617
+        $this->fontSize = $size / $this->k;
618
+        $this->currentFont = & $this->fonts[$fontkey];
619 619
         if ($this->page > 0) {
620 620
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
621 621
         }
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             return;
629 629
         }
630 630
         $this->fontSizePt = $size;
631
-        $this->fontSize = $size/$this->k;
631
+        $this->fontSize = $size / $this->k;
632 632
         if ($this->page > 0) {
633 633
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
634 634
         }
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
     public function addlink()
638 638
     {
639 639
         //Create a new internal link
640
-        $n = count($this->links)+1;
640
+        $n = count($this->links) + 1;
641 641
         $this->links[$n] = [0, 0];
642 642
         return $n;
643 643
     }
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
     {
659 659
         //Put a link on the page
660 660
         $this->PageLinks[$this->page][] = [
661
-            $x*$this->k,
662
-            $this->hPt-$y*$this->k,
663
-            $w*$this->k,
664
-            $h*$this->k,
661
+            $x * $this->k,
662
+            $this->hPt - $y * $this->k,
663
+            $w * $this->k,
664
+            $h * $this->k,
665 665
             $link
666 666
         ];
667 667
     }
@@ -669,12 +669,12 @@  discard block
 block discarded – undo
669 669
     public function text($x, $y, $txt)
670 670
     {
671 671
         //Output a string
672
-        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt));
673
-        if ($this->underline && $txt!='') {
674
-            $s .= ' '.$this->doUnderLine($x, $y, $txt);
672
+        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt));
673
+        if ($this->underline && $txt != '') {
674
+            $s .= ' ' . $this->doUnderLine($x, $y, $txt);
675 675
         }
676 676
         if ($this->colorFlag) {
677
-            $s = 'q '.$this->textColor.' '.$s.' Q';
677
+            $s = 'q ' . $this->textColor . ' ' . $s . ' Q';
678 678
         }
679 679
         $this->out($s);
680 680
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
     {
690 690
         //Output a cell
691 691
         $k = $this->k;
692
-        if ($this->y+$h > $this->pageBreakTrigger
692
+        if ($this->y + $h > $this->pageBreakTrigger
693 693
             && !$this->InHeader
694 694
             && !$this->InFooter
695 695
             && $this->acceptPageBreak()
@@ -705,77 +705,77 @@  discard block
 block discarded – undo
705 705
             $this->x = $x;
706 706
             if ($ws > 0) {
707 707
                 $this->ws = $ws;
708
-                $this->out(sprintf('%.3F Tw', $ws*$k));
708
+                $this->out(sprintf('%.3F Tw', $ws * $k));
709 709
             }
710 710
         }
711 711
         if ($w == 0) {
712
-            $w = $this->w-$this->rMargin-$this->x;
712
+            $w = $this->w - $this->rMargin - $this->x;
713 713
         }
714
-        $s='';
715
-        if ($fill || $border==1) {
714
+        $s = '';
715
+        if ($fill || $border == 1) {
716 716
             if ($fill) {
717
-                $op=($border==1) ? 'B' : 'f';
717
+                $op = ($border == 1) ? 'B' : 'f';
718 718
             } else {
719
-                $op='S';
719
+                $op = 'S';
720 720
             }
721
-            $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op);
721
+            $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
722 722
         }
723 723
         if (is_string($border)) {
724 724
             $x = $this->x;
725 725
             $y = $this->y;
726 726
             if (strpos($border, 'L') !== false) {
727
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k);
727
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k);
728 728
             }
729 729
             if (strpos($border, 'T') !== false) {
730
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k);
730
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
731 731
             }
732 732
             if (strpos($border, 'R') !== false) {
733 733
                 $s .= sprintf(
734 734
                     '%.2F %.2F m %.2F %.2F l S ',
735
-                    ($x+$w)*$k,
736
-                    ($this->h-$y)*$k,
737
-                    ($x+$w)*$k,
738
-                    ($this->h-($y+$h))*$k
735
+                    ($x + $w) * $k,
736
+                    ($this->h - $y) * $k,
737
+                    ($x + $w) * $k,
738
+                    ($this->h - ($y + $h)) * $k
739 739
                 );
740 740
             }
741 741
             if (strpos($border, 'B') !== false) {
742 742
                 $s .= sprintf(
743 743
                     '%.2F %.2F m %.2F %.2F l S ',
744
-                    $x*$k,
745
-                    ($this->h-($y+$h))*$k,
746
-                    ($x+$w)*$k,
747
-                    ($this->h-($y+$h))*$k
744
+                    $x * $k,
745
+                    ($this->h - ($y + $h)) * $k,
746
+                    ($x + $w) * $k,
747
+                    ($this->h - ($y + $h)) * $k
748 748
                 );
749 749
             }
750 750
         }
751 751
         if ($txt !== '') {
752 752
             if ($align == 'R') {
753
-                $dx = $w-$this->cMargin-$this->getStringWidth($txt);
753
+                $dx = $w - $this->cMargin - $this->getStringWidth($txt);
754 754
             } elseif ($align == 'C') {
755
-                $dx = ($w-$this->getStringWidth($txt))/2;
755
+                $dx = ($w - $this->getStringWidth($txt)) / 2;
756 756
             } else {
757 757
                 $dx = $this->cMargin;
758 758
             }
759 759
             if ($this->colorFlag) {
760
-                $s .= 'q '.$this->textColor.' ';
760
+                $s .= 'q ' . $this->textColor . ' ';
761 761
             }
762 762
             $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
763 763
             $s .= sprintf(
764 764
                 'BT %.2F %.2F Td (%s) Tj ET',
765
-                ($this->x+$dx)*$k,
766
-                ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k,
765
+                ($this->x + $dx) * $k,
766
+                ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k,
767 767
                 $txt2
768 768
             );
769 769
             if ($this->underline) {
770
-                $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt);
770
+                $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt);
771 771
             }
772 772
             if ($this->colorFlag) {
773
-                $s.=' Q';
773
+                $s .= ' Q';
774 774
             }
775 775
             if ($link) {
776 776
                 $this->link(
777
-                    $this->x+$dx,
778
-                    $this->y+.5*$h-.5*$this->fontSize,
777
+                    $this->x + $dx,
778
+                    $this->y + .5 * $h - .5 * $this->fontSize,
779 779
                     $this->getStringWidth($txt),
780 780
                     $this->fontSize,
781 781
                     $link
@@ -800,14 +800,14 @@  discard block
 block discarded – undo
800 800
     public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false)
801 801
     {
802 802
         //Output text with automatic or explicit line breaks
803
-        $cw =& $this->currentFont['cw'];
803
+        $cw = & $this->currentFont['cw'];
804 804
         if ($w == 0) {
805
-            $w = $this->w-$this->rMargin-$this->x;
805
+            $w = $this->w - $this->rMargin - $this->x;
806 806
         }
807
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
807
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
808 808
         $s = str_replace("\r", '', $txt);
809 809
         $nb = strlen($s);
810
-        if ($nb>0 && $s[$nb-1] == "\n") {
810
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
811 811
             $nb--;
812 812
         }
813 813
         $b = 0;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
                 if (strpos($border, 'R') !== false) {
825 825
                     $b2 .= 'R';
826 826
                 }
827
-                $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2;
827
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
828 828
             }
829 829
         }
830 830
         $sep = -1;
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
         $l = 0;
834 834
         $ns = 0;
835 835
         $nl = 1;
836
-        while ($i<$nb) {
836
+        while ($i < $nb) {
837 837
             //Get next character
838 838
             $c = $s[$i];
839 839
             if ($c == "\n") {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                     $this->ws = 0;
843 843
                     $this->out('0 Tw');
844 844
                 }
845
-                $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
845
+                $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
846 846
                 $i++;
847 847
                 $sep = -1;
848 848
                 $j = $i;
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
                 $ns = 0;
851 851
                 $nl++;
852 852
                 if ($border && $nl == 2) {
853
-                    $b=$b2;
853
+                    $b = $b2;
854 854
                 }
855 855
                 continue;
856 856
             }
@@ -870,14 +870,14 @@  discard block
 block discarded – undo
870 870
                         $this->ws = 0;
871 871
                         $this->out('0 Tw');
872 872
                     }
873
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
873
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
874 874
                 } else {
875
-                    if ($align=='J') {
876
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0;
877
-                        $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
875
+                    if ($align == 'J') {
876
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0;
877
+                        $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
878 878
                     }
879
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
880
-                    $i = $sep+1;
879
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
880
+                    $i = $sep + 1;
881 881
                 }
882 882
                 $sep = -1;
883 883
                 $j = $i;
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
             $this->ws = 0;
897 897
             $this->out('0 Tw');
898 898
         }
899
-        if ($border && strpos($border, 'B')!==false) {
899
+        if ($border && strpos($border, 'B') !== false) {
900 900
             $b .= 'B';
901 901
         }
902
-        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
902
+        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
903 903
         $this->x = $this->lMargin;
904 904
     }
905 905
     
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
     public function write($h, $txt, $link = '')
908 908
     {
909 909
         //Output text in flowing mode
910
-        $cw =& $this->currentFont['cw'];
911
-        $w = $this->w-$this->rMargin-$this->x;
912
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
910
+        $cw = & $this->currentFont['cw'];
911
+        $w = $this->w - $this->rMargin - $this->x;
912
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
913 913
         $s = str_replace("\r", '', $txt);
914 914
         $nb = strlen($s);
915 915
         $sep = -1;
@@ -919,18 +919,18 @@  discard block
 block discarded – undo
919 919
         $nl = 1;
920 920
         while ($i < $nb) {
921 921
             //Get next character
922
-            $c=$s[$i];
923
-            if ($c=="\n") {
922
+            $c = $s[$i];
923
+            if ($c == "\n") {
924 924
                 //Explicit line break
925
-                $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
925
+                $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
926 926
                 $i++;
927 927
                 $sep = -1;
928 928
                 $j = $i;
929 929
                 $l = 0;
930 930
                 if ($nl == 1) {
931 931
                     $this->x = $this->lMargin;
932
-                    $w = $this->w-$this->rMargin-$this->x;
933
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
932
+                    $w = $this->w - $this->rMargin - $this->x;
933
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
934 934
                 }
935 935
                 $nl++;
936 936
                 continue;
@@ -946,8 +946,8 @@  discard block
 block discarded – undo
946 946
                         //Move to next line
947 947
                         $this->x = $this->lMargin;
948 948
                         $this->y += $h;
949
-                        $w = $this->w-$this->rMargin-$this->x;
950
-                        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
949
+                        $w = $this->w - $this->rMargin - $this->x;
950
+                        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
951 951
                         $i++;
952 952
                         $nl++;
953 953
                         continue;
@@ -955,18 +955,18 @@  discard block
 block discarded – undo
955 955
                     if ($i == $j) {
956 956
                         $i++;
957 957
                     }
958
-                    $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
958
+                    $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
959 959
                 } else {
960
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link);
961
-                    $i = $sep+1;
960
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link);
961
+                    $i = $sep + 1;
962 962
                 }
963 963
                 $sep = -1;
964 964
                 $j = $i;
965 965
                 $l = 0;
966 966
                 if ($nl == 1) {
967 967
                     $this->x = $this->lMargin;
968
-                    $w = $this->w-$this->rMargin-$this->x;
969
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
968
+                    $w = $this->w - $this->rMargin - $this->x;
969
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
970 970
                 }
971 971
                 $nl++;
972 972
             } else {
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
         }
976 976
         //Last chunk
977 977
         if ($i != $j) {
978
-            $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
978
+            $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
979 979
         }
980 980
     }
981 981
     
@@ -998,20 +998,20 @@  discard block
 block discarded – undo
998 998
             if ($type == '') {
999 999
                 $pos = strrpos($file, '.');
1000 1000
                 if (!$pos) {
1001
-                    $this->error('Image file has no extension and no type was specified: '.$file);
1001
+                    $this->error('Image file has no extension and no type was specified: ' . $file);
1002 1002
                 }
1003
-                $type = substr($file, $pos+1);
1003
+                $type = substr($file, $pos + 1);
1004 1004
             }
1005 1005
             $type = strtolower($type);
1006 1006
             if ($type == 'jpeg') {
1007 1007
                 $type = 'jpg';
1008 1008
             }
1009
-            $mtd = 'parse'.strtoupper($type);
1009
+            $mtd = 'parse' . strtoupper($type);
1010 1010
             if (!method_exists($this, $mtd)) {
1011
-                $this->error('Unsupported image type: '.$type);
1011
+                $this->error('Unsupported image type: ' . $type);
1012 1012
             }
1013 1013
             $info = $this->$mtd($file);
1014
-            $info['i'] = count($this->images)+1;
1014
+            $info['i'] = count($this->images) + 1;
1015 1015
             $this->images[$file] = $info;
1016 1016
         } else {
1017 1017
             $info = $this->images[$file];
@@ -1019,16 +1019,16 @@  discard block
 block discarded – undo
1019 1019
         //Automatic width and height calculation if needed
1020 1020
         if ($w == 0 && $h == 0) {
1021 1021
             //Put image at 72 dpi
1022
-            $w = $info['w']/$this->k;
1023
-            $h = $info['h']/$this->k;
1022
+            $w = $info['w'] / $this->k;
1023
+            $h = $info['h'] / $this->k;
1024 1024
         } elseif ($w == 0) {
1025
-            $w = $h*$info['w']/$info['h'];
1025
+            $w = $h * $info['w'] / $info['h'];
1026 1026
         } elseif ($h == 0) {
1027
-            $h = $w*$info['h']/$info['w'];
1027
+            $h = $w * $info['h'] / $info['w'];
1028 1028
         }
1029 1029
         //Flowing mode
1030 1030
         if ($y === null) {
1031
-            if ($this->y+$h > $this->pageBreakTrigger
1031
+            if ($this->y + $h > $this->pageBreakTrigger
1032 1032
                 && !$this->inHeader
1033 1033
                 && !$this->inFooter
1034 1034
                 && $this->acceptPageBreak()
@@ -1047,10 +1047,10 @@  discard block
 block discarded – undo
1047 1047
         $this->out(
1048 1048
             sprintf(
1049 1049
                 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',
1050
-                $w*$this->k,
1051
-                $h*$this->k,
1052
-                $x*$this->k,
1053
-                ($this->h-($y+$h))*$this->k,
1050
+                $w * $this->k,
1051
+                $h * $this->k,
1052
+                $x * $this->k,
1053
+                ($this->h - ($y + $h)) * $this->k,
1054 1054
                 $info['i']
1055 1055
             )
1056 1056
         );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         if ($x >= 0) {
1074 1074
             $this->x = $x;
1075 1075
         } else {
1076
-            $this->x = $this->w+$x;
1076
+            $this->x = $this->w + $x;
1077 1077
         }
1078 1078
     }
1079 1079
     
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
         if ($y >= 0) {
1093 1093
             $this->y = $y;
1094 1094
         } else {
1095
-            $this->y = $this->h+$y;
1095
+            $this->y = $this->h + $y;
1096 1096
         }
1097 1097
     }
1098 1098
     
@@ -1139,8 +1139,8 @@  discard block
 block discarded – undo
1139 1139
                     if (headers_sent()) {
1140 1140
                         $this->error('Some data has already been output, can\'t send PDF file');
1141 1141
                     }
1142
-                    header('Content-Length: '.strlen($this->buffer));
1143
-                    header('Content-Disposition: inline; filename="'.$name.'"');
1142
+                    header('Content-Length: ' . strlen($this->buffer));
1143
+                    header('Content-Disposition: inline; filename="' . $name . '"');
1144 1144
                     header('Cache-Control: private, max-age=0, must-revalidate');
1145 1145
                     header('Pragma: public');
1146 1146
                     ini_set('zlib.output_compression', '0');
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
                 if (headers_sent()) {
1157 1157
                     $this->error('Some data has already been output, can\'t send PDF file');
1158 1158
                 }
1159
-                header('Content-Length: '.strlen($this->buffer));
1160
-                header('Content-Disposition: attachment; filename="'.$name.'"');
1159
+                header('Content-Length: ' . strlen($this->buffer));
1160
+                header('Content-Disposition: attachment; filename="' . $name . '"');
1161 1161
                 header('Cache-Control: private, max-age=0, must-revalidate');
1162 1162
                 header('Pragma: public');
1163 1163
                 ini_set('zlib.output_compression', '0');
@@ -1165,9 +1165,9 @@  discard block
 block discarded – undo
1165 1165
                 break;
1166 1166
             case 'F':
1167 1167
                 //Save to local file
1168
-                $f=fopen($name, 'wb');
1168
+                $f = fopen($name, 'wb');
1169 1169
                 if (!$f) {
1170
-                    $this->error('Unable to create output file: '.$name);
1170
+                    $this->error('Unable to create output file: ' . $name);
1171 1171
                 }
1172 1172
                 fwrite($f, $this->buffer, strlen($this->buffer));
1173 1173
                 fclose($f);
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
                 //Return as a string
1177 1177
                 return $this->buffer;
1178 1178
             default:
1179
-                $this->error('Incorrect output destination: '.$dest);
1179
+                $this->error('Incorrect output destination: ' . $dest);
1180 1180
         }
1181 1181
         return '';
1182 1182
     }
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
     protected function dochecks()
1186 1186
     {
1187 1187
         //Check availability of %F
1188
-        if (sprintf('%.1F', 1.0)!='1.0') {
1188
+        if (sprintf('%.1F', 1.0) != '1.0') {
1189 1189
             $this->error('This version of PHP is not supported');
1190 1190
         }
1191 1191
         //Check mbstring overloading
@@ -1197,19 +1197,19 @@  discard block
 block discarded – undo
1197 1197
     
1198 1198
     protected function getpageformat($format)
1199 1199
     {
1200
-        $format=strtolower($format);
1200
+        $format = strtolower($format);
1201 1201
         if (!isset($this->pageFormats[$format])) {
1202
-            $this->error('Unknown page format: '.$format);
1202
+            $this->error('Unknown page format: ' . $format);
1203 1203
         }
1204
-        $a=$this->pageFormats[$format];
1205
-        return [$a[0]/$this->k, $a[1]/$this->k];
1204
+        $a = $this->pageFormats[$format];
1205
+        return [$a[0] / $this->k, $a[1] / $this->k];
1206 1206
     }
1207 1207
     
1208 1208
     
1209 1209
     protected function getFontPath()
1210 1210
     {
1211
-        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) {
1212
-            define('FPDF_FONTPATH', dirname(__FILE__).'/font/');
1211
+        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font')) {
1212
+            define('FPDF_FONTPATH', dirname(__FILE__) . '/font/');
1213 1213
         }
1214 1214
         return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
1215 1215
     }
@@ -1233,12 +1233,12 @@  discard block
 block discarded – undo
1233 1233
             $format = $this->defPageFormat;
1234 1234
         } else {
1235 1235
             if (is_string($format)) {
1236
-                $format=$this->getpageformat($format);
1236
+                $format = $this->getpageformat($format);
1237 1237
             }
1238 1238
         }
1239 1239
         if ($orientation != $this->curOrientation
1240
-            || $format[0]!=$this->curPageFormat[0]
1241
-            || $format[1]!=$this->curPageFormat[1]
1240
+            || $format[0] != $this->curPageFormat[0]
1241
+            || $format[1] != $this->curPageFormat[1]
1242 1242
         ) {
1243 1243
             //New size
1244 1244
             if ($orientation == 'P') {
@@ -1248,9 +1248,9 @@  discard block
 block discarded – undo
1248 1248
                 $this->w = $format[1];
1249 1249
                 $this->h = $format[0];
1250 1250
             }
1251
-            $this->wPt = $this->w*$this->k;
1252
-            $this->hPt = $this->h*$this->k;
1253
-            $this->pageBreakTrigger = $this->h-$this->bMargin;
1251
+            $this->wPt = $this->w * $this->k;
1252
+            $this->hPt = $this->h * $this->k;
1253
+            $this->pageBreakTrigger = $this->h - $this->bMargin;
1254 1254
             $this->curOrientation = $orientation;
1255 1255
             $this->curPageFormat = $format;
1256 1256
         }
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
     protected function textString($s)
1284 1284
     {
1285 1285
         //Format a text string
1286
-        return '('.$this->escape($s).')';
1286
+        return '(' . $this->escape($s) . ')';
1287 1287
     }
1288 1288
     
1289 1289
     
@@ -1299,16 +1299,16 @@  discard block
 block discarded – undo
1299 1299
                 //3-byte character
1300 1300
                 $c2 = ord($s[$i++]);
1301 1301
                 $c3 = ord($s[$i++]);
1302
-                $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
1303
-                $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
1302
+                $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2));
1303
+                $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F));
1304 1304
             } elseif ($c1 >= 192) {
1305 1305
                 //2-byte character
1306 1306
                 $c2 = ord($s[$i++]);
1307
-                $res .= chr(($c1 & 0x1C)>>2);
1308
-                $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
1307
+                $res .= chr(($c1 & 0x1C) >> 2);
1308
+                $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F));
1309 1309
             } else {
1310 1310
                 //Single-byte character
1311
-                $res .= "\0".chr($c1);
1311
+                $res .= "\0" . chr($c1);
1312 1312
             }
1313 1313
         }
1314 1314
         return $res;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
         //Underline text
1321 1321
         $up = $this->currentFont['up'];
1322 1322
         $ut = $this->currentFont['ut'];
1323
-        $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' ');
1323
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1324 1324
         return sprintf(
1325 1325
             '%.2F %.2F %.2F %.2F re f',
1326
-            $x*$this->k,
1327
-            ($this->h-($y-$up/1000*$this->fontSize))*$this->k,
1328
-            $w*$this->k,
1329
-            -$ut/1000*$this->fontSizePt
1326
+            $x * $this->k,
1327
+            ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k,
1328
+            $w * $this->k,
1329
+            -$ut / 1000 * $this->fontSizePt
1330 1330
         );
1331 1331
     }
1332 1332
     
@@ -1336,17 +1336,17 @@  discard block
 block discarded – undo
1336 1336
         //Extract info from a JPEG file
1337 1337
         $a = getImageSize($file);
1338 1338
         if (!$a) {
1339
-            $this->error('Missing or incorrect image file: '.$file);
1339
+            $this->error('Missing or incorrect image file: ' . $file);
1340 1340
         }
1341
-        if ($a[2]!=2) {
1342
-            $this->error('Not a JPEG file: '.$file);
1341
+        if ($a[2] != 2) {
1342
+            $this->error('Not a JPEG file: ' . $file);
1343 1343
         }
1344 1344
         if (!isset($a['channels']) || $a['channels'] == 3) {
1345 1345
             $colspace = 'DeviceRGB';
1346 1346
         } elseif ($a['channels'] == 4) {
1347 1347
             $colspace = 'DeviceCMYK';
1348 1348
         } else {
1349
-            $colspace='DeviceGray';
1349
+            $colspace = 'DeviceGray';
1350 1350
         }
1351 1351
         $bpc = isset($a['bits']) ? $a['bits'] : 8;
1352 1352
         //Read whole file
@@ -1365,22 +1365,22 @@  discard block
 block discarded – undo
1365 1365
         //Extract info from a PNG file
1366 1366
         $f = fopen($file, 'rb');
1367 1367
         if (!$f) {
1368
-            $this->error('Can\'t open image file: '.$file);
1368
+            $this->error('Can\'t open image file: ' . $file);
1369 1369
         }
1370 1370
         //Check signature
1371
-        if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
1372
-            $this->error('Not a PNG file: '.$file);
1371
+        if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
1372
+            $this->error('Not a PNG file: ' . $file);
1373 1373
         }
1374 1374
         //Read header chunk
1375 1375
         $this->readstream($f, 4);
1376
-        if ($this->readstream($f, 4)!='IHDR') {
1377
-            $this->error('Incorrect PNG file: '.$file);
1376
+        if ($this->readstream($f, 4) != 'IHDR') {
1377
+            $this->error('Incorrect PNG file: ' . $file);
1378 1378
         }
1379 1379
         $w = $this->readint($f);
1380 1380
         $h = $this->readint($f);
1381 1381
         $bpc = ord($this->readstream($f, 1));
1382
-        if ($bpc>8) {
1383
-            $this->error('16-bit depth not supported: '.$file);
1382
+        if ($bpc > 8) {
1383
+            $this->error('16-bit depth not supported: ' . $file);
1384 1384
         }
1385 1385
         $ct = ord($this->readstream($f, 1));
1386 1386
         if ($ct == 0) {
@@ -1390,20 +1390,20 @@  discard block
 block discarded – undo
1390 1390
         } elseif ($ct == 3) {
1391 1391
             $colspace = 'Indexed';
1392 1392
         } else {
1393
-            $this->error('Alpha channel not supported: '.$file);
1393
+            $this->error('Alpha channel not supported: ' . $file);
1394 1394
         }
1395 1395
         if (ord($this->readstream($f, 1)) != 0) {
1396
-            $this->error('Unknown compression method: '.$file);
1396
+            $this->error('Unknown compression method: ' . $file);
1397 1397
         }
1398 1398
         if (ord($this->readstream($f, 1)) != 0) {
1399
-            $this->error('Unknown filter method: '.$file);
1399
+            $this->error('Unknown filter method: ' . $file);
1400 1400
         }
1401 1401
         if (ord($this->readstream($f, 1)) != 0) {
1402
-            $this->error('Interlacing not supported: '.$file);
1402
+            $this->error('Interlacing not supported: ' . $file);
1403 1403
         }
1404 1404
         $this->readstream($f, 4);
1405 1405
         $parms = '/DecodeParms <</Predictor 15 /Colors '
1406
-            . ($ct==2 ? 3 : 1)
1406
+            . ($ct == 2 ? 3 : 1)
1407 1407
             . ' /BitsPerComponent '
1408 1408
             . $bpc
1409 1409
             . ' /Columns '
@@ -1441,11 +1441,11 @@  discard block
 block discarded – undo
1441 1441
             } elseif ($type == 'IEND') {
1442 1442
                 break;
1443 1443
             } else {
1444
-                $this->readstream($f, $n+4);
1444
+                $this->readstream($f, $n + 4);
1445 1445
             }
1446 1446
         } while ($n);
1447 1447
         if ($colspace == 'Indexed' && empty($pal)) {
1448
-            $this->error('Missing palette in '.$file);
1448
+            $this->error('Missing palette in ' . $file);
1449 1449
         }
1450 1450
         fclose($f);
1451 1451
         return [
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
     protected function readstream($f, $n)
1466 1466
     {
1467 1467
         //Read n bytes from stream
1468
-        $res='';
1468
+        $res = '';
1469 1469
         while ($n > 0 && !feof($f)) {
1470
-            $s=fread($f, $n);
1470
+            $s = fread($f, $n);
1471 1471
             if ($s === false) {
1472 1472
                 $this->error('Error while reading stream');
1473 1473
             }
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         }
1501 1501
         $im = imagecreatefromgif($file);
1502 1502
         if (!$im) {
1503
-            $this->error('Missing or incorrect image file: '.$file);
1503
+            $this->error('Missing or incorrect image file: ' . $file);
1504 1504
         }
1505 1505
         imageinterlace($im, 0);
1506 1506
         $tmp = tempnam('.', 'gif');
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
             $this->error('Error while saving to temporary file');
1512 1512
         }
1513 1513
         imagedestroy($im);
1514
-        $info=$this->parsePNG($tmp);
1514
+        $info = $this->parsePNG($tmp);
1515 1515
         unlink($tmp);
1516 1516
         return $info;
1517 1517
     }
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
         //Begin a new object
1523 1523
         $this->n++;
1524 1524
         $this->offsets[$this->n] = strlen($this->buffer);
1525
-        $this->out($this->n.' 0 obj');
1525
+        $this->out($this->n . ' 0 obj');
1526 1526
     }
1527 1527
     
1528 1528
     
@@ -1538,9 +1538,9 @@  discard block
 block discarded – undo
1538 1538
     {
1539 1539
         //Add a line to the document
1540 1540
         if ($this->state == 2) {
1541
-            $this->pages[$this->page].=$s."\n";
1541
+            $this->pages[$this->page] .= $s . "\n";
1542 1542
         } else {
1543
-            $this->buffer .= $s."\n";
1543
+            $this->buffer .= $s . "\n";
1544 1544
         }
1545 1545
     }
1546 1546
     
@@ -1550,19 +1550,19 @@  discard block
 block discarded – undo
1550 1550
         $nb = $this->page;
1551 1551
         if (!empty($this->aliasNbPages)) {
1552 1552
             //Replace number of pages
1553
-            for ($n=1; $n<=$nb; $n++) {
1553
+            for ($n = 1; $n <= $nb; $n++) {
1554 1554
                 $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]);
1555 1555
             }
1556 1556
         }
1557 1557
         if ($this->defOrientation == 'P') {
1558
-            $wPt = $this->defPageFormat[0]*$this->k;
1559
-            $hPt = $this->defPageFormat[1]*$this->k;
1558
+            $wPt = $this->defPageFormat[0] * $this->k;
1559
+            $hPt = $this->defPageFormat[1] * $this->k;
1560 1560
         } else {
1561
-            $wPt = $this->defPageFormat[1]*$this->k;
1562
-            $hPt = $this->defPageFormat[0]*$this->k;
1561
+            $wPt = $this->defPageFormat[1] * $this->k;
1562
+            $hPt = $this->defPageFormat[0] * $this->k;
1563 1563
         }
1564 1564
         $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
1565
-        for ($n=1; $n<=$nb; $n++) {
1565
+        for ($n = 1; $n <= $nb; $n++) {
1566 1566
             //Page
1567 1567
             $this->newObj();
1568 1568
             $this->out('<</Type /Page');
@@ -1575,37 +1575,37 @@  discard block
 block discarded – undo
1575 1575
                 //Links
1576 1576
                 $annots = '/Annots [';
1577 1577
                 foreach ($this->PageLinks[$n] as $pl) {
1578
-                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]);
1579
-                    $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1578
+                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
1579
+                    $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
1580 1580
                     if (is_string($pl[4])) {
1581
-                        $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>';
1581
+                        $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>';
1582 1582
                     } else {
1583 1583
                         $l = $this->links[$pl[4]];
1584 1584
                         $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
1585
-                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k);
1585
+                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k);
1586 1586
                     }
1587 1587
                 }
1588
-                $this->out($annots.']');
1588
+                $this->out($annots . ']');
1589 1589
             }
1590
-            $this->out('/Contents '.($this->n+1).' 0 R>>');
1590
+            $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>');
1591 1591
             $this->out('endobj');
1592 1592
             //Page content
1593
-            $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1593
+            $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1594 1594
             $this->newObj();
1595
-            $this->out('<<'.$filter.'/Length '.strlen($p).'>>');
1595
+            $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>');
1596 1596
             $this->putStream($p);
1597 1597
             $this->out('endobj');
1598 1598
         }
1599 1599
         //Pages root
1600
-        $this->offsets[1]=strlen($this->buffer);
1600
+        $this->offsets[1] = strlen($this->buffer);
1601 1601
         $this->out('1 0 obj');
1602 1602
         $this->out('<</Type /Pages');
1603 1603
         $kids = '/Kids [';
1604
-        for ($i=0; $i<$nb; $i++) {
1605
-            $kids .= (3+2*$i).' 0 R ';
1604
+        for ($i = 0; $i < $nb; $i++) {
1605
+            $kids .= (3 + 2 * $i) . ' 0 R ';
1606 1606
         }
1607
-        $this->out($kids.']');
1608
-        $this->out('/Count '.$nb);
1607
+        $this->out($kids . ']');
1608
+        $this->out('/Count ' . $nb);
1609 1609
         $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt));
1610 1610
         $this->out('>>');
1611 1611
         $this->out('endobj');
@@ -1618,41 +1618,41 @@  discard block
 block discarded – undo
1618 1618
         foreach ($this->diffs as $diff) {
1619 1619
             //Encodings
1620 1620
             $this->newObj();
1621
-            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
1621
+            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
1622 1622
             $this->out('endobj');
1623 1623
         }
1624 1624
         foreach ($this->fontFiles as $file => $info) {
1625 1625
             //Font file embedding
1626 1626
             $this->newObj();
1627
-            $this->fontFiles[$file]['n']=$this->n;
1628
-            $font='';
1629
-            $f = fopen($this->getFontPath().$file, 'rb', 1);
1627
+            $this->fontFiles[$file]['n'] = $this->n;
1628
+            $font = '';
1629
+            $f = fopen($this->getFontPath() . $file, 'rb', 1);
1630 1630
             if (!$f) {
1631 1631
                 $this->error('Font file not found');
1632 1632
             }
1633 1633
             while (!feof($f)) {
1634
-                $font.=fread($f, 8192);
1634
+                $font .= fread($f, 8192);
1635 1635
             }
1636 1636
             fclose($f);
1637
-            $compressed = (substr($file, -2)=='.z');
1637
+            $compressed = (substr($file, -2) == '.z');
1638 1638
             if (!$compressed && isset($info['length2'])) {
1639
-                $header = (ord($font[0])==128);
1639
+                $header = (ord($font[0]) == 128);
1640 1640
                 if ($header) {
1641 1641
                     //Strip first binary header
1642 1642
                     $font = substr($font, 6);
1643 1643
                 }
1644 1644
                 if ($header && ord($font[$info['length1']]) == 128) {
1645 1645
                     //Strip second binary header
1646
-                    $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6);
1646
+                    $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
1647 1647
                 }
1648 1648
             }
1649
-            $this->out('<</Length '.strlen($font));
1649
+            $this->out('<</Length ' . strlen($font));
1650 1650
             if ($compressed) {
1651 1651
                 $this->out('/Filter /FlateDecode');
1652 1652
             }
1653
-            $this->out('/Length1 '.$info['length1']);
1653
+            $this->out('/Length1 ' . $info['length1']);
1654 1654
             if (isset($info['length2'])) {
1655
-                $this->out('/Length2 '.$info['length2'].' /Length3 0');
1655
+                $this->out('/Length2 ' . $info['length2'] . ' /Length3 0');
1656 1656
             }
1657 1657
             $this->out('>>');
1658 1658
             $this->putStream($font);
@@ -1660,32 +1660,32 @@  discard block
 block discarded – undo
1660 1660
         }
1661 1661
         foreach ($this->fonts as $k => $font) {
1662 1662
             //Font objects
1663
-            $this->fonts[$k]['n']=$this->n+1;
1663
+            $this->fonts[$k]['n'] = $this->n + 1;
1664 1664
             $type = $font['type'];
1665 1665
             $name = $font['name'];
1666 1666
             if ($type == 'core') {
1667 1667
                 //Standard font
1668 1668
                 $this->newObj();
1669 1669
                 $this->out('<</Type /Font');
1670
-                $this->out('/BaseFont /'.$name);
1670
+                $this->out('/BaseFont /' . $name);
1671 1671
                 $this->out('/Subtype /Type1');
1672 1672
                 if ($name != 'Symbol' && $name != 'ZapfDingbats') {
1673 1673
                     $this->out('/Encoding /WinAnsiEncoding');
1674 1674
                 }
1675 1675
                 $this->out('>>');
1676 1676
                 $this->out('endobj');
1677
-            } elseif ($type=='Type1' || $type=='TrueType') {
1677
+            } elseif ($type == 'Type1' || $type == 'TrueType') {
1678 1678
                 //Additional Type1 or TrueType font
1679 1679
                 $this->newObj();
1680 1680
                 $this->out('<</Type /Font');
1681
-                $this->out('/BaseFont /'.$name);
1682
-                $this->out('/Subtype /'.$type);
1681
+                $this->out('/BaseFont /' . $name);
1682
+                $this->out('/Subtype /' . $type);
1683 1683
                 $this->out('/FirstChar 32 /LastChar 255');
1684
-                $this->out('/Widths '.($this->n+1).' 0 R');
1685
-                $this->out('/FontDescriptor '.($this->n+2).' 0 R');
1684
+                $this->out('/Widths ' . ($this->n + 1) . ' 0 R');
1685
+                $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
1686 1686
                 if ($font['enc']) {
1687 1687
                     if (isset($font['diff'])) {
1688
-                        $this->out('/Encoding '.($nf+$font['diff']).' 0 R');
1688
+                        $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
1689 1689
                     } else {
1690 1690
                         $this->out('/Encoding /WinAnsiEncoding');
1691 1691
                     }
@@ -1694,30 +1694,30 @@  discard block
 block discarded – undo
1694 1694
                 $this->out('endobj');
1695 1695
                 //Widths
1696 1696
                 $this->newObj();
1697
-                $cw =& $font['cw'];
1697
+                $cw = & $font['cw'];
1698 1698
                 $s = '[';
1699
-                for ($i=32; $i<=255; $i++) {
1700
-                    $s .= $cw[chr($i)].' ';
1699
+                for ($i = 32; $i <= 255; $i++) {
1700
+                    $s .= $cw[chr($i)] . ' ';
1701 1701
                 }
1702
-                $this->out($s.']');
1702
+                $this->out($s . ']');
1703 1703
                 $this->out('endobj');
1704 1704
                 //Descriptor
1705 1705
                 $this->newObj();
1706
-                $s='<</Type /FontDescriptor /FontName /'.$name;
1706
+                $s = '<</Type /FontDescriptor /FontName /' . $name;
1707 1707
                 foreach ($font['desc'] as $k => $v) {
1708
-                    $s .= ' /'.$k.' '.$v;
1708
+                    $s .= ' /' . $k . ' ' . $v;
1709 1709
                 }
1710
-                $file=$font['file'];
1710
+                $file = $font['file'];
1711 1711
                 if ($file) {
1712
-                    $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R';
1712
+                    $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R';
1713 1713
                 }
1714
-                $this->out($s.'>>');
1714
+                $this->out($s . '>>');
1715 1715
                 $this->out('endobj');
1716 1716
             } else {
1717 1717
                 //Allow for additional types
1718
-                $mtd='_put'.strtolower($type);
1718
+                $mtd = '_put' . strtolower($type);
1719 1719
                 if (!method_exists($this, $mtd)) {
1720
-                    $this->error('Unsupported font type: '.$type);
1720
+                    $this->error('Unsupported font type: ' . $type);
1721 1721
                 }
1722 1722
                 $this->$mtd($font);
1723 1723
             }
@@ -1735,39 +1735,39 @@  discard block
 block discarded – undo
1735 1735
             $this->images[$file]['n'] = $this->n;
1736 1736
             $this->out('<</Type /XObject');
1737 1737
             $this->out('/Subtype /Image');
1738
-            $this->out('/Width '.$info['w']);
1739
-            $this->out('/Height '.$info['h']);
1740
-            if ($info['cs']=='Indexed') {
1741
-                $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
1738
+            $this->out('/Width ' . $info['w']);
1739
+            $this->out('/Height ' . $info['h']);
1740
+            if ($info['cs'] == 'Indexed') {
1741
+                $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
1742 1742
             } else {
1743
-                $this->out('/ColorSpace /'.$info['cs']);
1744
-                if ($info['cs']=='DeviceCMYK') {
1743
+                $this->out('/ColorSpace /' . $info['cs']);
1744
+                if ($info['cs'] == 'DeviceCMYK') {
1745 1745
                     $this->out('/Decode [1 0 1 0 1 0 1 0]');
1746 1746
                 }
1747 1747
             }
1748
-            $this->out('/BitsPerComponent '.$info['bpc']);
1748
+            $this->out('/BitsPerComponent ' . $info['bpc']);
1749 1749
             if (isset($info['f'])) {
1750
-                $this->out('/Filter /'.$info['f']);
1750
+                $this->out('/Filter /' . $info['f']);
1751 1751
             }
1752 1752
             if (isset($info['parms'])) {
1753 1753
                 $this->out($info['parms']);
1754 1754
             }
1755 1755
             if (isset($info['trns']) && is_array($info['trns'])) {
1756 1756
                 $trns = '';
1757
-                for ($i=0; $i<count($info['trns']); $i++) {
1758
-                    $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
1757
+                for ($i = 0; $i < count($info['trns']); $i++) {
1758
+                    $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
1759 1759
                 }
1760
-                $this->out('/Mask ['.$trns.']');
1760
+                $this->out('/Mask [' . $trns . ']');
1761 1761
             }
1762
-            $this->out('/Length '.strlen($info['data']).'>>');
1762
+            $this->out('/Length ' . strlen($info['data']) . '>>');
1763 1763
             $this->putStream($info['data']);
1764 1764
             unset($this->images[$file]['data']);
1765 1765
             $this->out('endobj');
1766 1766
             //Palette
1767 1767
             if ($info['cs'] == 'Indexed') {
1768 1768
                 $this->newObj();
1769
-                $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1770
-                $this->out('<<'.$filter.'/Length '.strlen($pal).'>>');
1769
+                $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1770
+                $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>');
1771 1771
                 $this->putStream($pal);
1772 1772
                 $this->out('endobj');
1773 1773
             }
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
     protected function putXobjectDict()
1778 1778
     {
1779 1779
         foreach ($this->images as $image) {
1780
-            $this->out('/I'.$image['i'].' '.$image['n'].' 0 R');
1780
+            $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
1781 1781
         }
1782 1782
     }
1783 1783
     
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
         $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1787 1787
         $this->out('/Font <<');
1788 1788
         foreach ($this->fonts as $font) {
1789
-            $this->out('/F'.$font['i'].' '.$font['n'].' 0 R');
1789
+            $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
1790 1790
         }
1791 1791
         $this->out('>>');
1792 1792
         $this->out('/XObject <<');
@@ -1809,57 +1809,57 @@  discard block
 block discarded – undo
1809 1809
     
1810 1810
     protected function putInfo()
1811 1811
     {
1812
-        $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION));
1812
+        $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION));
1813 1813
         if (!empty($this->title)) {
1814
-            $this->out('/Title '.$this->textString($this->title));
1814
+            $this->out('/Title ' . $this->textString($this->title));
1815 1815
         }
1816 1816
         if (!empty($this->subject)) {
1817
-            $this->out('/Subject '.$this->textString($this->subject));
1817
+            $this->out('/Subject ' . $this->textString($this->subject));
1818 1818
         }
1819 1819
         if (!empty($this->author)) {
1820
-            $this->out('/Author '.$this->textString($this->author));
1820
+            $this->out('/Author ' . $this->textString($this->author));
1821 1821
         }
1822 1822
         if (!empty($this->keywords)) {
1823
-            $this->out('/Keywords '.$this->textString($this->keywords));
1823
+            $this->out('/Keywords ' . $this->textString($this->keywords));
1824 1824
         }
1825 1825
         if (!empty($this->creator)) {
1826
-            $this->out('/Creator '.$this->textString($this->creator));
1826
+            $this->out('/Creator ' . $this->textString($this->creator));
1827 1827
         }
1828
-        $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis')));
1828
+        $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis')));
1829 1829
     }
1830 1830
     
1831 1831
     protected function putCatalog()
1832 1832
     {
1833 1833
         $this->out('/Type /Catalog');
1834 1834
         $this->out('/Pages 1 0 R');
1835
-        if ($this->zoomMode=='fullpage') {
1835
+        if ($this->zoomMode == 'fullpage') {
1836 1836
             $this->out('/OpenAction [3 0 R /Fit]');
1837
-        } elseif ($this->zoomMode=='fullwidth') {
1837
+        } elseif ($this->zoomMode == 'fullwidth') {
1838 1838
             $this->out('/OpenAction [3 0 R /FitH null]');
1839
-        } elseif ($this->zoomMode=='real') {
1839
+        } elseif ($this->zoomMode == 'real') {
1840 1840
             $this->out('/OpenAction [3 0 R /XYZ null null 1]');
1841 1841
         } elseif (!is_string($this->zoomMode)) {
1842
-            $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']');
1842
+            $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']');
1843 1843
         }
1844
-        if ($this->layoutMode=='single') {
1844
+        if ($this->layoutMode == 'single') {
1845 1845
             $this->out('/PageLayout /SinglePage');
1846
-        } elseif ($this->layoutMode=='continuous') {
1846
+        } elseif ($this->layoutMode == 'continuous') {
1847 1847
             $this->out('/PageLayout /OneColumn');
1848
-        } elseif ($this->layoutMode=='two') {
1848
+        } elseif ($this->layoutMode == 'two') {
1849 1849
             $this->out('/PageLayout /TwoColumnLeft');
1850 1850
         }
1851 1851
     }
1852 1852
     
1853 1853
     protected function putHeader()
1854 1854
     {
1855
-        $this->out('%PDF-'.$this->pdfVersion);
1855
+        $this->out('%PDF-' . $this->pdfVersion);
1856 1856
     }
1857 1857
     
1858 1858
     protected function putTrailer()
1859 1859
     {
1860
-        $this->out('/Size '.($this->n+1));
1861
-        $this->out('/Root '.$this->n.' 0 R');
1862
-        $this->out('/Info '.($this->n-1).' 0 R');
1860
+        $this->out('/Size ' . ($this->n + 1));
1861
+        $this->out('/Root ' . $this->n . ' 0 R');
1862
+        $this->out('/Info ' . ($this->n - 1) . ' 0 R');
1863 1863
     }
1864 1864
     
1865 1865
     protected function endDoc()
@@ -1880,11 +1880,11 @@  discard block
 block discarded – undo
1880 1880
         $this->out('>>');
1881 1881
         $this->out('endobj');
1882 1882
         //Cross-ref
1883
-        $o=strlen($this->buffer);
1883
+        $o = strlen($this->buffer);
1884 1884
         $this->out('xref');
1885
-        $this->out('0 '.($this->n+1));
1885
+        $this->out('0 ' . ($this->n + 1));
1886 1886
         $this->out('0000000000 65535 f ');
1887
-        for ($i=1; $i<=$this->n; $i++) {
1887
+        for ($i = 1; $i <= $this->n; $i++) {
1888 1888
             $this->out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1889 1889
         }
1890 1890
         //Trailer
@@ -1895,6 +1895,6 @@  discard block
 block discarded – undo
1895 1895
         $this->out('startxref');
1896 1896
         $this->out($o);
1897 1897
         $this->out('%%EOF');
1898
-        $this->state=3;
1898
+        $this->state = 3;
1899 1899
     }
1900 1900
 }
Please login to merge, or discard this patch.
src/Legacy/FPDF/Fpdf181.php 3 patches
Doc Comments   +46 added lines patch added patch discarded remove patch
@@ -169,6 +169,10 @@  discard block
 block discarded – undo
169 169
         $this->pdfVersion = '1.3';
170 170
     }
171 171
     
172
+    /**
173
+     * @param double $left
174
+     * @param double $top
175
+     */
172 176
     public function setMargins($left, $top, $right = null)
173 177
     {
174 178
         // Set left, top and right margins
@@ -200,6 +204,9 @@  discard block
 block discarded – undo
200 204
         $this->rMargin = $margin;
201 205
     }
202 206
     
207
+    /**
208
+     * @param boolean $auto
209
+     */
203 210
     public function setautoPageBreak($auto, $margin = 0)
204 211
     {
205 212
         // Set auto page break mode and triggering margin
@@ -207,6 +214,10 @@  discard block
 block discarded – undo
207 214
         $this->bMargin = $margin;
208 215
         $this->pageBreakTrigger = $this->h - $margin;
209 216
     }
217
+
218
+    /**
219
+     * @param string $zoom
220
+     */
210 221
     public function setDisplayMode($zoom, $layout = 'default')
211 222
     {
212 223
         // Set display mode in viewer
@@ -222,6 +233,9 @@  discard block
 block discarded – undo
222 233
         }    
223 234
     }
224 235
     
236
+    /**
237
+     * @param boolean $compress
238
+     */
225 239
     public function setCompression($compress)
226 240
     {
227 241
         // Set page compression
@@ -450,6 +464,9 @@  discard block
 block discarded – undo
450 464
         $this->out(sprintf('%.2F %.2F %.2F %.2F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op));
451 465
     }
452 466
     
467
+    /**
468
+     * @param string $family
469
+     */
453 470
     public function addFont($family, $style = '', $file = '')
454 471
     {
455 472
         // Add a TrueType, OpenType or Type1 font
@@ -478,6 +495,9 @@  discard block
 block discarded – undo
478 495
         $this->fonts[$fontkey] = $info;
479 496
     }
480 497
     
498
+    /**
499
+     * @param string $family
500
+     */
481 501
     public function setFont($family, $style = '', $size = 0)
482 502
     {
483 503
         // Select a font; size given in points
@@ -566,6 +586,10 @@  discard block
 block discarded – undo
566 586
         $this->links[$link] = [$page, $y];
567 587
     }
568 588
     
589
+    /**
590
+     * @param double $y
591
+     * @param string $link
592
+     */
569 593
     public function link($x, $y, $w, $h, $link)
570 594
     {
571 595
         // Put a link on the page
@@ -1100,6 +1124,11 @@  discard block
 block discarded – undo
1100 1124
         }
1101 1125
     }
1102 1126
     
1127
+    /**
1128
+     * @param string $orientation
1129
+     * @param string $size
1130
+     * @param integer $rotation
1131
+     */
1103 1132
     protected function beginPage($orientation, $size, $rotation)
1104 1133
     {
1105 1134
         $this->page++;
@@ -1151,6 +1180,9 @@  discard block
 block discarded – undo
1151 1180
         $this->state = 1;
1152 1181
     }
1153 1182
     
1183
+    /**
1184
+     * @param string $font
1185
+     */
1154 1186
     protected function loadFont($font)
1155 1187
     {
1156 1188
         // Load a font definition file from the font directory
@@ -1182,6 +1214,11 @@  discard block
 block discarded – undo
1182 1214
         return true;
1183 1215
     }
1184 1216
     
1217
+    /**
1218
+     * @param string $param
1219
+     * @param string $value
1220
+     * @param boolean $isUTF8
1221
+     */
1185 1222
     protected function httpencode($param, $value, $isUTF8)
1186 1223
     {
1187 1224
         // Encode HTTP header field parameter
@@ -1461,6 +1498,9 @@  discard block
 block discarded – undo
1461 1498
         return $info;
1462 1499
     }
1463 1500
     
1501
+    /**
1502
+     * @param string $s
1503
+     */
1464 1504
     protected function out($s)
1465 1505
     {
1466 1506
         // Add a line to the document
@@ -1485,6 +1525,9 @@  discard block
 block discarded – undo
1485 1525
         return strlen($this->buffer);
1486 1526
     }
1487 1527
     
1528
+    /**
1529
+     * @param integer $n
1530
+     */
1488 1531
     protected function newObj($n = null)
1489 1532
     {
1490 1533
         // Begin a new object
@@ -1517,6 +1560,9 @@  discard block
 block discarded – undo
1517 1560
         $this->put('endobj');
1518 1561
     }
1519 1562
     
1563
+    /**
1564
+     * @param integer $n
1565
+     */
1520 1566
     protected function putpage($n)
1521 1567
     {
1522 1568
         $this->newObj();
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,61 +6,61 @@  discard block
 block discarded – undo
6 6
     const FPDF_VERSION = '1.81';
7 7
     const FPDF_FONTPATH = 'font/';
8 8
     
9
-    protected $page;               // current page number
10
-    protected $n;                  // current object number
11
-    protected $offsets;            // array of object offsets
12
-    protected $buffer;             // buffer holding in-memory PDF
13
-    protected $pages;              // array containing pages
14
-    protected $state;              // current document state
15
-    protected $compress;           // compression flag
16
-    protected $k;                  // scale factor (number of points in user unit)
17
-    protected $defOrientation;     // default orientation
18
-    protected $curOrientation;     // current orientation
19
-    protected $stdPageSizes;       // standard page sizes
20
-    protected $defPageSize;        // default page size
21
-    protected $curPageSize;        // current page size
22
-    protected $curRotation;        // current page rotation
23
-    protected $pageInfo;           // page-related data
24
-    protected $wPt, $hPt;          // dimensions of current page in points
25
-    protected $w, $h;              // dimensions of current page in user unit
26
-    protected $lMargin;            // left margin
27
-    protected $tMargin;            // top margin
28
-    protected $rMargin;            // right margin
29
-    protected $bMargin;            // page break margin
30
-    protected $cMargin;            // cell margin
31
-    protected $x, $y;              // current position in user unit
32
-    protected $lasth;              // height of last printed cell
33
-    protected $lineWidth;          // line width in user unit
34
-    protected $fontpath;           // path containing fonts
35
-    protected $coreFonts;          // array of core font names
36
-    protected $fonts;              // array of used fonts
37
-    protected $fontFiles;          // array of font files
38
-    protected $encodings;          // array of encodings
39
-    protected $cmaps;              // array of ToUnicode CMaps
40
-    protected $fontFamily;         // current font family
41
-    protected $fontStyle;          // current font style
42
-    protected $underline;          // underlining flag
43
-    protected $currentFont;        // current font info
44
-    protected $fontSizePt;         // current font size in points
45
-    protected $fontSize;           // current font size in user unit
46
-    protected $drawColor;          // commands for drawing color
47
-    protected $fillColor;          // commands for filling color
48
-    protected $textColor;          // commands for text color
49
-    protected $colorFlag;          // indicates whether fill and text colors are different
50
-    protected $withAlpha;          // indicates whether alpha channel is used
51
-    protected $ws;                 // word spacing
52
-    protected $images;             // array of used images
53
-    protected $pageLinks;          // array of links in pages
54
-    protected $links;              // array of internal links
55
-    protected $autoPageBreak;      // automatic page breaking
56
-    protected $pageBreakTrigger;   // threshold used to trigger page breaks
57
-    protected $inHeader;           // flag set when processing header
58
-    protected $infooter;           // flag set when processing footer
59
-    protected $aliasNbPages;       // alias for total number of pages
60
-    protected $zoomMode;           // zoom display mode
61
-    protected $layoutMode;         // layout display mode
62
-    protected $metadata;           // document properties
63
-    protected $pdfVersion;         // PDF version number
9
+    protected $page; // current page number
10
+    protected $n; // current object number
11
+    protected $offsets; // array of object offsets
12
+    protected $buffer; // buffer holding in-memory PDF
13
+    protected $pages; // array containing pages
14
+    protected $state; // current document state
15
+    protected $compress; // compression flag
16
+    protected $k; // scale factor (number of points in user unit)
17
+    protected $defOrientation; // default orientation
18
+    protected $curOrientation; // current orientation
19
+    protected $stdPageSizes; // standard page sizes
20
+    protected $defPageSize; // default page size
21
+    protected $curPageSize; // current page size
22
+    protected $curRotation; // current page rotation
23
+    protected $pageInfo; // page-related data
24
+    protected $wPt, $hPt; // dimensions of current page in points
25
+    protected $w, $h; // dimensions of current page in user unit
26
+    protected $lMargin; // left margin
27
+    protected $tMargin; // top margin
28
+    protected $rMargin; // right margin
29
+    protected $bMargin; // page break margin
30
+    protected $cMargin; // cell margin
31
+    protected $x, $y; // current position in user unit
32
+    protected $lasth; // height of last printed cell
33
+    protected $lineWidth; // line width in user unit
34
+    protected $fontpath; // path containing fonts
35
+    protected $coreFonts; // array of core font names
36
+    protected $fonts; // array of used fonts
37
+    protected $fontFiles; // array of font files
38
+    protected $encodings; // array of encodings
39
+    protected $cmaps; // array of ToUnicode CMaps
40
+    protected $fontFamily; // current font family
41
+    protected $fontStyle; // current font style
42
+    protected $underline; // underlining flag
43
+    protected $currentFont; // current font info
44
+    protected $fontSizePt; // current font size in points
45
+    protected $fontSize; // current font size in user unit
46
+    protected $drawColor; // commands for drawing color
47
+    protected $fillColor; // commands for filling color
48
+    protected $textColor; // commands for text color
49
+    protected $colorFlag; // indicates whether fill and text colors are different
50
+    protected $withAlpha; // indicates whether alpha channel is used
51
+    protected $ws; // word spacing
52
+    protected $images; // array of used images
53
+    protected $pageLinks; // array of links in pages
54
+    protected $links; // array of internal links
55
+    protected $autoPageBreak; // automatic page breaking
56
+    protected $pageBreakTrigger; // threshold used to trigger page breaks
57
+    protected $inHeader; // flag set when processing header
58
+    protected $infooter; // flag set when processing footer
59
+    protected $aliasNbPages; // alias for total number of pages
60
+    protected $zoomMode; // zoom display mode
61
+    protected $layoutMode; // layout display mode
62
+    protected $metadata; // document properties
63
+    protected $pdfVersion; // PDF version number
64 64
     
65 65
     public function __construct($orientation = 'P', $unit = 'mm', $size = 'A4')
66 66
     {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $this->withAlpha = false;
94 94
         $this->ws = 0;
95 95
         
96
-        $this->fontpath = __DIR__. FPDF_FONTPATH;
96
+        $this->fontpath = __DIR__ . FPDF_FONTPATH;
97 97
         
98 98
         // Core fonts
99 99
         $this->coreFonts = [
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'zapfdingbats'
105 105
         ];
106 106
         
107
-        switch($unit) {
107
+        switch ($unit) {
108 108
             case 'pt';
109 109
                 $this->k = 1;
110 110
                 break;
Please login to merge, or discard this patch.
Braces   +46 added lines, -32 removed lines patch added patch discarded remove patch
@@ -184,8 +184,9 @@  discard block
 block discarded – undo
184 184
     {
185 185
         // Set left margin
186 186
         $this->lMargin = $margin;
187
-        if ($this->page > 0 && $this->x < $margin)
188
-            $this->x = $margin;
187
+        if ($this->page > 0 && $this->x < $margin) {
188
+                    $this->x = $margin;
189
+        }
189 190
     }
190 191
     
191 192
     public function setTopMargin($margin)
@@ -277,10 +278,12 @@  discard block
 block discarded – undo
277 278
     public function close()
278 279
     {
279 280
         // Terminate document
280
-        if ($this->state == 3)
281
-            return;
282
-        if ($this->page == 0)
283
-            $this->addPage();
281
+        if ($this->state == 3) {
282
+                    return;
283
+        }
284
+        if ($this->page == 0) {
285
+                    $this->addPage();
286
+        }
284 287
         // Page footer
285 288
         $this->infooter = true;
286 289
         $this->footer();
@@ -321,15 +324,18 @@  discard block
 block discarded – undo
321 324
         $this->lineWidth = $lw;
322 325
         $this->out(sprintf('%.2F w', $lw * $this->k));
323 326
         // Set font
324
-        if ($family)
325
-            $this->setFont($family, $style, $fontsize);
327
+        if ($family) {
328
+                    $this->setFont($family, $style, $fontsize);
329
+        }
326 330
         // Set colors
327 331
         $this->drawColor = $dc;
328
-        if ($dc != '0 G')
329
-            $this->out($dc);
332
+        if ($dc != '0 G') {
333
+                    $this->out($dc);
334
+        }
330 335
         $this->fillColor = $fc;
331
-        if ($fc != '0 g')
332
-            $this->out($fc);
336
+        if ($fc != '0 g') {
337
+                    $this->out($fc);
338
+        }
333 339
         $this->textColor = $tc;
334 340
         $this->colorFlag = $cf;
335 341
         // Page header
@@ -389,13 +395,15 @@  discard block
 block discarded – undo
389 395
     public function setfillColor($r, $g = null, $b = null)
390 396
     {
391 397
         // Set color for all filling operations
392
-        if (($r == 0 && $g == 0 && $b == 0) || $g === null)
393
-            $this->fillColor = sprintf('%.3F g', $r / 255);
394
-        else
395
-            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
398
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
399
+                    $this->fillColor = sprintf('%.3F g', $r / 255);
400
+        } else {
401
+                    $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
402
+        }
396 403
         $this->colorFlag = ($this->fillColor != $this->textColor);
397
-        if ($this->page > 0)
398
-            $this->out($this->fillColor);
404
+        if ($this->page > 0) {
405
+                    $this->out($this->fillColor);
406
+        }
399 407
     }
400 408
     
401 409
     public function settextColor($r, $g = null, $b = null)
@@ -989,12 +997,14 @@  discard block
 block discarded – undo
989 997
     public function setY($y, $resetX = true)
990 998
     {
991 999
         // Set y position and optionally reset x
992
-        if ($y >= 0)
993
-            $this->y = $y;
994
-        else
995
-            $this->y = $this->h + $y;
996
-        if ($resetX)
997
-            $this->x = $this->lMargin;
1000
+        if ($y >= 0) {
1001
+                    $this->y = $y;
1002
+        } else {
1003
+                    $this->y = $this->h + $y;
1004
+        }
1005
+        if ($resetX) {
1006
+                    $this->x = $this->lMargin;
1007
+        }
998 1008
     }
999 1009
     
1000 1010
     public function setXY($x, $y)
@@ -1044,8 +1054,9 @@  discard block
 block discarded – undo
1044 1054
                 break;
1045 1055
             case 'F':
1046 1056
                 // Save to local file
1047
-                if (!fileput_contents($name, $this->buffer))
1048
-                    $this->error('Unable to create output file: ' . $name);
1057
+                if (!fileput_contents($name, $this->buffer)) {
1058
+                                    $this->error('Unable to create output file: ' . $name);
1059
+                }
1049 1060
                 break;
1050 1061
             case 'S':
1051 1062
                 // Return as a string
@@ -1068,8 +1079,9 @@  discard block
 block discarded – undo
1068 1079
     protected function checkOutput()
1069 1080
     {
1070 1081
         if (PHP_SAPI != 'cli') {
1071
-            if (headers_sent($file, $line))
1072
-                $this->error("Some data has already been output, can't send PDF file (output started at $file:$line)");
1082
+            if (headers_sent($file, $line)) {
1083
+                            $this->error("Some data has already been output, can't send PDF file (output started at $file:$line)");
1084
+            }
1073 1085
         }
1074 1086
         if (ob_get_length()) {
1075 1087
             // The output buffer is not empty
@@ -1574,8 +1586,9 @@  discard block
 block discarded – undo
1574 1586
         $this->newObj(1);
1575 1587
         $this->put('<</Type /Pages');
1576 1588
         $kids = '/Kids [';
1577
-        for ($n = 1; $n <= $nb; $n++)
1578
-            $kids .= $this->pageInfo[$n]['n'] . ' 0 R ';
1589
+        for ($n = 1; $n <= $nb; $n++) {
1590
+                    $kids .= $this->pageInfo[$n]['n'] . ' 0 R ';
1591
+        }
1579 1592
         $this->put($kids . ']');
1580 1593
         $this->put('/Count ' . $nb);
1581 1594
         if ($this->defOrientation == 'P') {
@@ -1776,8 +1789,9 @@  discard block
 block discarded – undo
1776 1789
             $this->put('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
1777 1790
         } else {
1778 1791
             $this->put('/ColorSpace /' . $info['cs']);
1779
-            if ($info['cs'] == 'DeviceCMYK')
1780
-                $this->put('/Decode [1 0 1 0 1 0 1 0]');
1792
+            if ($info['cs'] == 'DeviceCMYK') {
1793
+                            $this->put('/Decode [1 0 1 0 1 0 1 0]');
1794
+            }
1781 1795
         }
1782 1796
         $this->put('/BitsPerComponent ' . $info['bpc']);
1783 1797
         if (isset($info['f'])) {
Please login to merge, or discard this patch.
src/Legacy/Pdf.php 2 patches
Doc Comments   +41 added lines, -38 removed lines patch added patch discarded remove patch
@@ -162,6 +162,9 @@  discard block
 block discarded – undo
162 162
 
163 163
     /**
164 164
      * Imprime barcode 128
165
+     * @param double $x
166
+     * @param double $y
167
+     * @param integer $h
165 168
      */
166 169
     public function code128($x, $y, $code, $w, $h)
167 170
     {
@@ -235,9 +238,9 @@  discard block
 block discarded – undo
235 238
 
236 239
     /**
237 240
      * Rotaciona para impressão paisagem (landscape)
238
-     * @param   number $angle
239
-     * @param   number $x
240
-     * @param   number $y
241
+     * @param   integer $angle
242
+     * @param   integer $x
243
+     * @param   integer $y
241 244
      */
242 245
     public function rotate($angle, $x = -1, $y = -1)
243 246
     {
@@ -279,7 +282,7 @@  discard block
 block discarded – undo
279 282
      * @param   number $y
280 283
      * @param   number $w
281 284
      * @param   number $h
282
-     * @param   number $r
285
+     * @param   double $r
283 286
      * @param   string $corners
284 287
      * @param   string $style
285 288
      */
@@ -334,12 +337,12 @@  discard block
 block discarded – undo
334 337
     
335 338
     /**
336 339
      * Desenha o arco para arredondar o canto do retangulo
337
-     * @param   number $x1
338
-     * @param   number $y1
339
-     * @param   number $x2
340
-     * @param   number $y2
341
-     * @param   number $x3
342
-     * @param   number $y3
340
+     * @param   double $x1
341
+     * @param   double $y1
342
+     * @param   double $x2
343
+     * @param   double $y2
344
+     * @param   double $x3
345
+     * @param   double $y3
343 346
      */
344 347
     private function arc($x1, $y1, $x2, $y2, $x3, $y3)
345 348
     {
@@ -363,8 +366,8 @@  discard block
 block discarded – undo
363 366
      * @param   number $y1
364 367
      * @param   number $x2
365 368
      * @param   number $y2
366
-     * @param   number $width
367
-     * @param   number $nb
369
+     * @param   integer $width
370
+     * @param   integer $nb
368 371
      */
369 372
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
370 373
     {
@@ -431,11 +434,11 @@  discard block
 block discarded – undo
431 434
      * @param   number  $w
432 435
      * @param   number  $h
433 436
      * @param   string  $txt
434
-     * @param   string  $border
437
+     * @param   integer  $border
435 438
      * @param   string  $align
436 439
      * @param   boolean $fill
437
-     * @param   number  $maxline
438
-     * @param   number  $prn
440
+     * @param   integer  $maxline
441
+     * @param   integer  $prn
439 442
      * @return  int
440 443
      */
441 444
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
@@ -564,7 +567,7 @@  discard block
 block discarded – undo
564 567
     
565 568
     /**
566 569
      * Quebra o texto para caber na caixa
567
-     * @param   type $text
570
+     * @param   string $text
568 571
      * @param   type $maxwidth
569 572
      * @return  int
570 573
      */
@@ -615,10 +618,10 @@  discard block
 block discarded – undo
615 618
     /**
616 619
      * Celula com escala horizontal caso o texto seja muito largo
617 620
      * @param   number  $w
618
-     * @param   number  $h
621
+     * @param   integer  $h
619 622
      * @param   string  $txt
620
-     * @param   number  $border
621
-     * @param   number  $ln
623
+     * @param   integer  $border
624
+     * @param   integer  $ln
622 625
      * @param   string  $align
623 626
      * @param   boolean $fill
624 627
      * @param   string  $link
@@ -669,10 +672,10 @@  discard block
 block discarded – undo
669 672
     /**
670 673
      * Celula com escalamento horizontal somente se necessário
671 674
      * @param   number  $w
672
-     * @param   number  $h
675
+     * @param   integer  $h
673 676
      * @param   string  $txt
674
-     * @param   number  $border
675
-     * @param   number  $ln
677
+     * @param   integer  $border
678
+     * @param   integer  $ln
676 679
      * @param   string  $align
677 680
      * @param   boolean $fill
678 681
      * @param   string  $link
@@ -685,10 +688,10 @@  discard block
 block discarded – undo
685 688
     /**
686 689
      * Celula com escalamento forçado
687 690
      * @param   number  $w
688
-     * @param   number  $h
691
+     * @param   integer  $h
689 692
      * @param   string  $txt
690
-     * @param   number  $border
691
-     * @param   number  $ln
693
+     * @param   integer  $border
694
+     * @param   integer  $ln
692 695
      * @param   string  $align
693 696
      * @param   boolean $fill
694 697
      * @param   string  $link
@@ -709,10 +712,10 @@  discard block
 block discarded – undo
709 712
     /**
710 713
      * Celula com espaçamento de caracteres somente se necessário
711 714
      * @param   number  $w
712
-     * @param   number  $h
715
+     * @param   integer  $h
713 716
      * @param   string  $txt
714
-     * @param   number  $border
715
-     * @param   number  $ln
717
+     * @param   integer  $border
718
+     * @param   integer  $ln
716 719
      * @param   string  $align
717 720
      * @param   boolean $fill
718 721
      * @param   string  $link
@@ -725,10 +728,10 @@  discard block
 block discarded – undo
725 728
     /**
726 729
      * Celula com espaçamento de caracteres forçado
727 730
      * @param   number  $w
728
-     * @param   number  $h
731
+     * @param   integer  $h
729 732
      * @param   string  $txt
730
-     * @param   number  $border
731
-     * @param   number  $ln
733
+     * @param   integer  $border
734
+     * @param   integer  $ln
732 735
      * @param   string  $align
733 736
      * @param   boolean $fill
734 737
      * @param   string  $link
@@ -822,7 +825,7 @@  discard block
 block discarded – undo
822 825
      * pGetNumLines
823 826
      * Obtem o numero de linhas usadas pelo texto usando a fonte especifidada
824 827
      * @param  string $text
825
-     * @param  number $width
828
+     * @param  double $width
826 829
      * @param  array  $aFont
827 830
      * @return number numero de linhas
828 831
      */
@@ -850,14 +853,14 @@  discard block
 block discarded – undo
850 853
      * @param  array   $aFont   Matriz com as informações para formatação do texto com fonte, tamanho e estilo
851 854
      * @param  string  $vAlign  Alinhamento vertical do texto, T-topo C-centro B-base
852 855
      * @param  string  $hAlign  Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita
853
-     * @param  boolean $border  TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
856
+     * @param  integer $border  TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
854 857
      * @param  string  $link    Insere um hiperlink
855 858
      * @param  boolean $force   Se for true força a caixa com uma unica linha e para isso atera o tamanho do
856 859
      * fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
857 860
      * e para isso atera o tamanho do fonte até caber no espaço,
858 861
      * se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
859
-     * @param  number  $hmax
860
-     * @param  number  $vOffSet incremento forçado na na posição Y
862
+     * @param  integer  $hmax
863
+     * @param  integer  $vOffSet incremento forçado na na posição Y
861 864
      * @return number $height Qual a altura necessária para desenhar esta textBox
862 865
      */
863 866
     public function textBox(
@@ -985,14 +988,14 @@  discard block
 block discarded – undo
985 988
      * @param  array $aFont Matriz com as informações para formatação do texto com fonte, tamanho e estilo
986 989
      * @param  string $vAlign Alinhamento vertical do texto, T-topo C-centro B-base
987 990
      * @param  string $hAlign Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita
988
-     * @param  boolean $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
991
+     * @param  integer $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
989 992
      * @param  string $link Insere um hiperlink
990 993
      * @param  boolean $force Se for true força a caixa com uma unica linha e para isso atera o tamanho do
991 994
      *  fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
992 995
      *  linha e para isso atera o tamanho do fonte até caber no espaço,
993 996
      *  se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
994
-     * @param  number  $hmax
995
-     * @param  number  $vOffSet incremento forçado na na posição Y
997
+     * @param  integer  $hmax
998
+     * @param  integer  $vOffSet incremento forçado na na posição Y
996 999
      * @return number $height Qual a altura necessária para desenhar esta textBox
997 1000
      */
998 1001
     protected function textBox90(
Please login to merge, or discard this patch.
Spacing   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -6,129 +6,129 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Pdf extends Fpdf
8 8
 {
9
-    private $t128;                                             // tabela de codigos 128
10
-    private $abcSet="";                                        // conjunto de caracteres legiveis em 128
11
-    private $aSet="";                                          // grupo A do conjunto de de caracteres legiveis
12
-    private $bSet="";                                          // grupo B do conjunto de caracteres legiveis
13
-    private $cSet="";                                          // grupo C do conjunto de caracteres legiveis
14
-    private $setFrom;                                          // converter de
15
-    private $setTo;                                            // converter para
16
-    private $jStart = ["A"=>103, "B"=>104, "C"=>105];     // Caracteres de seleção do grupo 128
17
-    private $jSwap = ["A"=>101, "B"=>100, "C"=>99];       // Caracteres de troca de grupo
9
+    private $t128; // tabela de codigos 128
10
+    private $abcSet = ""; // conjunto de caracteres legiveis em 128
11
+    private $aSet = ""; // grupo A do conjunto de de caracteres legiveis
12
+    private $bSet = ""; // grupo B do conjunto de caracteres legiveis
13
+    private $cSet = ""; // grupo C do conjunto de caracteres legiveis
14
+    private $setFrom; // converter de
15
+    private $setTo; // converter para
16
+    private $jStart = ["A"=>103, "B"=>104, "C"=>105]; // Caracteres de seleção do grupo 128
17
+    private $jSwap = ["A"=>101, "B"=>100, "C"=>99]; // Caracteres de troca de grupo
18 18
 
19 19
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
20 20
     {
21 21
         //passar parametros para a classe principal
22 22
         parent::__construct($orientation, $unit, $format);
23 23
         // composição dos caracteres do barcode 128
24
-        $this->t128[] = array(2, 1, 2, 2, 2, 2);           //0 : [ ]
25
-        $this->t128[] = array(2, 2, 2, 1, 2, 2);           //1 : [!]
26
-        $this->t128[] = array(2, 2, 2, 2, 2, 1);           //2 : ["]
27
-        $this->t128[] = array(1, 2, 1, 2, 2, 3);           //3 : [#]
28
-        $this->t128[] = array(1, 2, 1, 3, 2, 2);           //4 : [$]
29
-        $this->t128[] = array(1, 3, 1, 2, 2, 2);           //5 : [%]
30
-        $this->t128[] = array(1, 2, 2, 2, 1, 3);           //6 : [&]
31
-        $this->t128[] = array(1, 2, 2, 3, 1, 2);           //7 : [']
32
-        $this->t128[] = array(1, 3, 2, 2, 1, 2);           //8 : [(]
33
-        $this->t128[] = array(2, 2, 1, 2, 1, 3);           //9 : [)]
34
-        $this->t128[] = array(2, 2, 1, 3, 1, 2);           //10 : [*]
35
-        $this->t128[] = array(2, 3, 1, 2, 1, 2);           //11 : [+]
36
-        $this->t128[] = array(1, 1, 2, 2, 3, 2);           //12 : [,]
37
-        $this->t128[] = array(1, 2, 2, 1, 3, 2);           //13 : [-]
38
-        $this->t128[] = array(1, 2, 2, 2, 3, 1);           //14 : [.]
39
-        $this->t128[] = array(1, 1, 3, 2, 2, 2);           //15 : [/]
40
-        $this->t128[] = array(1, 2, 3, 1, 2, 2);           //16 : [0]
41
-        $this->t128[] = array(1, 2, 3, 2, 2, 1);           //17 : [1]
42
-        $this->t128[] = array(2, 2, 3, 2, 1, 1);           //18 : [2]
43
-        $this->t128[] = array(2, 2, 1, 1, 3, 2);           //19 : [3]
44
-        $this->t128[] = array(2, 2, 1, 2, 3, 1);           //20 : [4]
45
-        $this->t128[] = array(2, 1, 3, 2, 1, 2);           //21 : [5]
46
-        $this->t128[] = array(2, 2, 3, 1, 1, 2);           //22 : [6]
47
-        $this->t128[] = array(3, 1, 2, 1, 3, 1);           //23 : [7]
48
-        $this->t128[] = array(3, 1, 1, 2, 2, 2);           //24 : [8]
49
-        $this->t128[] = array(3, 2, 1, 1, 2, 2);           //25 : [9]
50
-        $this->t128[] = array(3, 2, 1, 2, 2, 1);           //26 : [:]
51
-        $this->t128[] = array(3, 1, 2, 2, 1, 2);           //27 : [;]
52
-        $this->t128[] = array(3, 2, 2, 1, 1, 2);           //28 : [<]
53
-        $this->t128[] = array(3, 2, 2, 2, 1, 1);           //29 : [=]
54
-        $this->t128[] = array(2, 1, 2, 1, 2, 3);           //30 : [>]
55
-        $this->t128[] = array(2, 1, 2, 3, 2, 1);           //31 : [?]
56
-        $this->t128[] = array(2, 3, 2, 1, 2, 1);           //32 : [@]
57
-        $this->t128[] = array(1, 1, 1, 3, 2, 3);           //33 : [A]
58
-        $this->t128[] = array(1, 3, 1, 1, 2, 3);           //34 : [B]
59
-        $this->t128[] = array(1, 3, 1, 3, 2, 1);           //35 : [C]
60
-        $this->t128[] = array(1, 1, 2, 3, 1, 3);           //36 : [D]
61
-        $this->t128[] = array(1, 3, 2, 1, 1, 3);           //37 : [E]
62
-        $this->t128[] = array(1, 3, 2, 3, 1, 1);           //38 : [F]
63
-        $this->t128[] = array(2, 1, 1, 3, 1, 3);           //39 : [G]
64
-        $this->t128[] = array(2, 3, 1, 1, 1, 3);           //40 : [H]
65
-        $this->t128[] = array(2, 3, 1, 3, 1, 1);           //41 : [I]
66
-        $this->t128[] = array(1, 1, 2, 1, 3, 3);           //42 : [J]
67
-        $this->t128[] = array(1, 1, 2, 3, 3, 1);           //43 : [K]
68
-        $this->t128[] = array(1, 3, 2, 1, 3, 1);           //44 : [L]
69
-        $this->t128[] = array(1, 1, 3, 1, 2, 3);           //45 : [M]
70
-        $this->t128[] = array(1, 1, 3, 3, 2, 1);           //46 : [N]
71
-        $this->t128[] = array(1, 3, 3, 1, 2, 1);           //47 : [O]
72
-        $this->t128[] = array(3, 1, 3, 1, 2, 1);           //48 : [P]
73
-        $this->t128[] = array(2, 1, 1, 3, 3, 1);           //49 : [Q]
74
-        $this->t128[] = array(2, 3, 1, 1, 3, 1);           //50 : [R]
75
-        $this->t128[] = array(2, 1, 3, 1, 1, 3);           //51 : [S]
76
-        $this->t128[] = array(2, 1, 3, 3, 1, 1);           //52 : [T]
77
-        $this->t128[] = array(2, 1, 3, 1, 3, 1);           //53 : [U]
78
-        $this->t128[] = array(3, 1, 1, 1, 2, 3);           //54 : [V]
79
-        $this->t128[] = array(3, 1, 1, 3, 2, 1);           //55 : [W]
80
-        $this->t128[] = array(3, 3, 1, 1, 2, 1);           //56 : [X]
81
-        $this->t128[] = array(3, 1, 2, 1, 1, 3);           //57 : [Y]
82
-        $this->t128[] = array(3, 1, 2, 3, 1, 1);           //58 : [Z]
83
-        $this->t128[] = array(3, 3, 2, 1, 1, 1);           //59 : [[]
84
-        $this->t128[] = array(3, 1, 4, 1, 1, 1);           //60 : [\]
85
-        $this->t128[] = array(2, 2, 1, 4, 1, 1);           //61 : []]
86
-        $this->t128[] = array(4, 3, 1, 1, 1, 1);           //62 : [^]
87
-        $this->t128[] = array(1, 1, 1, 2, 2, 4);           //63 : [_]
88
-        $this->t128[] = array(1, 1, 1, 4, 2, 2);           //64 : [`]
89
-        $this->t128[] = array(1, 2, 1, 1, 2, 4);           //65 : [a]
90
-        $this->t128[] = array(1, 2, 1, 4, 2, 1);           //66 : [b]
91
-        $this->t128[] = array(1, 4, 1, 1, 2, 2);           //67 : [c]
92
-        $this->t128[] = array(1, 4, 1, 2, 2, 1);           //68 : [d]
93
-        $this->t128[] = array(1, 1, 2, 2, 1, 4);           //69 : [e]
94
-        $this->t128[] = array(1, 1, 2, 4, 1, 2);           //70 : [f]
95
-        $this->t128[] = array(1, 2, 2, 1, 1, 4);           //71 : [g]
96
-        $this->t128[] = array(1, 2, 2, 4, 1, 1);           //72 : [h]
97
-        $this->t128[] = array(1, 4, 2, 1, 1, 2);           //73 : [i]
98
-        $this->t128[] = array(1, 4, 2, 2, 1, 1);           //74 : [j]
99
-        $this->t128[] = array(2, 4, 1, 2, 1, 1);           //75 : [k]
100
-        $this->t128[] = array(2, 2, 1, 1, 1, 4);           //76 : [l]
101
-        $this->t128[] = array(4, 1, 3, 1, 1, 1);           //77 : [m]
102
-        $this->t128[] = array(2, 4, 1, 1, 1, 2);           //78 : [n]
103
-        $this->t128[] = array(1, 3, 4, 1, 1, 1);           //79 : [o]
104
-        $this->t128[] = array(1, 1, 1, 2, 4, 2);           //80 : [p]
105
-        $this->t128[] = array(1, 2, 1, 1, 4, 2);           //81 : [q]
106
-        $this->t128[] = array(1, 2, 1, 2, 4, 1);           //82 : [r]
107
-        $this->t128[] = array(1, 1, 4, 2, 1, 2);           //83 : [s]
108
-        $this->t128[] = array(1, 2, 4, 1, 1, 2);           //84 : [t]
109
-        $this->t128[] = array(1, 2, 4, 2, 1, 1);           //85 : [u]
110
-        $this->t128[] = array(4, 1, 1, 2, 1, 2);           //86 : [v]
111
-        $this->t128[] = array(4, 2, 1, 1, 1, 2);           //87 : [w]
112
-        $this->t128[] = array(4, 2, 1, 2, 1, 1);           //88 : [x]
113
-        $this->t128[] = array(2, 1, 2, 1, 4, 1);           //89 : [y]
114
-        $this->t128[] = array(2, 1, 4, 1, 2, 1);           //90 : [z]
115
-        $this->t128[] = array(4, 1, 2, 1, 2, 1);           //91 : [{]
116
-        $this->t128[] = array(1, 1, 1, 1, 4, 3);           //92 : [|]
117
-        $this->t128[] = array(1, 1, 1, 3, 4, 1);           //93 : [}]
118
-        $this->t128[] = array(1, 3, 1, 1, 4, 1);           //94 : [~]
119
-        $this->t128[] = array(1, 1, 4, 1, 1, 3);           //95 : [DEL]
120
-        $this->t128[] = array(1, 1, 4, 3, 1, 1);           //96 : [FNC3]
121
-        $this->t128[] = array(4, 1, 1, 1, 1, 3);           //97 : [FNC2]
122
-        $this->t128[] = array(4, 1, 1, 3, 1, 1);           //98 : [SHIFT]
123
-        $this->t128[] = array(1, 1, 3, 1, 4, 1);           //99 : [Cswap]
124
-        $this->t128[] = array(1, 1, 4, 1, 3, 1);           //100 : [Bswap]
125
-        $this->t128[] = array(3, 1, 1, 1, 4, 1);           //101 : [Aswap]
126
-        $this->t128[] = array(4, 1, 1, 1, 3, 1);           //102 : [FNC1]
127
-        $this->t128[] = array(2, 1, 1, 4, 1, 2);           //103 : [Astart]
128
-        $this->t128[] = array(2, 1, 1, 2, 1, 4);           //104 : [Bstart]
129
-        $this->t128[] = array(2, 1, 1, 2, 3, 2);           //105 : [Cstart]
130
-        $this->t128[] = array(2, 3, 3, 1, 1, 1);           //106 : [STOP]
131
-        $this->t128[] = array(2, 1);                       //107 : [END BAR]
24
+        $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ]
25
+        $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!]
26
+        $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["]
27
+        $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#]
28
+        $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$]
29
+        $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%]
30
+        $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&]
31
+        $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : [']
32
+        $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(]
33
+        $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)]
34
+        $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*]
35
+        $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+]
36
+        $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,]
37
+        $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-]
38
+        $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.]
39
+        $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/]
40
+        $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0]
41
+        $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1]
42
+        $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2]
43
+        $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3]
44
+        $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4]
45
+        $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5]
46
+        $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6]
47
+        $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7]
48
+        $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8]
49
+        $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9]
50
+        $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:]
51
+        $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;]
52
+        $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<]
53
+        $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=]
54
+        $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>]
55
+        $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?]
56
+        $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@]
57
+        $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A]
58
+        $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B]
59
+        $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C]
60
+        $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D]
61
+        $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E]
62
+        $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F]
63
+        $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G]
64
+        $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H]
65
+        $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I]
66
+        $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J]
67
+        $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K]
68
+        $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L]
69
+        $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M]
70
+        $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N]
71
+        $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O]
72
+        $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P]
73
+        $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q]
74
+        $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R]
75
+        $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S]
76
+        $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T]
77
+        $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U]
78
+        $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V]
79
+        $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W]
80
+        $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X]
81
+        $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y]
82
+        $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z]
83
+        $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[]
84
+        $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\]
85
+        $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []]
86
+        $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^]
87
+        $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_]
88
+        $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`]
89
+        $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a]
90
+        $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b]
91
+        $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c]
92
+        $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d]
93
+        $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e]
94
+        $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f]
95
+        $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g]
96
+        $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h]
97
+        $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i]
98
+        $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j]
99
+        $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k]
100
+        $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l]
101
+        $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m]
102
+        $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n]
103
+        $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o]
104
+        $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p]
105
+        $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q]
106
+        $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r]
107
+        $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s]
108
+        $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t]
109
+        $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u]
110
+        $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v]
111
+        $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w]
112
+        $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x]
113
+        $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y]
114
+        $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z]
115
+        $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{]
116
+        $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|]
117
+        $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}]
118
+        $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~]
119
+        $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL]
120
+        $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3]
121
+        $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2]
122
+        $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT]
123
+        $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap]
124
+        $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap]
125
+        $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap]
126
+        $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1]
127
+        $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart]
128
+        $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart]
129
+        $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart]
130
+        $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP]
131
+        $this->t128[] = array(2, 1); //107 : [END BAR]
132 132
         for ($i = 32; $i <= 95; $i++) {   // conjunto de caracteres
133 133
             $this->abcSet .= chr($i);
134 134
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $this->abcSet .= chr($i);
143 143
             $this->bSet .= chr($i);
144 144
         }
145
-        $this->cSet="0123456789";
145
+        $this->cSet = "0123456789";
146 146
         for ($i = 0; $i < 96; $i++) {
147 147
             // convertendo grupos A & B
148 148
             if (isset($this->setFrom["A"])) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $this->setFrom["B"] .= chr($i + 32);
153 153
             }
154 154
             if (isset($this->setTo["A"])) {
155
-                $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32);
155
+                $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32);
156 156
             }
157 157
             if (isset($this->setTo["A"])) {
158 158
                 $this->setTo["B"] .= chr($i);
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function code128($x, $y, $code, $w, $h)
167 167
     {
168
-        $Aguid="";
169
-        $Bguid="";
170
-        $Cguid="";
171
-        for ($i=0; $i < strlen($code); $i++) {
172
-            $needle=substr($code, $i, 1);
173
-            $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O");
174
-            $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O");
175
-            $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O");
168
+        $Aguid = "";
169
+        $Bguid = "";
170
+        $Cguid = "";
171
+        for ($i = 0; $i < strlen($code); $i++) {
172
+            $needle = substr($code, $i, 1);
173
+            $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O");
174
+            $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O");
175
+            $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O");
176 176
         }
177 177
         $SminiC = "OOOO";
178 178
         $IminiC = 4;
179 179
         $crypt = "";
180 180
         while ($code > "") {
181 181
             $i = strpos($Cguid, $SminiC);
182
-            if ($i!==false) {
182
+            if ($i !== false) {
183 183
                 $Aguid [$i] = "N";
184 184
                 $Bguid [$i] = "N";
185 185
             }
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
                 if ($made === false) {
190 190
                     $made = strlen($Cguid);
191 191
                 }
192
-                if (fmod($made, 2)==1) {
192
+                if (fmod($made, 2) == 1) {
193 193
                     $made--;
194 194
                 }
195
-                for ($i=0; $i < $made; $i += 2) {
195
+                for ($i = 0; $i < $made; $i += 2) {
196 196
                     $crypt .= chr(strval(substr($code, $i, 2)));
197 197
                 }
198 198
                     $jeu = "C";
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
                 if ($madeB === false) {
206 206
                     $madeB = strlen($Bguid);
207 207
                 }
208
-                $made = (($madeA < $madeB) ? $madeB : $madeA );
209
-                $jeu = (($madeA < $madeB) ? "B" : "A" );
208
+                $made = (($madeA < $madeB) ? $madeB : $madeA);
209
+                $jeu = (($madeA < $madeB) ? "B" : "A");
210 210
                 $jeuguid = $jeu . "guid";
211 211
                 $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]);
212 212
                 $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]);
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
             $Cguid = substr($Cguid, $made);
218 218
         }
219 219
         $check = ord($crypt[0]);
220
-        for ($i=0; $i<strlen($crypt); $i++) {
220
+        for ($i = 0; $i < strlen($crypt); $i++) {
221 221
             $check += (ord($crypt[$i]) * $i);
222 222
         }
223 223
         $check %= 103;
224 224
         $crypt .= chr($check) . chr(106) . chr(107);
225 225
         $i = (strlen($crypt) * 11) - 8;
226
-        $modul = $w/$i;
227
-        for ($i=0; $i<strlen($crypt); $i++) {
226
+        $modul = $w / $i;
227
+        for ($i = 0; $i < strlen($crypt); $i++) {
228 228
             $c = $this->t128[ord($crypt[$i])];
229
-            for ($j=0; $j<count($c); $j++) {
230
-                $this->Rect($x, $y, $c[$j]*$modul, $h, "F");
231
-                $x += ($c[$j++]+$c[$j])*$modul;
229
+            for ($j = 0; $j < count($c); $j++) {
230
+                $this->Rect($x, $y, $c[$j] * $modul, $h, "F");
231
+                $x += ($c[$j++] + $c[$j]) * $modul;
232 232
             }
233 233
         }
234 234
     }
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
         }
253 253
         $this->angle = $angle;
254 254
         if ($angle != 0) {
255
-            $angle *= M_PI/180;
255
+            $angle *= M_PI / 180;
256 256
             $c = cos($angle);
257 257
             $s = sin($angle);
258
-            $cx =$x*$this->k;
259
-            $cy = ($this->h-$y)*$this->k;
258
+            $cx = $x * $this->k;
259
+            $cy = ($this->h - $y) * $this->k;
260 260
             $this->out(
261 261
                 sprintf(
262 262
                     'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',
@@ -294,40 +294,40 @@  discard block
 block discarded – undo
294 294
         } else {
295 295
             $op = 'S';
296 296
         }
297
-        $MyArc = 4/3 * (sqrt(2) - 1);
298
-        $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k));
299
-        $xc = $x+$w-$r;
300
-        $yc = $y+$r;
301
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k));
302
-        if (strpos($corners, '2')===false) {
303
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k));
297
+        $MyArc = 4 / 3 * (sqrt(2) - 1);
298
+        $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
299
+        $xc = $x + $w - $r;
300
+        $yc = $y + $r;
301
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
302
+        if (strpos($corners, '2') === false) {
303
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
304 304
         } else {
305
-            $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
305
+            $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
306 306
         }
307
-        $xc = $x+$w-$r;
308
-        $yc = $y+$h-$r;
309
-        $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k));
310
-        if (strpos($corners, '3')===false) {
311
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k));
307
+        $xc = $x + $w - $r;
308
+        $yc = $y + $h - $r;
309
+        $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
310
+        if (strpos($corners, '3') === false) {
311
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
312 312
         } else {
313
-            $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
313
+            $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
314 314
         }
315
-        $xc = $x+$r;
316
-        $yc = $y+$h-$r;
317
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k));
318
-        if (strpos($corners, '4')===false) {
319
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k));
315
+        $xc = $x + $r;
316
+        $yc = $y + $h - $r;
317
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
318
+        if (strpos($corners, '4') === false) {
319
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
320 320
         } else {
321
-            $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
321
+            $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
322 322
         }
323
-        $xc = $x+$r ;
324
-        $yc = $y+$r;
325
-        $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k));
326
-        if (strpos($corners, '1')===false) {
327
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k));
328
-            $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k));
323
+        $xc = $x + $r;
324
+        $yc = $y + $r;
325
+        $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k));
326
+        if (strpos($corners, '1') === false) {
327
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
328
+            $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
329 329
         } else {
330
-            $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
330
+            $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
331 331
         }
332 332
         $this->out($op);
333 333
     }
@@ -347,12 +347,12 @@  discard block
 block discarded – undo
347 347
         $this->out(
348 348
             sprintf(
349 349
                 '%.2F %.2F %.2F %.2F %.2F %.2F c ',
350
-                $x1*$this->k,
351
-                ($h-$y1)*$this->k,
352
-                $x2*$this->k,
353
-                ($h-$y2)*$this->k,
354
-                $x3*$this->k,
355
-                ($h-$y3)*$this->k
350
+                $x1 * $this->k,
351
+                ($h - $y1) * $this->k,
352
+                $x2 * $this->k,
353
+                ($h - $y2) * $this->k,
354
+                $x3 * $this->k,
355
+                ($h - $y3) * $this->k
356 356
             )
357 357
         );
358 358
     }
@@ -369,26 +369,26 @@  discard block
 block discarded – undo
369 369
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
370 370
     {
371 371
         $this->setLineWidth($width);
372
-        $longueur = abs($x1-$x2);
373
-        $hauteur = abs($y1-$y2);
372
+        $longueur = abs($x1 - $x2);
373
+        $hauteur = abs($y1 - $y2);
374 374
         if ($longueur > $hauteur) {
375
-            $Pointilles = ($longueur/$nb)/2;
375
+            $Pointilles = ($longueur / $nb) / 2;
376 376
         } else {
377
-            $Pointilles = ($hauteur/$nb)/2;
377
+            $Pointilles = ($hauteur / $nb) / 2;
378 378
         }
379
-        for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) {
380
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
381
-                if ($j<=($x2-1)) {
382
-                    $this->line($j, $y1, $j+1, $y1);
383
-                    $this->line($j, $y2, $j+1, $y2);
379
+        for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
380
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
381
+                if ($j <= ($x2 - 1)) {
382
+                    $this->line($j, $y1, $j + 1, $y1);
383
+                    $this->line($j, $y2, $j + 1, $y2);
384 384
                 }
385 385
             }
386 386
         }
387
-        for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) {
388
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
389
-                if ($j<=($y2-1)) {
390
-                    $this->line($x1, $j, $x1, $j+1);
391
-                    $this->line($x2, $j, $x2, $j+1);
387
+        for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
388
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
389
+                if ($j <= ($y2 - 1)) {
390
+                    $this->line($x1, $j, $x1, $j + 1);
391
+                    $this->line($x2, $j, $x2, $j + 1);
392 392
                 }
393 393
             }
394 394
         }
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
         $yi = $this->getY();
410 410
         $hrow = $this->fontSize;
411 411
         $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0);
412
-        $maxrows = floor($h/$this->fontSize);
412
+        $maxrows = floor($h / $this->fontSize);
413 413
         $rows = min($textrows, $maxrows);
414 414
         $dy = 0;
415 415
         if (strtoupper($valign) == 'M') {
416
-            $dy = ($h-$rows*$this->fontSize)/2;
416
+            $dy = ($h - $rows * $this->fontSize) / 2;
417 417
         }
418 418
         if (strtoupper($valign) == 'B') {
419
-            $dy = $h-$rows*$this->fontSize;
419
+            $dy = $h - $rows * $this->fontSize;
420 420
         }
421
-        $this->setY($yi+$dy);
421
+        $this->setY($yi + $dy);
422 422
         $this->setX($xi);
423 423
         $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1);
424 424
         if ($border) {
@@ -440,17 +440,17 @@  discard block
 block discarded – undo
440 440
      */
441 441
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
442 442
     {
443
-        $cw =& $this->currentFont['cw'];
443
+        $cw = & $this->currentFont['cw'];
444 444
         if ($w == 0) {
445
-            $w = $this->w-$this->rMargin-$this->x;
445
+            $w = $this->w - $this->rMargin - $this->x;
446 446
         }
447
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
447
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
448 448
         $s = str_replace("\r", '', $txt);
449 449
         $nb = strlen($s);
450
-        if ($nb > 0 && $s[$nb-1] == "\n") {
450
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
451 451
             $nb--;
452 452
         }
453
-        $b=0;
453
+        $b = 0;
454 454
         if ($border) {
455 455
             if ($border == 1) {
456 456
                 $border = 'LTRB';
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
                 if (is_int(strpos($border, 'R'))) {
465 465
                     $b2 .= 'R';
466 466
                 }
467
-                $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2;
467
+                $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
468 468
             }
469 469
         }
470 470
         $sep = -1;
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
                     }
484 484
                 }
485 485
                 if ($prn == 1) {
486
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
486
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
487 487
                 }
488 488
                 $i++;
489 489
                 $sep = -1;
@@ -517,19 +517,19 @@  discard block
 block discarded – undo
517 517
                         }
518 518
                     }
519 519
                     if ($prn == 1) {
520
-                        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
520
+                        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
521 521
                     }
522 522
                 } else {
523 523
                     if ($align == 'J') {
524
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
524
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
525 525
                         if ($prn == 1) {
526
-                            $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
526
+                            $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
527 527
                         }
528 528
                     }
529 529
                     if ($prn == 1) {
530
-                        $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
530
+                        $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
531 531
                     }
532
-                    $i = $sep+1;
532
+                    $i = $sep + 1;
533 533
                 }
534 534
                 $sep = -1;
535 535
                 $j = $i;
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
             $b .= 'B';
557 557
         }
558 558
         if ($prn == 1) {
559
-            $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
559
+            $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
560 560
         }
561 561
         $this->x = $this->lMargin;
562 562
         return $nl;
@@ -585,27 +585,27 @@  discard block
 block discarded – undo
585 585
                 $wordwidth = $this->getStringWidth($word);
586 586
                 if ($wordwidth > $maxwidth) {
587 587
                     // Word is too long, we cut it
588
-                    for ($i=0; $i<strlen($word); $i++) {
588
+                    for ($i = 0; $i < strlen($word); $i++) {
589 589
                         $wordwidth = $this->getStringWidth(substr($word, $i, 1));
590 590
                         if ($width + $wordwidth <= $maxwidth) {
591 591
                             $width += $wordwidth;
592 592
                             $text .= substr($word, $i, 1);
593 593
                         } else {
594 594
                             $width = $wordwidth;
595
-                            $text = rtrim($text)."\n".substr($word, $i, 1);
595
+                            $text = rtrim($text) . "\n" . substr($word, $i, 1);
596 596
                             $count++;
597 597
                         }
598 598
                     }
599 599
                 } elseif ($width + $wordwidth <= $maxwidth) {
600 600
                     $width += $wordwidth + $space;
601
-                    $text .= $word.' ';
601
+                    $text .= $word . ' ';
602 602
                 } else {
603 603
                     $width = $wordwidth + $space;
604
-                    $text = rtrim($text)."\n".$word.' ';
604
+                    $text = rtrim($text) . "\n" . $word . ' ';
605 605
                     $count++;
606 606
                 }
607 607
             }
608
-            $text = rtrim($text)."\n";
608
+            $text = rtrim($text) . "\n";
609 609
             $count++;
610 610
         }
611 611
         $text = rtrim($text);
@@ -637,21 +637,21 @@  discard block
 block discarded – undo
637 637
         $scale = false,
638 638
         $force = true
639 639
     ) {
640
-        $str_width=$this->getStringWidth($txt);
640
+        $str_width = $this->getStringWidth($txt);
641 641
         if ($w == 0) {
642
-            $w = $this->w-$this->rMargin-$this->x;
642
+            $w = $this->w - $this->rMargin - $this->x;
643 643
         }
644
-        $ratio = ($w-$this->cMargin*2)/$str_width;
644
+        $ratio = ($w - $this->cMargin * 2) / $str_width;
645 645
         $fit = ($ratio < 1 || ($ratio > 1 && $force));
646 646
         if ($fit) {
647 647
             if ($scale) {
648 648
                 //Calcula a escala horizontal
649
-                $horiz_scale = $ratio*100.0;
649
+                $horiz_scale = $ratio * 100.0;
650 650
                 //Ajusta a escala horizontal
651 651
                 $this->out(sprintf('BT %.2F Tz ET', $horiz_scale));
652 652
             } else {
653 653
                 //Calcula o espaçamento de caracteres em pontos
654
-                $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k;
654
+                $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k;
655 655
                 //Ajusta o espaçamento de caracteres
656 656
                 $this->out(sprintf('BT %.2F Tc ET', $char_space));
657 657
             }
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
663 663
         //Reseta o espaçamento de caracteres e a escala horizontal
664 664
         if ($fit) {
665
-            $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
665
+            $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET');
666 666
         }
667 667
     }
668 668
 
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
             $len = 0;
758 758
             $nbbytes = strlen($s);
759 759
             for ($i = 0; $i < $nbbytes; $i++) {
760
-                if (ord($s[$i])<128) {
760
+                if (ord($s[$i]) < 128) {
761 761
                     $len++;
762 762
                 } else {
763 763
                     $len++;
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
     {
784 784
         $this->setDrawColor(110);
785 785
         $this->setLineWidth($h);
786
-        $wDash = ($w/$n)/2;
787
-        for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) {
788
-            for ($j=$i; $j<= ($i+$wDash); $j++) {
789
-                if ($j <= ($x+$w-1)) {
790
-                    $this->line($j, $y, $j+1, $y);
786
+        $wDash = ($w / $n) / 2;
787
+        for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) {
788
+            for ($j = $i; $j <= ($i + $wDash); $j++) {
789
+                if ($j <= ($x + $w - 1)) {
790
+                    $this->line($j, $y, $j + 1, $y);
791 791
                 }
792 792
             }
793 793
         }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
             $y = $aux;
813 813
         }
814 814
         while ($y < $yfinal && $n > 0) {
815
-            $this->line($x, $y, $x, $y+1);
815
+            $this->line($x, $y, $x, $y + 1);
816 816
             $y += 3;
817 817
             $n--;
818 818
         }
Please login to merge, or discard this patch.
src/NFe/Danfe.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 $this->textoAdic .= ". \r\n";
596 596
             }
597 597
             $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
598
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
598
+                ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
599 599
         }
600 600
         //informações adicionais
601 601
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
         $oldX = $x;
1008 1008
         $oldY = $y;
1009 1009
         if ($this->orientacao == 'P') {
1010
-              $maxW = $this->wPrint;
1010
+                $maxW = $this->wPrint;
1011 1011
         } else {
1012 1012
             if ($pag == 1) { // primeira página
1013 1013
                 $maxW = $this->wPrint - $this->wCanhoto;
@@ -1343,8 +1343,8 @@  discard block
 block discarded – undo
1343 1343
             $w = $maxW-(2*$x);
1344 1344
             $this->pdf->SetTextColor(200, 200, 200);
1345 1345
             $texto = "DANFE impresso em contingência -\n".
1346
-                     "DPEC regularmente recebido pela Receita\n".
1347
-                     "Federal do Brasil";
1346
+                        "DPEC regularmente recebido pela Receita\n".
1347
+                        "Federal do Brasil";
1348 1348
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1349 1349
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1350 1350
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1631,13 +1631,13 @@  discard block
 block discarded – undo
1631 1631
         return ($y + $h);
1632 1632
     } //fim da função destinatarioDANFE
1633 1633
 
1634
-     /**
1635
-     * pGetTextoFatura
1636
-     * Gera a String do Texto da Fatura
1637
-      *
1638
-     * @name   getTextoFatura
1639
-     * @return uma String com o texto ou "";
1640
-     */
1634
+        /**
1635
+         * pGetTextoFatura
1636
+         * Gera a String do Texto da Fatura
1637
+         *
1638
+         * @name   getTextoFatura
1639
+         * @return uma String com o texto ou "";
1640
+         */
1641 1641
     protected function pGetTextoFatura()
1642 1642
     {
1643 1643
         if (isset($this->cobr)) {
@@ -1668,13 +1668,13 @@  discard block
 block discarded – undo
1668 1668
         return "";
1669 1669
     } //fim getTextoFatura
1670 1670
 
1671
-     /**
1672
-     * pSizeExtraTextoFatura
1673
-     * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1674
-      *
1675
-     * @name   pSizeExtraTextoFatura
1676
-     * @return integer
1677
-     */
1671
+        /**
1672
+         * pSizeExtraTextoFatura
1673
+         * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata.
1674
+         *
1675
+         * @name   pSizeExtraTextoFatura
1676
+         * @return integer
1677
+         */
1678 1678
     protected function pSizeExtraTextoFatura()
1679 1679
     {
1680 1680
         $textoFatura = $this->pGetTextoFatura();
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
                                     '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1840 1840
                                     '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1841 1841
             $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1842
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1842
+                                '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1843 1843
             foreach ($this->detPag as $k => $d) {
1844 1844
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1845 1845
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
         $w4 = round($w*0.05, 0);
2473 2473
         $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2474 2474
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2475
-             $texto = 'O/CST';//Regime Normal
2475
+                $texto = 'O/CST';//Regime Normal
2476 2476
         }
2477 2477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2478 2478
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
@@ -2983,9 +2983,9 @@  discard block
 block discarded – undo
2983 2983
         //DADOS ADICIONAIS
2984 2984
         $texto = "DADOS ADICIONAIS";
2985 2985
         if ($this->orientacao == 'P') {
2986
-              $w = $this->wPrint;
2986
+                $w = $this->wPrint;
2987 2987
         } else {
2988
-              $w = $this->wPrint-$this->wCanhoto;
2988
+                $w = $this->wPrint-$this->wCanhoto;
2989 2989
         }
2990 2990
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2991 2991
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3065,10 +3065,10 @@  discard block
 block discarded – undo
3065 3065
     protected function pRodape($x, $y)
3066 3066
     {
3067 3067
         if ($this->orientacao == 'P') {
3068
-              $w = $this->wPrint;
3068
+                $w = $this->wPrint;
3069 3069
         } else {
3070
-              $w = $this->wPrint-$this->wCanhoto;
3071
-              $x = $this->wCanhoto;
3070
+                $w = $this->wPrint-$this->wCanhoto;
3071
+                $x = $this->wCanhoto;
3072 3072
         }
3073 3073
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3074 3074
         $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
Please login to merge, or discard this patch.
Spacing   +330 added lines, -331 removed lines patch added patch discarded remove patch
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $this->fontePadrao = $fonteDANFE;
356 356
         }
357 357
         //se for passado o xml
358
-        if (! empty($this->xml)) {
358
+        if (!empty($this->xml)) {
359 359
             $this->dom = new Dom();
360 360
             $this->dom->loadXML($this->xml);
361 361
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -511,10 +511,10 @@  discard block
 block discarded – undo
511 511
         //total inicial de paginas
512 512
         $totPag = 1;
513 513
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
514
-        $this->wPrint = $maxW-($margEsq*2);
514
+        $this->wPrint = $maxW - ($margEsq * 2);
515 515
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
516 516
         //superior e inferior
517
-        $this->hPrint = $maxH-$margSup-$margInf;
517
+        $this->hPrint = $maxH - $margSup - $margInf;
518 518
         // estabelece contagem de paginas
519 519
         $this->pdf->aliasNbPages();
520 520
         // fixa as margens
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
         }
553 553
         //calcular a altura necessária para os dados adicionais
554 554
         if ($this->orientacao == 'P') {
555
-            $this->wAdic = round($this->wPrint*0.66, 0);
555
+            $this->wAdic = round($this->wPrint * 0.66, 0);
556 556
         } else {
557
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
557
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
558 558
         }
559 559
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
560 560
         $this->textoAdic = '';
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
             $txRetxBairro = $this->getTagValue($this->retirada, "xBairro");
567 567
             $txRetxMun = $this->getTagValue($this->retirada, "xMun");
568 568
             $txRetUF = $this->getTagValue($this->retirada, "UF");
569
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
570
-                    $txRetCNPJ.
569
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
570
+                    $txRetCNPJ .
571 571
                     '-' .
572 572
                     $txRetxLgr .
573 573
                     ', ' .
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
             if ($this->textoAdic != '') {
595 595
                 $this->textoAdic .= ". \r\n";
596 596
             }
597
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
598
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
597
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
598
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
599 599
         }
600 600
         //informações adicionais
601 601
         $this->textoAdic .= $this->geraInformacoesDasNotasReferenciadas();
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
             if ($this->textoAdic != '') {
605 605
                 $this->textoAdic .= ". \r\n";
606 606
             }
607
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infCpl")) ?
607
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infCpl")) ?
608 608
                 'Inf. Contribuinte: ' .
609 609
                 $this->pAnfavea($this->getTagValue($this->infAdic, "infCpl")) : '';
610 610
             $infPedido = $this->geraInformacoesDaTagCompra();
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
                 $this->textoAdic .= $infPedido;
613 613
             }
614 614
             $this->textoAdic .= $this->getTagValue($this->dest, "email", ' Email do Destinatário: ');
615
-            $this->textoAdic .= ! empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
615
+            $this->textoAdic .= !empty($this->getTagValue($this->infAdic, "infAdFisco")) ?
616 616
                 "\r\n Inf. fisco: " .
617 617
                 $this->getTagValue($this->infAdic, "infAdFisco") : '';
618 618
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
619 619
             if (isset($obsCont)) {
620 620
                 foreach ($obsCont as $obs) {
621
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
622
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
621
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
622
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
623 623
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
624 624
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
625 625
                     $i++;
@@ -647,38 +647,38 @@  discard block
 block discarded – undo
647 647
         foreach ($alinhas as $linha) {
648 648
             $numlinhasdados += $this->pdf->getNumLines($linha, $this->wAdic, $fontProduto);
649 649
         }
650
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
650
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
651 651
         if ($hdadosadic < 10) {
652 652
             $hdadosadic = 10;
653 653
         }
654 654
         //altura disponivel para os campos da DANFE
655
-        $hcabecalho = 47;//para cabeçalho
656
-        $hdestinatario = 25;//para destinatario
657
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
658
-        $himposto = 18;// para imposto
659
-        $htransporte = 25;// para transporte
660
-        $hissqn = 11;// para issqn
661
-        $hfooter = 5;// para rodape
662
-        $hCabecItens = 4;//cabeçalho dos itens
655
+        $hcabecalho = 47; //para cabeçalho
656
+        $hdestinatario = 25; //para destinatario
657
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
658
+        $himposto = 18; // para imposto
659
+        $htransporte = 25; // para transporte
660
+        $hissqn = 11; // para issqn
661
+        $hfooter = 5; // para rodape
662
+        $hCabecItens = 4; //cabeçalho dos itens
663 663
         //alturas disponiveis para os dados
664 664
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
665 665
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
666 666
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
667 667
             $this->pSizeExtraTextoFatura());
668 668
         if ($this->orientacao == 'P') {
669
-            $hDispo1 -= 24 * $this->qCanhoto;//para canhoto
669
+            $hDispo1 -= 24 * $this->qCanhoto; //para canhoto
670 670
             $w = $this->wPrint;
671 671
         } else {
672
-            $hcanhoto = $this->hPrint;//para canhoto
672
+            $hcanhoto = $this->hPrint; //para canhoto
673 673
             $w = $this->wPrint - $this->wCanhoto;
674 674
         }
675
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
675
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
676 676
         //Contagem da altura ocupada para impressão dos itens
677 677
         $fontProduto = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
678 678
         $i = 1;
679 679
         $numlinhas = 0;
680 680
         $hUsado = $hCabecItens;
681
-        $w2 = round($w*0.28, 0);
681
+        $w2 = round($w * 0.28, 0);
682 682
         $hDispo = $hDispo1;
683 683
         $totPag = 1;
684 684
         while ($i < $this->det->length) {
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
                 $hDispo = $hDispo2;
691 691
                 $hUsado = $hCabecItens;
692 692
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
693
-                $w2 = round($this->wPrint*0.28, 0);
693
+                $w2 = round($this->wPrint * 0.28, 0);
694 694
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
695 695
             }
696 696
             $i++;
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         //coloca o cabeçalho
715 715
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
716 716
         //coloca os dados do destinatário
717
-        $y = $this->pDestinatarioDANFE($x, $y+1);
717
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
718 718
         
719 719
         
720 720
         //Verifica as formas de pagamento da nota fiscal
@@ -728,29 +728,29 @@  discard block
 block discarded – undo
728 728
         }
729 729
         //caso tenha boleto imprimir fatura
730 730
         if ($this->dup->length > 0) {
731
-            $y = $this->pFaturaDANFE($x, $y+1);
731
+            $y = $this->pFaturaDANFE($x, $y + 1);
732 732
         } else {
733 733
             //Se somente tiver a forma de pagamento sem pagamento ou outros não imprimir nada
734
-            if (count($formaPag)=='1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
734
+            if (count($formaPag) == '1' && (isset($formaPag[90]) || isset($formaPag[99]))) {
735 735
                 $y = $y;
736 736
             } else {
737 737
                 //caso tenha mais de uma forma de pagamento ou seja diferente de boleto exibe a
738 738
                 //forma de pagamento e o valor
739
-                $y = $this->pagamentoDANFE($x, $y+1);
739
+                $y = $this->pagamentoDANFE($x, $y + 1);
740 740
             }
741 741
         }
742 742
         //coloca os dados dos impostos e totais da NFe
743
-        $y = $this->pImpostoDANFE($x, $y+1);
743
+        $y = $this->pImpostoDANFE($x, $y + 1);
744 744
         //coloca os dados do trasnporte
745
-        $y = $this->pTransporteDANFE($x, $y+1);
745
+        $y = $this->pTransporteDANFE($x, $y + 1);
746 746
         //itens da DANFE
747 747
         $nInicial = 0;
748 748
 
749
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
749
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
750 750
 
751 751
         //coloca os dados do ISSQN
752 752
         if ($linhaISSQN == 1) {
753
-            $y = $this->pIssqnDANFE($x, $y+4);
753
+            $y = $this->pIssqnDANFE($x, $y + 4);
754 754
         } else {
755 755
             $y += 4;
756 756
         }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
759 759
         //coloca o rodapé da página
760 760
         if ($this->orientacao == 'P') {
761
-            $this->pRodape($xInic, $y-1);
761
+            $this->pRodape($xInic, $y - 1);
762 762
         } else {
763 763
             $this->pRodape($xInic, $this->hPrint + 1);
764 764
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             //coloca o cabeçalho na página adicional
780 780
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
781 781
             //coloca os itens na página adicional
782
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
782
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
783 783
             //coloca o rodapé da página
784 784
             if ($this->orientacao == 'P') {
785 785
                 $this->pRodape($xInic, $y + 4);
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
             }
793 793
         }
794 794
         //retorna o ID na NFe
795
-        if ($classPdf!==false) {
795
+        if ($classPdf !== false) {
796 796
             $aR = [
797 797
                 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
798 798
                 'classe_PDF'=>$this->pdf
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
         if ($startPos === false) {
827 827
             return $cdata;
828 828
         }
829
-        for ($x=$len; $x>0; $x--) {
829
+        for ($x = $len; $x > 0; $x--) {
830 830
             if (substr($cdata, $x, 1) == '>') {
831 831
                 $endPos = $x;
832 832
                 break;
@@ -837,15 +837,15 @@  discard block
 block discarded – undo
837 837
         } else {
838 838
             $parte1 = '';
839 839
         }
840
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
840
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
841 841
         if ($endPos < $len) {
842 842
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
843 843
         } else {
844 844
             $parte3 = '';
845 845
         }
846
-        $texto = trim($parte1).' '.trim($parte3);
846
+        $texto = trim($parte1) . ' ' . trim($parte3);
847 847
         if (strpos($parte2, '<CDATA>') === false) {
848
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
848
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
849 849
         } else {
850 850
             $cdata = $parte2;
851 851
         }
@@ -919,15 +919,15 @@  discard block
 block discarded – undo
919 919
         //grupo CADATA infCpl
920 920
         $t = $dom->getElementsByTagName('transmissor')->item(0);
921 921
         $r = $dom->getElementsByTagName('receptor')->item(0);
922
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
923
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
924
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
925
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
926
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
927
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
928
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
929
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
930
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
922
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
923
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
924
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
925
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
926
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
927
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
928
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
929
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
930
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
931 931
         if (isset($t)) {
932 932
             if ($t->hasAttributes()) {
933 933
                 $texto .= " Transmissor ";
@@ -1017,14 +1017,14 @@  discard block
 block discarded – undo
1017 1017
         }
1018 1018
         //####################################################################################
1019 1019
         //coluna esquerda identificação do emitente
1020
-        $w = round($maxW*0.41, 0);
1020
+        $w = round($maxW * 0.41, 0);
1021 1021
         if ($this->orientacao == 'P') {
1022 1022
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
1023 1023
         } else {
1024 1024
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1025 1025
         }
1026 1026
         $w1 = $w;
1027
-        $h=32;
1027
+        $h = 32;
1028 1028
         $oldY += $h;
1029 1029
         $this->pdf->textBox($x, $y, $w, $h);
1030 1030
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1045,39 +1045,39 @@  discard block
 block discarded – undo
1045 1045
                 $type == 'jpg';
1046 1046
             }
1047 1047
             //largura da imagem em mm
1048
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1048
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1049 1049
             //altura da imagem em mm
1050
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1051
-            if ($this->logoAlign=='L') {
1052
-                $nImgW = round($w/3, 0);
1053
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1054
-                $xImg = $x+1;
1055
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1050
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1051
+            if ($this->logoAlign == 'L') {
1052
+                $nImgW = round($w / 3, 0);
1053
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1054
+                $xImg = $x + 1;
1055
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1056 1056
                 //estabelecer posições do texto
1057
-                $x1 = round($xImg + $nImgW +1, 0);
1058
-                $y1 = round($h/3+$y, 0);
1059
-                $tw = round(2*$w/3, 0);
1060
-            } elseif ($this->logoAlign=='C') {
1061
-                $nImgH = round($h/3, 0);
1062
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1063
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1064
-                $yImg = $y+3;
1057
+                $x1 = round($xImg + $nImgW + 1, 0);
1058
+                $y1 = round($h / 3 + $y, 0);
1059
+                $tw = round(2 * $w / 3, 0);
1060
+            } elseif ($this->logoAlign == 'C') {
1061
+                $nImgH = round($h / 3, 0);
1062
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1063
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1064
+                $yImg = $y + 3;
1065 1065
                 $x1 = $x;
1066 1066
                 $y1 = round($yImg + $nImgH + 1, 0);
1067 1067
                 $tw = $w;
1068
-            } elseif ($this->logoAlign=='R') {
1069
-                $nImgW = round($w/3, 0);
1070
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1071
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1072
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1068
+            } elseif ($this->logoAlign == 'R') {
1069
+                $nImgW = round($w / 3, 0);
1070
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1071
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1072
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1073 1073
                 $x1 = $x;
1074
-                $y1 = round($h/3+$y, 0);
1075
-                $tw = round(2*$w/3, 0);
1076
-            } elseif ($this->logoAlign=='F') {
1077
-                $nImgH = round($h-5, 0);
1078
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1079
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1080
-                $yImg = $y+3;
1074
+                $y1 = round($h / 3 + $y, 0);
1075
+                $tw = round(2 * $w / 3, 0);
1076
+            } elseif ($this->logoAlign == 'F') {
1077
+                $nImgH = round($h - 5, 0);
1078
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1079
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1080
+                $yImg = $y + 3;
1081 1081
                 $x1 = $x;
1082 1082
                 $y1 = round($yImg + $nImgH + 1, 0);
1083 1083
                 $tw = $w;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, $type);
1087 1087
         } else {
1088 1088
             $x1 = $x;
1089
-            $y1 = round($h/3+$y, 0);
1089
+            $y1 = round($h / 3 + $y, 0);
1090 1090
             $tw = $w;
1091 1091
         }
1092 1092
         // monta as informações apenas se diferente de full logo
@@ -1096,9 +1096,9 @@  discard block
 block discarded – undo
1096 1096
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1097 1097
             $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1098 1098
             //endereço
1099
-            $y1 = $y1+5;
1099
+            $y1 = $y1 + 5;
1100 1100
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1101
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1101
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1102 1102
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1103 1103
                  : '';
1104 1104
             $lgr = $this->getTagValue($this->enderEmit, "xLgr");
@@ -1118,37 +1118,37 @@  discard block
 block discarded – undo
1118 1118
         //####################################################################################
1119 1119
         //coluna central Danfe
1120 1120
         $x += $w;
1121
-        $w=round($maxW * 0.17, 0);//35;
1121
+        $w = round($maxW * 0.17, 0); //35;
1122 1122
         $w2 = $w;
1123 1123
         $h = 32;
1124 1124
         $this->pdf->textBox($x, $y, $w, $h);
1125 1125
 
1126
-        if (! $this->pNotaCancelada()) {
1126
+        if (!$this->pNotaCancelada()) {
1127 1127
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1128 1128
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1129 1129
             $texto = "DANFE";
1130 1130
             $aFont = ['font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'];
1131
-            $this->pdf->textBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1131
+            $this->pdf->textBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1132 1132
             $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1133 1133
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1134 1134
             $h = 20;
1135
-            $this->pdf->textBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1135
+            $this->pdf->textBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1136 1136
         }
1137 1137
 
1138 1138
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1139 1139
         $texto = '0 - ENTRADA';
1140 1140
         $y1 = $y + 14;
1141 1141
         $h = 8;
1142
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1142
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1143 1143
         $texto = '1 - SAÍDA';
1144 1144
         $y1 = $y + 17;
1145
-        $this->pdf->textBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1145
+        $this->pdf->textBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1146 1146
         //tipo de nF
1147 1147
         $aFont = ['font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'];
1148 1148
         $y1 = $y + 13;
1149 1149
         $h = 7;
1150 1150
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1151
-        $this->pdf->textBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1151
+        $this->pdf->textBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1152 1152
         //numero da NF
1153 1153
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1154 1154
         $y1 = $y + 20;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
         //####################################################################################
1171 1171
         //coluna codigo de barras
1172 1172
         $x += $w;
1173
-        $w = ($maxW-$w1-$w2);//85;
1173
+        $w = ($maxW - $w1 - $w2); //85;
1174 1174
         $w3 = $w;
1175 1175
         $h = 32;
1176 1176
         $this->pdf->textBox($x, $y, $w, $h);
@@ -1179,22 +1179,22 @@  discard block
 block discarded – undo
1179 1179
         $bW = 75;
1180 1180
         $bH = 12;
1181 1181
         //codigo de barras
1182
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1182
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1183 1183
         //linhas divisorias
1184
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1185
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1184
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1185
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1186 1186
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1187
-        $y1 = $y+4+$bH;
1187
+        $y1 = $y + 4 + $bH;
1188 1188
         $h = 7;
1189 1189
         $texto = 'CHAVE DE ACESSO';
1190 1190
         $this->pdf->textBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1191 1191
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'];
1192
-        $y1 = $y+8+$bH;
1192
+        $y1 = $y + 8 + $bH;
1193 1193
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1194
-        $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1195
-        $y1 = $y+12+$bH;
1194
+        $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1195
+        $y1 = $y + 12 + $bH;
1196 1196
         $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1197
-        $chaveContingencia="";
1197
+        $chaveContingencia = "";
1198 1198
         if ($this->pNotaDPEC()) {
1199 1199
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1200 1200
         } else {
@@ -1205,16 +1205,16 @@  discard block
 block discarded – undo
1205 1205
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1206 1206
             $this->pdf->SetFillColor(0, 0, 0);
1207 1207
             //codigo de barras
1208
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1208
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1209 1209
         } else {
1210 1210
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1211
-            $this->pdf->textBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1212
-            $y1 = $y+16+$bH;
1211
+            $this->pdf->textBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1212
+            $y1 = $y + 16 + $bH;
1213 1213
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1214 1214
             $this->pdf->textBox(
1215
-                $x+2,
1215
+                $x + 2,
1216 1216
                 $y1,
1217
-                $w-2,
1217
+                $w - 2,
1218 1218
                 $h,
1219 1219
                 $texto,
1220 1220
                 $aFont,
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
         //natureza da operação
1231 1231
         $texto = 'NATUREZA DA OPERAÇÃO';
1232 1232
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1233
-        $w = $w1+$w2;
1233
+        $w = $w1 + $w2;
1234 1234
         $y = $oldY;
1235 1235
         $oldY += $h;
1236 1236
         $x = $oldX;
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
                 $cStat = '';
1261 1261
             } else {
1262 1262
                 if (isset($this->nfeProc)) {
1263
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1263
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1264 1264
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1265 1265
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1266 1266
                     if ($texto != '') {
@@ -1291,25 +1291,25 @@  discard block
 block discarded – undo
1291 1291
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1292 1292
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1293 1293
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1294
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1294
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1295 1295
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1296 1296
              : '';
1297 1297
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1298 1298
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1299 1299
         //CNPJ
1300 1300
         $x += $w;
1301
-        $w = ($maxW-(2*$w));
1301
+        $w = ($maxW - (2 * $w));
1302 1302
         $texto = 'CNPJ / CPF';
1303 1303
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1304 1304
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1305 1305
         //Pegando valor do CPF/CNPJ
1306
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1306
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1307 1307
             $texto = $this->pFormat(
1308 1308
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1309 1309
                 "###.###.###/####-##"
1310 1310
             );
1311 1311
         } else {
1312
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1312
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1313 1313
                 $this->pFormat(
1314 1314
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1315 1315
                     "###.###.###-##"
@@ -1325,9 +1325,9 @@  discard block
 block discarded – undo
1325 1325
         if ($this->pNotaCancelada()) {
1326 1326
             //101 Cancelamento
1327 1327
             $x = 10;
1328
-            $y = $this->hPrint-130;
1328
+            $y = $this->hPrint - 130;
1329 1329
             $h = 25;
1330
-            $w = $maxW-(2*$x);
1330
+            $w = $maxW - (2 * $x);
1331 1331
             $this->pdf->SetTextColor(90, 90, 90);
1332 1332
             $texto = "NFe CANCELADA";
1333 1333
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
@@ -1338,12 +1338,12 @@  discard block
 block discarded – undo
1338 1338
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1339 1339
             //DPEC
1340 1340
             $x = 10;
1341
-            $y = $this->hPrint-130;
1341
+            $y = $this->hPrint - 130;
1342 1342
             $h = 25;
1343
-            $w = $maxW-(2*$x);
1343
+            $w = $maxW - (2 * $x);
1344 1344
             $this->pdf->SetTextColor(200, 200, 200);
1345
-            $texto = "DANFE impresso em contingência -\n".
1346
-                     "DPEC regularmente recebido pela Receita\n".
1345
+            $texto = "DANFE impresso em contingência -\n" .
1346
+                     "DPEC regularmente recebido pela Receita\n" .
1347 1347
                      "Federal do Brasil";
1348 1348
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1349 1349
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1352,22 +1352,22 @@  discard block
 block discarded – undo
1352 1352
         if ($this->pNotaDenegada()) {
1353 1353
             //110 301 302 Denegada
1354 1354
             $x = 10;
1355
-            $y = $this->hPrint-130;
1355
+            $y = $this->hPrint - 130;
1356 1356
             $h = 25;
1357
-            $w = $maxW-(2*$x);
1357
+            $w = $maxW - (2 * $x);
1358 1358
             $this->pdf->SetTextColor(90, 90, 90);
1359 1359
             $texto = "NFe USO DENEGADO";
1360 1360
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1361 1361
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1362 1362
             $y += $h;
1363 1363
             $h = 5;
1364
-            $w = $maxW-(2*$x);
1364
+            $w = $maxW - (2 * $x);
1365 1365
             if (isset($this->infProt)) {
1366 1366
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1367 1367
             } else {
1368 1368
                 $xMotivo = '';
1369 1369
             }
1370
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1370
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1371 1371
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1372 1372
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1373 1373
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1376,29 +1376,29 @@  discard block
 block discarded – undo
1376 1376
         if ($tpAmb != 1) {
1377 1377
             $x = 10;
1378 1378
             if ($this->orientacao == 'P') {
1379
-                $y = round($this->hPrint*2/3, 0);
1379
+                $y = round($this->hPrint * 2 / 3, 0);
1380 1380
             } else {
1381
-                $y = round($this->hPrint/2, 0);
1381
+                $y = round($this->hPrint / 2, 0);
1382 1382
             }
1383 1383
             $h = 5;
1384
-            $w = $maxW-(2*$x);
1384
+            $w = $maxW - (2 * $x);
1385 1385
             $this->pdf->SetTextColor(90, 90, 90);
1386 1386
             $texto = "SEM VALOR FISCAL";
1387 1387
             $aFont = ['font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'];
1388 1388
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1389 1389
             $aFont = ['font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'];
1390 1390
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
1391
-            $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1391
+            $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1392 1392
             $this->pdf->SetTextColor(0, 0, 0);
1393 1393
         } else {
1394 1394
             $x = 10;
1395 1395
             if ($this->orientacao == 'P') {
1396
-                $y = round($this->hPrint*2/3, 0);
1396
+                $y = round($this->hPrint * 2 / 3, 0);
1397 1397
             } else {
1398
-                $y = round($this->hPrint/2, 0);
1398
+                $y = round($this->hPrint / 2, 0);
1399 1399
             }//fim orientacao
1400 1400
             $h = 5;
1401
-            $w = $maxW-(2*$x);
1401
+            $w = $maxW - (2 * $x);
1402 1402
             $this->pdf->SetTextColor(90, 90, 90);
1403 1403
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1404 1404
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
                 $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1409 1409
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'];
1410 1410
                 $texto = "devido à problemas técnicos";
1411
-                $this->pdf->textBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1411
+                $this->pdf->textBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1412 1412
             } else {
1413 1413
                 if (!isset($this->nfeProc)) {
1414 1414
                     if (!$this->pNotaDPEC()) {
@@ -1419,9 +1419,9 @@  discard block
 block discarded – undo
1419 1419
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'];
1420 1420
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1421 1421
                     if (!$this->pNotaDPEC()) {
1422
-                        $this->pdf->textBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1422
+                        $this->pdf->textBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1423 1423
                     } else {
1424
-                        $this->pdf->textBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1424
+                        $this->pdf->textBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1425 1425
                     }
1426 1426
                 }//fim nefProc
1427 1427
             }//fim tpEmis
@@ -1456,7 +1456,7 @@  discard block
 block discarded – undo
1456 1456
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1457 1457
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1458 1458
         //NOME / RAZÃO SOCIAL
1459
-        $w = round($maxW*0.61, 0);
1459
+        $w = round($maxW * 0.61, 0);
1460 1460
         $w1 = $w;
1461 1461
         $y += 3;
1462 1462
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1471,19 +1471,19 @@  discard block
 block discarded – undo
1471 1471
         }
1472 1472
         //CNPJ / CPF
1473 1473
         $x += $w;
1474
-        $w = round($maxW*0.23, 0);
1474
+        $w = round($maxW * 0.23, 0);
1475 1475
         $w2 = $w;
1476 1476
         $texto = 'CNPJ / CPF';
1477 1477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1478 1478
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1479 1479
         //Pegando valor do CPF/CNPJ
1480
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1480
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1481 1481
             $texto = $this->pFormat(
1482 1482
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1483 1483
                 "###.###.###/####-##"
1484 1484
             );
1485 1485
         } else {
1486
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1486
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1487 1487
                     $this->pFormat(
1488 1488
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1489 1489
                         "###.###.###-##"
@@ -1493,15 +1493,15 @@  discard block
 block discarded – undo
1493 1493
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1494 1494
         //DATA DA EMISSÃO
1495 1495
         $x += $w;
1496
-        $w = $maxW-($w1+$w2);
1496
+        $w = $maxW - ($w1 + $w2);
1497 1497
         $wx = $w;
1498 1498
         $texto = 'DATA DA EMISSÃO';
1499 1499
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1500 1500
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1501
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1501
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1502 1502
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1503 1503
         if ($dEmi == '') {
1504
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1504
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1505 1505
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1506 1506
             $aDemi = explode('T', $dEmi);
1507 1507
             $dEmi = $aDemi[0];
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
             $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1515 1515
         }
1516 1516
         //ENDEREÇO
1517
-        $w = round($maxW*0.47, 0);
1517
+        $w = round($maxW * 0.47, 0);
1518 1518
         $w1 = $w;
1519 1519
         $y += $h;
1520 1520
         $x = $oldX;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1530 1530
         //BAIRRO / DISTRITO
1531 1531
         $x += $w;
1532
-        $w = round($maxW*0.21, 0);
1532
+        $w = round($maxW * 0.21, 0);
1533 1533
         $w2 = $w;
1534 1534
         $texto = 'BAIRRO / DISTRITO';
1535 1535
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1539,12 +1539,12 @@  discard block
 block discarded – undo
1539 1539
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1540 1540
         //CEP
1541 1541
         $x += $w;
1542
-        $w = $maxW-$w1-$w2-$wx;
1542
+        $w = $maxW - $w1 - $w2 - $wx;
1543 1543
         $w2 = $w;
1544 1544
         $texto = 'CEP';
1545 1545
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1546 1546
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1547
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1547
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1548 1548
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1549 1549
         $texto = $this->pFormat($texto, "#####-###");
1550 1550
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
@@ -1555,10 +1555,10 @@  discard block
 block discarded – undo
1555 1555
         $texto = 'DATA DA SAÍDA/ENTRADA';
1556 1556
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1557 1557
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1558
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1558
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1559 1559
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1560 1560
         if ($dSaiEnt == '') {
1561
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1561
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1562 1562
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1563 1563
             $aDsaient = explode('T', $dSaiEnt);
1564 1564
             $dSaiEnt = $aDsaient[0];
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1576 1576
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1577 1577
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1578
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1578
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1579 1579
         }
1580 1580
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1581 1581
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1590,18 +1590,18 @@  discard block
 block discarded – undo
1590 1590
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1591 1591
         //FONE / FAX
1592 1592
         $x += $w;
1593
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1593
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1594 1594
         $w3 = $w;
1595 1595
         $texto = 'FONE / FAX';
1596 1596
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1597 1597
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1598
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1598
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1599 1599
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1600 1600
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
1601 1601
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1602 1602
         //INSCRIÇÃO ESTADUAL
1603 1603
         $x += $w;
1604
-        $w = $maxW -$w1-$wx-8-$w3;
1604
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1605 1605
         $texto = 'INSCRIÇÃO ESTADUAL';
1606 1606
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1607 1607
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1615,10 +1615,10 @@  discard block
 block discarded – undo
1615 1615
         $texto = 'HORA DA SAÍDA/ENTRADA';
1616 1616
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1617 1617
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1618
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1618
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1619 1619
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1620 1620
         if ($hSaiEnt == '') {
1621
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1621
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1622 1622
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1623 1623
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1624 1624
             if ($tsDhSaiEnt != '') {
@@ -1697,7 +1697,7 @@  discard block
 block discarded – undo
1697 1697
     protected function pFaturaDANFE($x, $y)
1698 1698
     {
1699 1699
         $linha = 1;
1700
-        $h = 8+3;
1700
+        $h = 8 + 3;
1701 1701
         $oldx = $x;
1702 1702
         $textoFatura = $this->pGetTextoFatura();
1703 1703
         //verificar se existem duplicatas
@@ -1718,27 +1718,27 @@  discard block
 block discarded – undo
1718 1718
             $dupcont = 0;
1719 1719
             $nFat = $this->dup->length;
1720 1720
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1721
-                $myH=6;
1721
+                $myH = 6;
1722 1722
                 $myW = $this->wPrint;
1723 1723
                 if ($this->orientacao == 'L') {
1724 1724
                     $myW -= $this->wCanhoto;
1725 1725
                 }
1726 1726
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>''];
1727 1727
                 $this->pdf->textBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1728
-                $y+=$myH+1;
1728
+                $y += $myH + 1;
1729 1729
             }
1730 1730
             if ($this->orientacao == 'P') {
1731
-                $w = round($this->wPrint/7.018, 0)-1;
1731
+                $w = round($this->wPrint / 7.018, 0) - 1;
1732 1732
             } else {
1733 1733
                 $w = 28;
1734 1734
             }
1735 1735
             $increm = 1;
1736 1736
             foreach ($this->dup as $k => $d) {
1737
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1737
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1738 1738
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1739
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1739
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1740 1740
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1741
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1741
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1742 1742
                         'R$ ' . number_format(
1743 1743
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1744 1744
                             2,
@@ -1747,14 +1747,14 @@  discard block
 block discarded – undo
1747 1747
                         ) : '';
1748 1748
                 $h = 8;
1749 1749
                 $texto = '';
1750
-                if ($nDup!='0' && $nDup!='') {
1750
+                if ($nDup != '0' && $nDup != '') {
1751 1751
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1752 1752
                     $this->pdf->textBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1753 1753
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1754 1754
                     $this->pdf->textBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1755 1755
                 } else {
1756 1756
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1757
-                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1757
+                    $this->pdf->textBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1758 1758
                 }
1759 1759
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1760 1760
                 $this->pdf->textBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1765 1765
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1766 1766
                 $this->pdf->textBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1767
-                $x += $w+$increm;
1767
+                $x += $w + $increm;
1768 1768
                 $dupcont += 1;
1769 1769
                 if ($this->orientacao == 'P') {
1770 1770
                     $maxDupCont = 6;
@@ -1786,10 +1786,10 @@  discard block
 block discarded – undo
1786 1786
                 $y -= 9;
1787 1787
                 $linha--;
1788 1788
             }
1789
-            return ($y+$h);
1789
+            return ($y + $h);
1790 1790
         } else {
1791 1791
             $linha = 0;
1792
-            return ($y-2);
1792
+            return ($y - 2);
1793 1793
         }
1794 1794
     } //fim da função faturaDANFE
1795 1795
 
@@ -1805,7 +1805,7 @@  discard block
 block discarded – undo
1805 1805
     protected function pagamentoDANFE($x, $y)
1806 1806
     {
1807 1807
         $linha = 1;
1808
-        $h = 8+3;
1808
+        $h = 8 + 3;
1809 1809
         $oldx = $x;
1810 1810
         //verificar se existem cobranças definidas
1811 1811
         if (isset($this->detPag) && $this->detPag->length > 0) {
@@ -1824,7 +1824,7 @@  discard block
 block discarded – undo
1824 1824
             $dups = "";
1825 1825
             $dupcont = 0;
1826 1826
             if ($this->orientacao == 'P') {
1827
-                $w = round($this->wPrint/7.018, 0)-1;
1827
+                $w = round($this->wPrint / 7.018, 0) - 1;
1828 1828
             } else {
1829 1829
                 $w = 28;
1830 1830
             }
@@ -1834,16 +1834,16 @@  discard block
 block discarded – undo
1834 1834
                 $maxDupCont = 8;
1835 1835
             }
1836 1836
             $increm = 1;
1837
-            $formaPagamento = ['01'=>'Dinheiro','02'=>'Cheque','03'=>'Cartão de Crédito',
1838
-                                    '04'=>'Cartão de Débito','05'=>'Crédito Loja','10'=>'Vale Alimentação',
1839
-                                    '11'=>'Vale Refeição','12'=>'Vale Presente','13'=>'Vale Combustível',
1840
-                                    '14'=>'Duplicata Mercantil','15'=>'Boleto','90'=>'Sem pagamento','99'=>'Outros'];
1841
-            $bandeira = ['01'=>'Visa','02'=>'Mastercard','03'=>'American','04'=>'Sorocred','05'=>'Diners',
1842
-                              '06'=>'Elo','07'=>'Hipercard','08'=>'Aura','09'=>'Cabal','99'=>'Outros'];
1837
+            $formaPagamento = ['01'=>'Dinheiro', '02'=>'Cheque', '03'=>'Cartão de Crédito',
1838
+                                    '04'=>'Cartão de Débito', '05'=>'Crédito Loja', '10'=>'Vale Alimentação',
1839
+                                    '11'=>'Vale Refeição', '12'=>'Vale Presente', '13'=>'Vale Combustível',
1840
+                                    '14'=>'Duplicata Mercantil', '15'=>'Boleto', '90'=>'Sem pagamento', '99'=>'Outros'];
1841
+            $bandeira = ['01'=>'Visa', '02'=>'Mastercard', '03'=>'American', '04'=>'Sorocred', '05'=>'Diners',
1842
+                              '06'=>'Elo', '07'=>'Hipercard', '08'=>'Aura', '09'=>'Cabal', '99'=>'Outros'];
1843 1843
             foreach ($this->detPag as $k => $d) {
1844 1844
                 $fPag = !empty($this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue)
1845 1845
                     ? $this->detPag->item($k)->getElementsByTagName('tPag')->item(0)->nodeValue : '0';
1846
-                $vPag = ! empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1846
+                $vPag = !empty($this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue)
1847 1847
                     ? 'R$ ' . number_format(
1848 1848
                         $this->detPag->item($k)->getElementsByTagName('vPag')->item(0)->nodeValue,
1849 1849
                         2,
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
                 $texto = '';
1855 1855
                 if (isset($formaPagamento[$fPag])) {
1856 1856
                     /*Exibir Item sem pagamento ou outros?*/
1857
-                    if ($fPag=='90' || $fPag=='99') {
1857
+                    if ($fPag == '90' || $fPag == '99') {
1858 1858
                         continue;
1859 1859
                     }
1860 1860
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
@@ -1863,16 +1863,16 @@  discard block
 block discarded – undo
1863 1863
                     $this->pdf->textBox($x, $y, $w, $h, $formaPagamento[$fPag], $aFont, 'T', 'R', 0, '');
1864 1864
                 } else {
1865 1865
                     $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
1866
-                    $this->pdf->textBox($x, $y, $w, $h, "Forma ".$fPag." não encontrado", $aFont, 'T', 'L', 1, '');
1866
+                    $this->pdf->textBox($x, $y, $w, $h, "Forma " . $fPag . " não encontrado", $aFont, 'T', 'L', 1, '');
1867 1867
                 }
1868 1868
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
1869 1869
                 $this->pdf->textBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1870 1870
                 $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
1871 1871
                 $this->pdf->textBox($x, $y, $w, $h, $vPag, $aFont, 'B', 'R', 0, '');
1872
-                $x += $w+$increm;
1872
+                $x += $w + $increm;
1873 1873
                 $dupcont += 1;
1874 1874
 
1875
-                if ($dupcont>$maxDupCont) {
1875
+                if ($dupcont > $maxDupCont) {
1876 1876
                     $y += 9;
1877 1877
                     $x = $oldx;
1878 1878
                     $dupcont = 0;
@@ -1887,10 +1887,10 @@  discard block
 block discarded – undo
1887 1887
                 $y -= 9;
1888 1888
                 $linha--;
1889 1889
             }
1890
-            return ($y+$h);
1890
+            return ($y + $h);
1891 1891
         } else {
1892 1892
             $linha = 0;
1893
-            return ($y-2);
1893
+            return ($y - 2);
1894 1894
         }
1895 1895
     } //fim da função pagamentoDANFE
1896 1896
     
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
         }
2003 2003
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
2004 2004
 
2005
-        return ($y+$h);
2005
+        return ($y + $h);
2006 2006
     } //fim impostoDANFE
2007 2007
 
2008 2008
     /**
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2031 2031
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2032 2032
         //NOME / RAZÃO SOCIAL
2033
-        $w1 = $maxW*0.29;
2033
+        $w1 = $maxW * 0.29;
2034 2034
         $y += 3;
2035 2035
         $texto = 'NOME / RAZÃO SOCIAL';
2036 2036
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2037 2037
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2038 2038
         if (isset($this->transporta)) {
2039
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2039
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
2040 2040
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
2041 2041
         } else {
2042 2042
             $texto = '';
@@ -2045,11 +2045,11 @@  discard block
 block discarded – undo
2045 2045
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2046 2046
         //FRETE POR CONTA
2047 2047
         $x += $w1;
2048
-        $w2 = $maxW*0.15;
2048
+        $w2 = $maxW * 0.15;
2049 2049
         $texto = 'FRETE';
2050 2050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2051 2051
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2052
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2052
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
2053 2053
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
2054 2054
         switch ($tipoFrete) {
2055 2055
             case 0:
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2080 2080
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2081 2081
         if (isset($this->veicTransp)) {
2082
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2082
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
2083 2083
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
2084 2084
         } else {
2085 2085
             $texto = '';
@@ -2092,10 +2092,10 @@  discard block
 block discarded – undo
2092 2092
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2093 2093
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2094 2094
         if (isset($this->veicTransp)) {
2095
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2095
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
2096 2096
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
2097 2097
         } elseif (isset($this->reboque)) {
2098
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2098
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
2099 2099
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
2100 2100
         } else {
2101 2101
             $texto = '';
@@ -2104,15 +2104,15 @@  discard block
 block discarded – undo
2104 2104
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2105 2105
         //UF
2106 2106
         $x += $w2;
2107
-        $w3 = round($maxW*0.04, 0);
2107
+        $w3 = round($maxW * 0.04, 0);
2108 2108
         $texto = 'UF';
2109 2109
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2110 2110
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2111 2111
         if (isset($this->veicTransp)) {
2112
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2112
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
2113 2113
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
2114 2114
         } elseif (isset($this->reboque)) {
2115
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2115
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
2116 2116
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
2117 2117
         } else {
2118 2118
             $texto = '';
@@ -2121,18 +2121,18 @@  discard block
 block discarded – undo
2121 2121
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2122 2122
         //CNPJ / CPF
2123 2123
         $x += $w3;
2124
-        $w = $maxW-($w1+3*$w2+$w3);
2124
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2125 2125
         $texto = 'CNPJ / CPF';
2126 2126
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2127 2127
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2128 2128
         if (isset($this->transporta)) {
2129
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2129
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2130 2130
                     $this->pFormat(
2131 2131
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2132 2132
                         "##.###.###/####-##"
2133 2133
                     ) : '';
2134 2134
             if ($texto == '') {
2135
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2135
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2136 2136
                         $this->pFormat(
2137 2137
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2138 2138
                             "###.###.###-##"
@@ -2148,12 +2148,12 @@  discard block
 block discarded – undo
2148 2148
         $y += $h;
2149 2149
         $x = $oldX;
2150 2150
         $h = 7;
2151
-        $w1 = $maxW*0.44;
2151
+        $w1 = $maxW * 0.44;
2152 2152
         $texto = 'ENDEREÇO';
2153 2153
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2154 2154
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2155 2155
         if (isset($this->transporta)) {
2156
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2156
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2157 2157
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2158 2158
         } else {
2159 2159
             $texto = '';
@@ -2162,12 +2162,12 @@  discard block
 block discarded – undo
2162 2162
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2163 2163
         //MUNICÍPIO
2164 2164
         $x += $w1;
2165
-        $w2 = round($maxW*0.30, 0);
2165
+        $w2 = round($maxW * 0.30, 0);
2166 2166
         $texto = 'MUNICÍPIO';
2167 2167
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2168 2168
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2169 2169
         if (isset($this->transporta)) {
2170
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2170
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2171 2171
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2172 2172
         } else {
2173 2173
             $texto = '';
@@ -2176,12 +2176,12 @@  discard block
 block discarded – undo
2176 2176
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2177 2177
         //UF
2178 2178
         $x += $w2;
2179
-        $w3 = round($maxW*0.04, 0);
2179
+        $w3 = round($maxW * 0.04, 0);
2180 2180
         $texto = 'UF';
2181 2181
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2182 2182
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2183 2183
         if (isset($this->transporta)) {
2184
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2184
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2185 2185
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2186 2186
         } else {
2187 2187
             $texto = '';
@@ -2190,13 +2190,13 @@  discard block
 block discarded – undo
2190 2190
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2191 2191
         //INSCRIÇÃO ESTADUAL
2192 2192
         $x += $w3;
2193
-        $w = $maxW-($w1+$w2+$w3);
2193
+        $w = $maxW - ($w1 + $w2 + $w3);
2194 2194
         $texto = 'INSCRIÇÃO ESTADUAL';
2195 2195
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2196 2196
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2197 2197
         $texto = '';
2198 2198
         if (isset($this->transporta)) {
2199
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2199
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2200 2200
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2201 2201
             }
2202 2202
         }
@@ -2209,16 +2209,16 @@  discard block
 block discarded – undo
2209 2209
         $marca = '';
2210 2210
         $numero = '';
2211 2211
         $texto = '';
2212
-        $pesoBruto=0;
2213
-        $pesoLiquido=0;
2212
+        $pesoBruto = 0;
2213
+        $pesoLiquido = 0;
2214 2214
         foreach ($volumes as $volume) {
2215
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2215
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2216 2216
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2217
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2217
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2218 2218
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2219
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2219
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2220 2220
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2221
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2221
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2222 2222
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2223 2223
             if ($texto != $especie && $especie != '') {
2224 2224
                 //tem várias especies
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
             } else {
2227 2227
                 $especie = $texto;
2228 2228
             }
2229
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2229
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2230 2230
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2231 2231
             if ($texto != $marca && $marca != '') {
2232 2232
                 //tem várias especies
@@ -2234,7 +2234,7 @@  discard block
 block discarded – undo
2234 2234
             } else {
2235 2235
                 $marca = $texto;
2236 2236
             }
2237
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2237
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2238 2238
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2239 2239
             if ($texto != $numero && $numero != '') {
2240 2240
                 //tem várias especies
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
         $y += $h;
2250 2250
         $x = $oldX;
2251 2251
         $h = 7;
2252
-        $w1 = round($maxW*0.10, 0);
2252
+        $w1 = round($maxW * 0.10, 0);
2253 2253
         $texto = 'QUANTIDADE';
2254 2254
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2255 2255
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
         }
2261 2261
         //ESPÉCIE
2262 2262
         $x += $w1;
2263
-        $w2 = round($maxW*0.17, 0);
2263
+        $w2 = round($maxW * 0.17, 0);
2264 2264
         $texto = 'ESPÉCIE';
2265 2265
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2266 2266
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
         $texto = 'MARCA';
2273 2273
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2274 2274
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2275
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2275
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2276 2276
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2277 2277
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2278 2278
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2286,7 +2286,7 @@  discard block
 block discarded – undo
2286 2286
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2287 2287
         //PESO BRUTO
2288 2288
         $x += $w2;
2289
-        $w3 = round($maxW*0.20, 0);
2289
+        $w3 = round($maxW * 0.20, 0);
2290 2290
         $texto = 'PESO BRUTO';
2291 2291
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2292 2292
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2300 2300
         //PESO LÍQUIDO
2301 2301
         $x += $w3;
2302
-        $w = $maxW -($w1+3*$w2+$w3);
2302
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2303 2303
         $texto = 'PESO LÍQUIDO';
2304 2304
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2305 2305
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
         }
2311 2311
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2312 2312
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2313
-        return ($y+$h);
2313
+        return ($y + $h);
2314 2314
     } //fim transporteDANFE
2315 2315
 
2316 2316
 
@@ -2322,7 +2322,7 @@  discard block
 block discarded – undo
2322 2322
             return "";
2323 2323
         }
2324 2324
         $valor_original = $valor_original->nodeValue;
2325
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2325
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2326 2326
 
2327 2327
         if ($valor != "") {
2328 2328
             return sprintf($formato, $valor);
@@ -2369,13 +2369,13 @@  discard block
 block discarded – undo
2369 2369
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2370 2370
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2371 2371
         }
2372
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2372
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2373 2373
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2374
-        if (! empty($infAdProd)) {
2374
+        if (!empty($infAdProd)) {
2375 2375
             $infAdProd = trim($infAdProd);
2376 2376
             $infAdProd .= ' ';
2377 2377
         }
2378
-        $loteTxt ='';
2378
+        $loteTxt = '';
2379 2379
         $rastro = $prod->getElementsByTagName("med");
2380 2380
         if (!isset($rastro)) {
2381 2381
             $rastro = $prod->getElementsByTagName("rastro");
@@ -2391,14 +2391,14 @@  discard block
 block discarded – undo
2391 2391
                 $i++;
2392 2392
             }
2393 2393
             if ($loteTxt != '') {
2394
-                $loteTxt.= ' ';
2394
+                $loteTxt .= ' ';
2395 2395
             }
2396 2396
         }
2397 2397
         //NT2013.006 FCI
2398
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2399
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2400
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2401
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2398
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2399
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2400
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $loteTxt . $impostos . $nFCI : '');
2401
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2402 2402
         //decodifica os caracteres html no xml
2403 2403
         $texto = html_entity_decode($texto);
2404 2404
         if ($this->descProdQuebraLinha) {
@@ -2448,104 +2448,104 @@  discard block
 block discarded – undo
2448 2448
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2449 2449
         //CÓDIGO PRODUTO
2450 2450
         $texto = "CÓDIGO PRODUTO";
2451
-        $w1 = round($w*0.09, 0);
2451
+        $w1 = round($w * 0.09, 0);
2452 2452
         $h = 4;
2453 2453
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2454 2454
         $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2455
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2455
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2456 2456
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2457 2457
         $x += $w1;
2458
-        $w2 = round($w*0.28, 0);
2458
+        $w2 = round($w * 0.28, 0);
2459 2459
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2460 2460
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2461 2461
         $this->pdf->textBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2462
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2462
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2463 2463
         //NCM/SH
2464 2464
         $x += $w2;
2465
-        $w3 = round($w*0.06, 0);
2465
+        $w3 = round($w * 0.06, 0);
2466 2466
         $texto = 'NCM/SH';
2467 2467
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2468 2468
         $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2469
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2469
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2470 2470
         //O/CST ou O/CSOSN
2471 2471
         $x += $w3;
2472
-        $w4 = round($w*0.05, 0);
2473
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2472
+        $w4 = round($w * 0.05, 0);
2473
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2474 2474
         if ($this->getTagValue($this->emit, 'CRT') == '3') {
2475
-             $texto = 'O/CST';//Regime Normal
2475
+             $texto = 'O/CST'; //Regime Normal
2476 2476
         }
2477 2477
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2478 2478
         $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2479
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2479
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2480 2480
         //CFOP
2481 2481
         $x += $w4;
2482
-        $w5 = round($w*0.04, 0);
2482
+        $w5 = round($w * 0.04, 0);
2483 2483
         $texto = 'CFOP';
2484 2484
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2485 2485
         $this->pdf->textBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2486
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2486
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2487 2487
         //UN
2488 2488
         $x += $w5;
2489
-        $w6 = round($w*0.03, 0);
2489
+        $w6 = round($w * 0.03, 0);
2490 2490
         $texto = 'UN';
2491 2491
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2492 2492
         $this->pdf->textBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2493
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2493
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2494 2494
         //QUANT
2495 2495
         $x += $w6;
2496
-        $w7 = round($w*0.07, 0);
2496
+        $w7 = round($w * 0.07, 0);
2497 2497
         $texto = 'QUANT';
2498 2498
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2499 2499
         $this->pdf->textBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2500
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2500
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2501 2501
         //VALOR UNIT
2502 2502
         $x += $w7;
2503
-        $w8 = round($w*0.06, 0);
2503
+        $w8 = round($w * 0.06, 0);
2504 2504
         $texto = 'VALOR UNIT';
2505 2505
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2506 2506
         $this->pdf->textBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2507
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2507
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2508 2508
         //VALOR TOTAL
2509 2509
         $x += $w8;
2510
-        $w9 = round($w*0.06, 0);
2510
+        $w9 = round($w * 0.06, 0);
2511 2511
         $texto = 'VALOR TOTAL';
2512 2512
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2513 2513
         $this->pdf->textBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2514
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2514
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2515 2515
         //B.CÁLC ICMS
2516 2516
         $x += $w9;
2517
-        $w10 = round($w*0.06, 0);
2517
+        $w10 = round($w * 0.06, 0);
2518 2518
         $texto = 'B.CÁLC ICMS';
2519 2519
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2520 2520
         $this->pdf->textBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2521
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2521
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2522 2522
         //VALOR ICMS
2523 2523
         $x += $w10;
2524
-        $w11 = round($w*0.06, 0);
2524
+        $w11 = round($w * 0.06, 0);
2525 2525
         $texto = 'VALOR ICMS';
2526 2526
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2527 2527
         $this->pdf->textBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2528
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2528
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2529 2529
         //VALOR IPI
2530 2530
         $x += $w11;
2531
-        $w12 = round($w*0.05, 0);
2531
+        $w12 = round($w * 0.05, 0);
2532 2532
         $texto = 'VALOR IPI';
2533 2533
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2534 2534
         $this->pdf->textBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2535
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2535
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2536 2536
         //ALÍQ. ICMS
2537 2537
         $x += $w12;
2538
-        $w13 = round($w*0.035, 0);
2538
+        $w13 = round($w * 0.035, 0);
2539 2539
         $texto = 'ALÍQ. ICMS';
2540 2540
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2541 2541
         $this->pdf->textBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2542
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2542
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2543 2543
         //ALÍQ. IPI
2544 2544
         $x += $w13;
2545
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2545
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2546 2546
         $texto = 'ALÍQ. IPI';
2547 2547
         $this->pdf->textBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2548
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2548
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2549 2549
         $y += 5;
2550 2550
         //##################################################################################
2551 2551
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
                 $textoProduto = trim($this->pDescricaoProduto($thisItem));
2564 2564
 
2565 2565
                 $linhaDescr = $this->pdf->getNumLines($textoProduto, $w2, $aFont);
2566
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2566
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2567 2567
                 $hUsado += $h;
2568 2568
 
2569 2569
                 $diffH = $hmax - $hUsado;
@@ -2576,11 +2576,11 @@  discard block
 block discarded – undo
2576 2576
                         break;
2577 2577
                     }
2578 2578
                 }
2579
-                $y_linha=$y+$h;
2579
+                $y_linha = $y + $h;
2580 2580
                 // linha entre itens
2581 2581
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2582 2582
                 //corrige o x
2583
-                $x=$oldX;
2583
+                $x = $oldX;
2584 2584
                 //codigo do produto
2585 2585
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2586 2586
                 $this->pdf->textBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2593,16 +2593,16 @@  discard block
 block discarded – undo
2593 2593
                 }
2594 2594
                 $x += $w2;
2595 2595
                 //NCM
2596
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2596
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2597 2597
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2598 2598
                 $this->pdf->textBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2599 2599
                 $x += $w3;
2600 2600
                 //CST
2601 2601
                 if (isset($ICMS)) {
2602
-                    $origem =  $this->getTagValue($ICMS, "orig");
2603
-                    $cst =  $this->getTagValue($ICMS, "CST");
2604
-                    $csosn =  $this->getTagValue($ICMS, "CSOSN");
2605
-                    $texto = $origem.$cst.$csosn;
2602
+                    $origem = $this->getTagValue($ICMS, "orig");
2603
+                    $cst = $this->getTagValue($ICMS, "CST");
2604
+                    $csosn = $this->getTagValue($ICMS, "CSOSN");
2605
+                    $texto = $origem . $cst . $csosn;
2606 2606
                     $this->pdf->textBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2607 2607
                 }
2608 2608
                 //CFOP
@@ -2636,7 +2636,7 @@  discard block
 block discarded – undo
2636 2636
                 //Valor da Base de calculo
2637 2637
                 $x += $w9;
2638 2638
                 if (isset($ICMS)) {
2639
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2639
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2640 2640
                             number_format(
2641 2641
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2642 2642
                                 2,
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
                 //Valor do ICMS
2649 2649
                 $x += $w10;
2650 2650
                 if (isset($ICMS)) {
2651
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2651
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2652 2652
                             number_format(
2653 2653
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2654 2654
                                 2,
@@ -2660,8 +2660,8 @@  discard block
 block discarded – undo
2660 2660
                 //Valor do IPI
2661 2661
                 $x += $w11;
2662 2662
                 if (isset($IPI)) {
2663
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2664
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2663
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2664
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2665 2665
                 } else {
2666 2666
                     $texto = '';
2667 2667
                 }
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
                 // %ICMS
2670 2670
                 $x += $w12;
2671 2671
                 if (isset($ICMS)) {
2672
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2672
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2673 2673
                             number_format(
2674 2674
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2675 2675
                                 2,
@@ -2681,7 +2681,7 @@  discard block
 block discarded – undo
2681 2681
                 //%IPI
2682 2682
                 $x += $w13;
2683 2683
                 if (isset($IPI)) {
2684
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2684
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2685 2685
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2686 2686
                 } else {
2687 2687
                     $texto = '';
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
                 $i++;
2707 2707
             }
2708 2708
         }
2709
-        return $oldY+$hmax;
2709
+        return $oldY + $hmax;
2710 2710
     }
2711 2711
 
2712 2712
 
@@ -2740,7 +2740,7 @@  discard block
 block discarded – undo
2740 2740
 
2741 2741
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
2742 2742
 
2743
-        $w1 = round($w*0.09, 0);
2743
+        $w1 = round($w * 0.09, 0);
2744 2744
 
2745 2745
         // Tabela Renavam Combustivel
2746 2746
         $renavamCombustivel = [
@@ -2837,54 +2837,54 @@  discard block
 block discarded – undo
2837 2837
 
2838 2838
         $yVeic = $y + $h;
2839 2839
         $texto = 'Chassi: ............: ' . $veiculoChassi;
2840
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2840
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2841 2841
         $yVeic += $h;
2842 2842
         $texto = 'Cor...................: ' . $veiculoCor;
2843
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2843
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2844 2844
         $yVeic += $h;
2845 2845
         $texto = 'Cilindrada........: ' . $veiculoCilindrada;
2846
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2846
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2847 2847
         $yVeic += $h;
2848 2848
         $texto = 'Cmkg...............: ' . $veiculoCmkg;
2849
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2849
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2850 2850
         $yVeic += $h;
2851 2851
         $texto = 'Tipo.................: ' . $renavamTiposVeiculos[intval($veiculoTipo)];
2852
-        $this->pdf->textBox($x, $yVeic, $w1+40, $h, $texto, $aFont, 'T', 'L', 0, '');
2852
+        $this->pdf->textBox($x, $yVeic, $w1 + 40, $h, $texto, $aFont, 'T', 'L', 0, '');
2853 2853
         $yVeic = $y + $h;
2854 2854
         $xVeic = $x + 65;
2855 2855
         $texto = 'Nº Motor: .........: ' . $veiculoMotor;
2856
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2856
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2857 2857
         $yVeic += $h;
2858 2858
         $texto = 'Renavam...........: ' . $veiculoRenavam;
2859
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2859
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2860 2860
         $yVeic += $h;
2861 2861
         $texto = 'HP.....................: ' . $veiculoHp;
2862
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2862
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2863 2863
         $yVeic += $h;
2864 2864
         $texto = 'Placa.................: ' . $veiculoPlaca;
2865
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2865
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2866 2866
         $yVeic += $h;
2867 2867
         $texto = 'Tipo Pintura......: ' . $renavamTipoPintura[$veiculoTipoPintura];
2868
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2868
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2869 2869
         $yVeic = $y + $h;
2870 2870
         $xVeic = $xVeic + 55;
2871 2871
         $texto = 'Marca / Modelo.....: ' . $veiculoMarcaModelo;
2872
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2872
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2873 2873
         $yVeic += $h;
2874 2874
         $texto = 'Especie..................: ' . $renavamEspecie[intval($veiculoEspecie)];
2875
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2875
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2876 2876
         $yVeic += $h;
2877 2877
         $texto = 'Combustivel..........: ' . $renavamCombustivel[intval($veiculoCombustivel)];
2878
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2878
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2879 2879
         $yVeic += $h;
2880 2880
         $texto = 'Serial.....................: ' . $veiculoSerial;
2881
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2881
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2882 2882
         $yVeic += $h;
2883
-        $texto = 'Ano Fab/Mod........: '. $veiculoFabricacao . '/' . $veiculoModelo;
2884
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2883
+        $texto = 'Ano Fab/Mod........: ' . $veiculoFabricacao . '/' . $veiculoModelo;
2884
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2885 2885
         $yVeic += $h;
2886
-        $texto = 'Distancia Entre Eixos(mm)..: '. $veiculoDistancia;
2887
-        $this->pdf->textBox($xVeic, $yVeic, $w1+50, $h, $texto, $aFont, 'T', 'L', 0, '');
2886
+        $texto = 'Distancia Entre Eixos(mm)..: ' . $veiculoDistancia;
2887
+        $this->pdf->textBox($xVeic, $yVeic, $w1 + 50, $h, $texto, $aFont, 'T', 'L', 0, '');
2888 2888
     }
2889 2889
 
2890 2890
     /**
@@ -2908,12 +2908,12 @@  discard block
 block discarded – undo
2908 2908
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2909 2909
         //INSCRIÇÃO MUNICIPAL
2910 2910
         $y += 3;
2911
-        $w = round($this->wPrint*0.23, 0);
2911
+        $w = round($this->wPrint * 0.23, 0);
2912 2912
         $texto = 'INSCRIÇÃO MUNICIPAL';
2913 2913
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2914 2914
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2915 2915
         //inscrição municipal
2916
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2916
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2917 2917
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2918 2918
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2919 2919
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2923,7 +2923,7 @@  discard block
 block discarded – undo
2923 2923
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2924 2924
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2925 2925
         if (isset($this->ISSQNtot)) {
2926
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2926
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2927 2927
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2928 2928
             $texto = number_format($texto, 2, ",", ".");
2929 2929
         } else {
@@ -2937,9 +2937,9 @@  discard block
 block discarded – undo
2937 2937
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2938 2938
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2939 2939
         if (isset($this->ISSQNtot)) {
2940
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2940
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2941 2941
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2942
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2942
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2943 2943
         } else {
2944 2944
             $texto = '';
2945 2945
         }
@@ -2950,21 +2950,21 @@  discard block
 block discarded – undo
2950 2950
         if ($this->orientacao == 'P') {
2951 2951
             $w = $this->wPrint - (3 * $w);
2952 2952
         } else {
2953
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2953
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2954 2954
         }
2955 2955
         $texto = 'VALOR TOTAL DO ISSQN';
2956 2956
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
2957 2957
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2958 2958
         if (isset($this->ISSQNtot)) {
2959
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2959
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2960 2960
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2961
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2961
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2962 2962
         } else {
2963 2963
             $texto = '';
2964 2964
         }
2965 2965
         $aFont = ['font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'];
2966 2966
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2967
-        return ($y+$h+1);
2967
+        return ($y + $h + 1);
2968 2968
     }
2969 2969
 
2970 2970
     /**
@@ -2985,7 +2985,7 @@  discard block
 block discarded – undo
2985 2985
         if ($this->orientacao == 'P') {
2986 2986
               $w = $this->wPrint;
2987 2987
         } else {
2988
-              $w = $this->wPrint-$this->wCanhoto;
2988
+              $w = $this->wPrint - $this->wCanhoto;
2989 2989
         }
2990 2990
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'];
2991 2991
         $this->pdf->textBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -3001,15 +3001,15 @@  discard block
 block discarded – undo
3001 3001
         //$this->textoAdic com o texto completo do campo
3002 3002
         $y += 1;
3003 3003
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3004
-        $this->pdf->textBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3004
+        $this->pdf->textBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
3005 3005
         //RESERVADO AO FISCO
3006 3006
         $texto = "RESERVADO AO FISCO";
3007 3007
         $x += $w;
3008 3008
         $y -= 1;
3009 3009
         if ($this->orientacao == 'P') {
3010
-            $w = $this->wPrint-$w;
3010
+            $w = $this->wPrint - $w;
3011 3011
         } else {
3012
-            $w = $this->wPrint-$w-$this->wCanhoto;
3012
+            $w = $this->wPrint - $w - $this->wCanhoto;
3013 3013
         }
3014 3014
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'];
3015 3015
         $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -3048,8 +3048,8 @@  discard block
 block discarded – undo
3048 3048
         }
3049 3049
         $y += 2;
3050 3050
         $aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>''];
3051
-        $this->pdf->textBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
3052
-        return $y+$h;
3051
+        $this->pdf->textBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
3052
+        return $y + $h;
3053 3053
     }
3054 3054
 
3055 3055
     /**
@@ -3067,13 +3067,13 @@  discard block
 block discarded – undo
3067 3067
         if ($this->orientacao == 'P') {
3068 3068
               $w = $this->wPrint;
3069 3069
         } else {
3070
-              $w = $this->wPrint-$this->wCanhoto;
3070
+              $w = $this->wPrint - $this->wCanhoto;
3071 3071
               $x = $this->wCanhoto;
3072 3072
         }
3073 3073
         $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'];
3074
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
3074
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
3075 3075
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
3076
-        $texto = $this->creditos .  "  Powered by NFePHP";
3076
+        $texto = $this->creditos . "  Powered by NFePHP";
3077 3077
         $this->pdf->textBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
3078 3078
     }
3079 3079
 
@@ -3126,9 +3126,9 @@  discard block
 block discarded – undo
3126 3126
         } else {
3127 3127
             //linha separadora do canhoto - 238
3128 3128
             //posicao altura
3129
-            $y = $this->wPrint-85;
3129
+            $y = $this->wPrint - 85;
3130 3130
             //altura
3131
-            $w = $this->wPrint-85-24;
3131
+            $w = $this->wPrint - 85 - 24;
3132 3132
         }
3133 3133
         $h = 10;
3134 3134
         //desenha caixa
@@ -3151,21 +3151,21 @@  discard block
 block discarded – undo
3151 3151
             $texto .= "AO LADO";
3152 3152
         }
3153 3153
         $texto .= ". EMISSÃO: ";
3154
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3154
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3155 3155
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3156 3156
         if ($dEmi == '') {
3157
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3157
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3158 3158
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3159 3159
             $aDemi = explode('T', $dEmi);
3160 3160
             $dEmi = $aDemi[0];
3161 3161
         }
3162
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
3162
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
3163 3163
         $texto .= "VALOR TOTAL: R$ ";
3164 3164
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
3165 3165
         $texto .= "DESTINATÁRIO: ";
3166 3166
         $texto .= $destinatario;
3167 3167
         if ($this->orientacao == 'P') {
3168
-            $this->pdf->textBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3168
+            $this->pdf->textBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
3169 3169
             $x1 = $x + $w;
3170 3170
             $w1 = $this->wPrint - $w;
3171 3171
             $texto = "NF-e";
@@ -3178,12 +3178,12 @@  discard block
 block discarded – undo
3178 3178
             //DATA DE RECEBIMENTO
3179 3179
             $texto = "DATA DE RECEBIMENTO";
3180 3180
             $y += $h;
3181
-            $w2 = round($this->wPrint*0.17, 0); //35;
3181
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3182 3182
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3183 3183
             $this->pdf->textBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3184 3184
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3185 3185
             $x += $w2;
3186
-            $w3 = $w-$w2;
3186
+            $w3 = $w - $w2;
3187 3187
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3188 3188
             $this->pdf->textBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3189 3189
             $x = $oldX;
@@ -3193,7 +3193,7 @@  discard block
 block discarded – undo
3193 3193
             return $y;
3194 3194
         } else {
3195 3195
             $x--;
3196
-            $x = $this->pdf->textBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3196
+            $x = $this->pdf->textBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
3197 3197
             //NUMERO DA NOTA FISCAL LOGO NFE
3198 3198
             $w1 = 18;
3199 3199
             $x1 = $oldX;
@@ -3207,18 +3207,18 @@  discard block
 block discarded – undo
3207 3207
             $this->pdf->textBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
3208 3208
             //DATA DO RECEBIMENTO
3209 3209
             $texto = "DATA DO RECEBIMENTO";
3210
-            $y = $this->wPrint-85;
3210
+            $y = $this->wPrint - 85;
3211 3211
             $x = 12;
3212
-            $w2 = round($this->wPrint*0.17, 0); //35;
3212
+            $w2 = round($this->wPrint * 0.17, 0); //35;
3213 3213
             $aFont = ['font'=>$this->fontePadrao, 'size'=>6, 'style'=>''];
3214 3214
             $this->pdf->textBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
3215 3215
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
3216 3216
             $y -= $w2;
3217
-            $w3 = $w-$w2;
3217
+            $w3 = $w - $w2;
3218 3218
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
3219 3219
             $aFont = ['font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''];
3220 3220
             $x = $this->pdf->textBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
3221
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
3221
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
3222 3222
             return $x;
3223 3223
         }
3224 3224
     }
@@ -3235,13 +3235,13 @@  discard block
 block discarded – undo
3235 3235
     {
3236 3236
         $saida = "";
3237 3237
         if (isset($this->compra)) {
3238
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3238
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
3239 3239
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
3240 3240
             }
3241
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3241
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
3242 3242
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
3243 3243
             }
3244
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3244
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
3245 3245
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
3246 3246
             }
3247 3247
         }
@@ -3267,21 +3267,21 @@  discard block
 block discarded – undo
3267 3267
         if ($vICMS > 0) {
3268 3268
             $vICMS = 1;
3269 3269
         }
3270
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3270
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
3271 3271
         if ($icmss > 0) {
3272 3272
             $icmss = 1;
3273 3273
         }
3274
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3274
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
3275 3275
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
3276 3276
         if ($dEmi == '') {
3277
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3277
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
3278 3278
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
3279 3279
             $aDemi = explode('T', $dEmi);
3280 3280
             $dEmi = $aDemi[0];
3281 3281
         }
3282 3282
         $dd  = $dEmi;
3283 3283
         $rpos = strrpos($dd, '-');
3284
-        $dd  = substr($dd, $rpos +1);
3284
+        $dd  = substr($dd, $rpos + 1);
3285 3285
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
3286 3286
         $chave = $chave . $this->pModulo11($chave);
3287 3287
         return $chave;
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
3303 3303
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
3304 3304
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
3305
-        $saida='';
3305
+        $saida = '';
3306 3306
         $nfRefs = $this->ide->getElementsByTagName('NFref');
3307 3307
         if (0 === $nfRefs->length) {
3308 3308
             return $saida;
@@ -3318,7 +3318,7 @@  discard block
 block discarded – undo
3318 3318
             foreach ($refNFe as $chave_acessoRef) {
3319 3319
                 $chave_acesso = $chave_acessoRef->nodeValue;
3320 3320
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3321
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3321
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3322 3322
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3323 3323
                 $serie  = substr($chave_acesso, 22, 3);
3324 3324
                 $numero = substr($chave_acesso, 25, 9);
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
             foreach ($refCTe as $chave_acessoRef) {
3340 3340
                 $chave_acesso = $chave_acessoRef->nodeValue;
3341 3341
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3342
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3342
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3343 3343
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3344 3344
                 $serie  = substr($chave_acesso, 22, 3);
3345 3345
                 $numero = substr($chave_acesso, 25, 9);
@@ -3355,10 +3355,9 @@  discard block
 block discarded – undo
3355 3355
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3356 3356
             foreach ($refNFP as $umaRefNFe) {
3357 3357
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3358
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3359
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3360
-                    '';
3361
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3358
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3359
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3360
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3362 3361
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3363 3362
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3364 3363
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
@@ -3384,6 +3383,6 @@  discard block
 block discarded – undo
3384 3383
         imagedestroy($image);
3385 3384
         $stringdata = ob_get_contents(); // read from buffer
3386 3385
         ob_end_clean();
3387
-        return 'data://text/plain;base64,'.base64_encode($stringdata);
3386
+        return 'data://text/plain;base64,' . base64_encode($stringdata);
3388 3387
     }
3389 3388
 }
Please login to merge, or discard this patch.