Passed
Push — main ( 83c25f...829487 )
by Stefan
01:56
created
XFPDFExample.class.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      * define table columns
23 23
      * @param string $orientation
24 24
      */
25
-    public function __construct(string $orientation='P') 
25
+    public function __construct(string $orientation = 'P') 
26 26
     {
27 27
         // first call parent constructor for general initialization
28 28
         parent::__construct($orientation);
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         $this->setPageFooter("Page: {PN}/{NP}\tAuthor: S.Kien\t{D} {T}");
47 47
         
48 48
         // now we define the columns of our report
49
-        $this->addCol('Row',            10, 'R', XPDF::COL_ROW_NR,     XPDF::FLAG_TOTALS_TEXT);
50
-        $this->addCol('Date',           35, 'C', 'date',               XPDF::FLAG_DATE);
51
-        $this->addCol('Text',           -1, 'L', 'text');
52
-        $this->addCol('Grp.',           12, 'C', self::MY_GRP_COL);
53
-        $this->addCol('Weight',         20, 'R', 'weight',             XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_NUMBER);
54
-        $iImgCol = $this->addCol(-1,     8, 'C', self::MY_IMAGE_COL,   XPDF::FLAG_IMAGE | XPDF::FLAG_TOTALS_EMPTY);
55
-        $this->addCol('Price',          25, 'R', 'price',              XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_CUR_SYMBOL);
56
-        $this->addCol('Cost per kg',    25, 'R', self::MY_CALC_COL,    XPDF::FLAG_TOTALS_EMPTY);
49
+        $this->addCol('Row', 10, 'R', XPDF::COL_ROW_NR, XPDF::FLAG_TOTALS_TEXT);
50
+        $this->addCol('Date', 35, 'C', 'date', XPDF::FLAG_DATE);
51
+        $this->addCol('Text', -1, 'L', 'text');
52
+        $this->addCol('Grp.', 12, 'C', self::MY_GRP_COL);
53
+        $this->addCol('Weight', 20, 'R', 'weight', XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_NUMBER);
54
+        $iImgCol = $this->addCol(-1, 8, 'C', self::MY_IMAGE_COL, XPDF::FLAG_IMAGE | XPDF::FLAG_TOTALS_EMPTY);
55
+        $this->addCol('Price', 25, 'R', 'price', XPDF::FLAG_TOTALS_CALC | XPDF::FLAG_CUR_SYMBOL);
56
+        $this->addCol('Cost per kg', 25, 'R', self::MY_CALC_COL, XPDF::FLAG_TOTALS_EMPTY);
57 57
         
58 58
         // enable the totals/pagetotals and carry-over functionality
59 59
         $this->enableTotals(XPDF::TOTALS | XPDF::PAGE_TOTALS | XPDF::CARRY_OVER);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $this->setNumberFormat(1, '', ' kg');
68 68
         
69 69
         // and set meassuring for the image col
70
-        $this->setColImageInfo($iImgCol, 1.5, 2.5, 3 );
70
+        $this->setColImageInfo($iImgCol, 1.5, 2.5, 3);
71 71
     }
72 72
     
73 73
     /**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         $strCol = '';
89 89
         switch ($iCol) {
90 90
             case self::MY_GRP_COL:
91
-                $aValues = array( '', 'Grp. A', 'Grp. B', 'Grp. C', 'Grp. D');
91
+                $aValues = array('', 'Grp. A', 'Grp. B', 'Grp. C', 'Grp. D');
92 92
                 if ($row['grp_id'] > 0 && $row['grp_id'] <= 4) {
93 93
                     $strCol = $aValues[$row['grp_id']];
94 94
                 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             case self::MY_CALC_COL:
110 110
                 $fltPricePerKg = 0.0;
111 111
                 if (floatval($row['weight']) != 0) {
112
-                    $fltPricePerKg = floatval($row['price']) / floatval($row['weight']);;
112
+                    $fltPricePerKg = floatval($row['price']) / floatval($row['weight']); ;
113 113
                 }
114 114
                 $strCol = $this->formatCurrency($fltPricePerKg, true);
115 115
                 break;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         // for grouping
140 140
         $date = strtotime($row['date']);
141 141
         $strMonth = date('Y-m', $date);
142
-        if ( $this->strMonth != $strMonth) {
142
+        if ($this->strMonth != $strMonth) {
143 143
             // first row we have no subtotals...
144 144
             if ($this->strMonth != '') {
145 145
                 $this->endGroup();
Please login to merge, or discard this patch.
SKien/XFPDF/XPDF.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
      * @see XPDF::InitGrid()
635 635
      * @param int $iTotals  combination of 
636 636
      */
637
-    public function enableTotals(int $iTotals=self::TOTALS) : void
637
+    public function enableTotals(int $iTotals = self::TOTALS) : void
638 638
     {
639 639
         $this->bCalcTotals = ($iTotals & self::TOTALS) != 0;
640 640
         $this->bPageTotals = ($iTotals & self::PAGE_TOTALS) != 0;
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
      */
830 830
     public function selectDrawColor(string $strColor) : void
831 831
     {
832
-        $r=0; $g=0; $b=0;
832
+        $r = 0; $g = 0; $b = 0;
833 833
         $this->getRGB($strColor, $r, $g, $b);
834 834
         $this->setDrawColor($r, $g, $b);
835 835
     }
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
         // Restore line width
1386 1386
         if ($this->LineWidth != $a['lw']) {
1387 1387
             $this->LineWidth = $a['lw'];
1388
-            $this->out(sprintf( '%.2F w', $a['lw'] * $this->k));
1388
+            $this->out(sprintf('%.2F w', $a['lw'] * $this->k));
1389 1389
         }
1390 1390
         // Restore font
1391 1391
         if (($a['family'] != $this->FontFamily) ||
Please login to merge, or discard this patch.
OPlathey/FPDF/FPDF.php 2 patches
Spacing   +177 added lines, -177 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 * http://www.fpdf.org/en/doc/index.php
25 25
 *******************************************************************************/
26 26
 
27
-define('FPDF_VERSION','1.82');
27
+define('FPDF_VERSION', '1.82');
28 28
 
29 29
 class FPDF
30 30
 {
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      *                              or an array containing the width and the height (expressed in the unit given by unit). <br/>
176 176
      *                              Default value is 'A4'.
177 177
      */
178
-    public function __construct(string $orientation='P', string $unit='mm', $size='A4')
178
+    public function __construct(string $orientation = 'P', string $unit = 'mm', $size = 'A4')
179 179
     {
180 180
         // Some checks
181 181
         $this->doChecks();
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
                 $this->k = 1;
192 192
                 break;
193 193
             case 'mm':
194
-                $this->k = 72/25.4;
194
+                $this->k = 72 / 25.4;
195 195
                 break;
196 196
             case 'cm':
197
-                $this->k = 72/2.54;
197
+                $this->k = 72 / 2.54;
198 198
                 break;
199 199
             case 'in':
200 200
                 $this->k = 72;
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
      * @param float $top    Top margin.
255 255
      * @param float $right  Right margin. Default value is the left one.
256 256
      */
257
-    public function setMargins(float $left, float $top, ?float $right=null) : void
257
+    public function setMargins(float $left, float $top, ?float $right = null) : void
258 258
     {
259 259
         // Set left, top and right margins
260 260
         $this->lMargin = $left;
261 261
         $this->tMargin = $top;
262
-        if($right===null)
262
+        if ($right === null)
263 263
             $right = $left;
264 264
         $this->rMargin = $right;
265 265
     }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     {
275 275
         // Set left margin
276 276
         $this->lMargin = $margin;
277
-        if($this->page>0 && $this->x<$margin)
277
+        if ($this->page > 0 && $this->x < $margin)
278 278
             $this->x = $margin;
279 279
     }
280 280
 
@@ -308,12 +308,12 @@  discard block
 block discarded – undo
308 308
      * @param bool $auto    indicating if mode should be on or off. 
309 309
      * @param float $margin Distance from the bottom of the page. 
310 310
      */
311
-    public function setAutoPageBreak(bool $auto, float $margin=0) : void
311
+    public function setAutoPageBreak(bool $auto, float $margin = 0) : void
312 312
     {
313 313
         // Set auto page break mode and triggering margin
314 314
         $this->AutoPageBreak = $auto;
315 315
         $this->bMargin = $margin;
316
-        $this->PageBreakTrigger = $this->h-$margin;
316
+        $this->PageBreakTrigger = $this->h - $margin;
317 317
     }
318 318
 
319 319
     /**
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
      *                              <li> 'defaul't: uses viewer default mode </li></ul>
345 345
      *                              Default value is default. 
346 346
      */
347
-    public function setDisplayMode($zoom, string $layout='default') : void
347
+    public function setDisplayMode($zoom, string $layout = 'default') : void
348 348
     {
349 349
         // Set display mode in viewer
350
-        if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
350
+        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom))
351 351
             $this->ZoomMode = $zoom;
352 352
         else
353
-            $this->error('Incorrect zoom display mode: '.$zoom);
354
-        if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
353
+            $this->error('Incorrect zoom display mode: ' . $zoom);
354
+        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default')
355 355
             $this->LayoutMode = $layout;
356 356
         else
357
-            $this->error('Incorrect layout display mode: '.$layout);
357
+            $this->error('Incorrect layout display mode: ' . $layout);
358 358
     }
359 359
 
360 360
     /**
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     public function setCompression(bool $compress) : void
370 370
     {
371 371
         // Set page compression
372
-        if(function_exists('gzcompress'))
372
+        if (function_exists('gzcompress'))
373 373
             $this->compress = $compress;
374 374
         else
375 375
             $this->compress = false;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
      * @param string $title The title.
381 381
      * @param bool $isUTF8  Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false. 
382 382
      */
383
-    public function setTitle(string $title, bool $isUTF8=false) : void
383
+    public function setTitle(string $title, bool $isUTF8 = false) : void
384 384
     {
385 385
         // Title of document
386 386
         $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
      * @param string $author
392 392
      * @param bool $isUTF8  Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false.
393 393
      */
394
-    public function setAuthor(string $author, bool $isUTF8=false) : void
394
+    public function setAuthor(string $author, bool $isUTF8 = false) : void
395 395
     {
396 396
         // Author of document
397 397
         $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author);
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
      * @param string $subject
403 403
      * @param bool $isUTF8  Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false.
404 404
      */
405
-    public function setSubject(string $subject, bool $isUTF8=false) : void
405
+    public function setSubject(string $subject, bool $isUTF8 = false) : void
406 406
     {
407 407
         // Subject of document
408 408
         $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
      * @param string $keywords
414 414
      * @param bool $isUTF8  Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false.
415 415
      */
416
-    public function setKeywords(string $keywords, bool $isUTF8=false) : void
416
+    public function setKeywords(string $keywords, bool $isUTF8 = false) : void
417 417
     {
418 418
         // Keywords of document
419 419
         $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
      * @param string $creator
425 425
      * @param bool $isUTF8  Indicates if the string is encoded in ISO-8859-1 (false) or UTF-8 (true). Default value: false.
426 426
      */
427
-    public function setCreator(string $creator, bool $isUTF8=false) : void
427
+    public function setCreator(string $creator, bool $isUTF8 = false) : void
428 428
     {
429 429
         // Creator of document
430 430
         $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      * Defines an alias for the total number of pages. It will be substituted as the document is closed. 
435 435
      * @param string $alias The alias. Default value: {nb}. 
436 436
      */
437
-    public function aliasNbPages(string $alias='{nb}') : void
437
+    public function aliasNbPages(string $alias = '{nb}') : void
438 438
     {
439 439
         // Define an alias for total number of pages
440 440
         $this->AliasNbPages = $alias;
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
     public function error(string $msg) : void
452 452
     {
453 453
         // Fatal error
454
-        throw new \Exception('FPDF error: '.$msg);
454
+        throw new \Exception('FPDF error: ' . $msg);
455 455
     }
456 456
     
457 457
     /**
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
     public function close() : void
464 464
     {
465 465
         // Terminate document
466
-        if($this->state==3)
466
+        if ($this->state == 3)
467 467
             return;
468
-        if($this->page==0)
468
+        if ($this->page == 0)
469 469
             $this->addPage();
470 470
         // Page footer
471 471
         $this->InFooter = true;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      *                              It must be a multiple of 90; positive values mean clockwise rotation. </br>
506 506
      *                              The default value is 0.
507 507
      */
508
-    public function addPage(string $orientation='', $size='', int $rotation=0) : void
508
+    public function addPage(string $orientation = '', $size = '', int $rotation = 0) : void
509 509
     {
510 510
         // Start a new page
511 511
         if ($this->state == 3) {
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
      * @param int $g    Green component (between 0 and 255).
616 616
      * @param int $b    Blue component (between 0 and 255).
617 617
      */
618
-    public function setDrawColor(int $r, ?int $g=null, ?int $b=null) : void
618
+    public function setDrawColor(int $r, ?int $g = null, ?int $b = null) : void
619 619
     {
620 620
         // Set color for all stroking operations
621 621
         if (($r === 0 && $g === 0 && $b === 0) || $g === null) {
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
      * @param int $g    Green component (between 0 and 255).
637 637
      * @param int $b    Blue component (between 0 and 255).
638 638
      */
639
-    public function setFillColor(int $r, ?int $g=null, ?int $b=null) : void
639
+    public function setFillColor(int $r, ?int $g = null, ?int $b = null) : void
640 640
     {
641 641
         // Set color for all filling operations
642 642
         if (($r === 0 && $g === 0 && $b === 0) || $g === null) {
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @param int $g    Green component (between 0 and 255).
659 659
      * @param int $b    Blue component (between 0 and 255).
660 660
      */
661
-    public function setTextColor(int $r, ?int $g=null, ?int $b=null) : void
661
+    public function setTextColor(int $r, ?int $g = null, ?int $b = null) : void
662 662
     {
663 663
         // Set color for text
664 664
         if (($r === 0 && $g === 0 && $b === 0) || $g === null) {
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
     public function getStringWidth(string $s) : float
679 679
     {
680 680
         // Get width of a string in the current font
681
-        $s = (string)$s;
681
+        $s = (string) $s;
682 682
         $cw = &$this->CurrentFont['cw'];
683 683
         $w = 0;
684 684
         $l = strlen($s);
685
-        for($i=0;$i<$l;$i++)
685
+        for ($i = 0; $i < $l; $i++)
686 686
             $w += $cw[$s[$i]];
687
-        return $w*$this->FontSize/1000;
687
+        return $w * $this->FontSize / 1000;
688 688
     }
689 689
     
690 690
     /**
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
     {
698 698
         // Set line width
699 699
         $this->LineWidth = $width;
700
-        if($this->page>0)
701
-            $this->out(sprintf('%.2F w',$width*$this->k));
700
+        if ($this->page > 0)
701
+            $this->out(sprintf('%.2F w', $width * $this->k));
702 702
     }
703 703
     
704 704
     /**
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
     public function line(float $x1, float $y1, float $x2, float $y2) : void
714 714
     {
715 715
         // Draw a line
716
-        $this->out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
716
+        $this->out(sprintf('%.2F %.2F m %.2F %.2F l S', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k));
717 717
     }
718 718
 
719 719
     /**
@@ -731,16 +731,16 @@  discard block
 block discarded – undo
731 731
      *                      <li>   'F': fill. </li>
732 732
      *                      <li>   'DF' or 'FD': draw the shape and fill. </li></ul>
733 733
      */
734
-    public function rect(float $x, float $y, float $w, float $h, string $style='') : void
734
+    public function rect(float $x, float $y, float $w, float $h, string $style = '') : void
735 735
     {
736 736
         // Draw a rectangle
737
-        if($style=='F')
737
+        if ($style == 'F')
738 738
             $op = 'f';
739
-        elseif($style=='FD' || $style=='DF')
739
+        elseif ($style == 'FD' || $style == 'DF')
740 740
             $op = 'B';
741 741
         else
742 742
             $op = 'S';
743
-        $this->out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
743
+        $this->out(sprintf('%.2F %.2F %.2F %.2F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op));
744 744
     }
745 745
     
746 746
     /**
@@ -760,24 +760,24 @@  discard block
 block discarded – undo
760 760
      * @param string $file      The font definition file. <br/>
761 761
      *                          By default, the name is built from the family and style, in lower case with no space.
762 762
      */
763
-    public function addFont(string $family, string $style='', string $file='') : void
763
+    public function addFont(string $family, string $style = '', string $file = '') : void
764 764
     {
765 765
         // Add a TrueType, OpenType or Type1 font
766 766
         $family = strtolower($family);
767
-        if($file=='')
768
-            $file = str_replace(' ','',$family).strtolower($style).'.php';
767
+        if ($file == '')
768
+            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
769 769
         $style = strtoupper($style);
770
-        if($style=='IB')
770
+        if ($style == 'IB')
771 771
             $style = 'BI';
772
-        $fontkey = $family.$style;
773
-        if(isset($this->fonts[$fontkey]))
772
+        $fontkey = $family . $style;
773
+        if (isset($this->fonts[$fontkey]))
774 774
             return;
775 775
         $info = $this->loadFont($file);
776
-        $info['i'] = count($this->fonts)+1;
777
-        if(!empty($info['file']))
776
+        $info['i'] = count($this->fonts) + 1;
777
+        if (!empty($info['file']))
778 778
         {
779 779
             // Embedded font
780
-            if($info['type']=='TrueType')
780
+            if ($info['type'] == 'TrueType')
781 781
                 $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
782 782
             else
783 783
                 $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
@@ -820,54 +820,54 @@  discard block
 block discarded – undo
820 820
      *                          The default value is the current size. <br/>
821 821
      *                          If no size has been specified since the beginning of the document, the value taken is 12.
822 822
      */
823
-    public function setFont(string $family, string $style='', float $size=0) : void
823
+    public function setFont(string $family, string $style = '', float $size = 0) : void
824 824
     {
825 825
         // Select a font; size given in points
826
-        if($family=='')
826
+        if ($family == '')
827 827
             $family = $this->FontFamily;
828 828
         else
829 829
             $family = strtolower($family);
830 830
         $style = strtoupper($style);
831
-        if(strpos($style,'U')!==false)
831
+        if (strpos($style, 'U') !== false)
832 832
         {
833 833
             $this->underline = true;
834
-            $style = str_replace('U','',$style);
834
+            $style = str_replace('U', '', $style);
835 835
         }
836 836
         else
837 837
             $this->underline = false;
838
-        if($style=='IB')
838
+        if ($style == 'IB')
839 839
             $style = 'BI';
840
-        if($size==0)
840
+        if ($size == 0)
841 841
             $size = $this->FontSizePt;
842 842
         // Test if font is already selected
843
-        if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
843
+        if ($this->FontFamily == $family && $this->FontStyle == $style && $this->FontSizePt == $size)
844 844
             return;
845 845
         // Test if font is already loaded
846
-        $fontkey = $family.$style;
847
-        if(!isset($this->fonts[$fontkey]))
846
+        $fontkey = $family . $style;
847
+        if (!isset($this->fonts[$fontkey]))
848 848
         {
849 849
             // Test if one of the core fonts
850
-            if($family=='arial')
850
+            if ($family == 'arial')
851 851
                 $family = 'helvetica';
852
-            if(in_array($family,$this->CoreFonts))
852
+            if (in_array($family, $this->CoreFonts))
853 853
             {
854
-                if($family=='symbol' || $family=='zapfdingbats')
854
+                if ($family == 'symbol' || $family == 'zapfdingbats')
855 855
                     $style = '';
856
-                $fontkey = $family.$style;
857
-                if(!isset($this->fonts[$fontkey]))
858
-                    $this->addFont($family,$style);
856
+                $fontkey = $family . $style;
857
+                if (!isset($this->fonts[$fontkey]))
858
+                    $this->addFont($family, $style);
859 859
             }
860 860
             else
861
-                $this->error('Undefined font: '.$family.' '.$style);
861
+                $this->error('Undefined font: ' . $family . ' ' . $style);
862 862
         }
863 863
         // Select it
864 864
         $this->FontFamily = $family;
865 865
         $this->FontStyle = $style;
866 866
         $this->FontSizePt = $size;
867
-        $this->FontSize = $size/$this->k;
867
+        $this->FontSize = $size / $this->k;
868 868
         $this->CurrentFont = &$this->fonts[$fontkey];
869
-        if($this->page>0)
870
-            $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
869
+        if ($this->page > 0)
870
+            $this->out(sprintf('BT /F%d %.2F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
871 871
     }
872 872
     
873 873
     /**
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
      * @param float $y  Y-position of target position; -1 indicates the current position. The default value is 0 (top of page).
909 909
      * @param int $page Number of target page; -1 indicates the current page. This is the default value.
910 910
      */
911
-    public function setLink(int $link, float $y=0, int $page=-1) : void
911
+    public function setLink(int $link, float $y = 0, int $page = -1) : void
912 912
     {
913 913
         // Set destination of internal link
914 914
         if ($y == -1) {
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
     public function link(float $x, float $y, float $w, float $h, $link) : void
935 935
     {
936 936
         // Put a link on the page
937
-        $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
937
+        $this->PageLinks[$this->page][] = array($x * $this->k, $this->hPt - $y * $this->k, $w * $this->k, $h * $this->k, $link);
938 938
     }
939 939
     
940 940
     /**
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
         if (!isset($this->CurrentFont)) {
954 954
             $this->error('No font has been set');
955 955
         }
956
-        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->escape($txt));
956
+        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt));
957 957
         if ($this->underline && $txt != '') {
958 958
             $s .= ' ' . $this->doUnderline($x, $y, $txt);
959 959
         }
@@ -1132,24 +1132,24 @@  discard block
 block discarded – undo
1132 1132
      *                          If set to true, current FillColor is used for the background. <br/>
1133 1133
      *                          Default value: false.
1134 1134
      */
1135
-    public function multiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void
1135
+    public function multiCell(float $w, float $h, string $txt, $border = 0, string $align = 'J', bool $fill = false) : void
1136 1136
     {
1137 1137
         // Output text with automatic or explicit line breaks
1138
-        if(!isset($this->CurrentFont))
1138
+        if (!isset($this->CurrentFont))
1139 1139
             $this->error('No font has been set');
1140 1140
         $cw = &$this->CurrentFont['cw'];
1141
-        if($w==0)
1142
-            $w = $this->w-$this->rMargin-$this->x;
1143
-        $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1144
-        $s = str_replace("\r",'',$txt);
1141
+        if ($w == 0)
1142
+            $w = $this->w - $this->rMargin - $this->x;
1143
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1144
+        $s = str_replace("\r", '', $txt);
1145 1145
         $nb = strlen($s);
1146
-        if($nb>0 && $s[$nb-1]=="\n")
1146
+        if ($nb > 0 && $s[$nb - 1] == "\n")
1147 1147
             $nb--;
1148 1148
         $b = 0;
1149 1149
         $b2 = '';
1150
-        if($border)
1150
+        if ($border)
1151 1151
         {
1152
-            if($border==1)
1152
+            if ($border == 1)
1153 1153
             {
1154 1154
                 $border = 'LTRB';
1155 1155
                 $b = 'LRT';
@@ -1158,11 +1158,11 @@  discard block
 block discarded – undo
1158 1158
             else
1159 1159
             {
1160 1160
                 $b2 = '';
1161
-                if(strpos($border,'L')!==false)
1161
+                if (strpos($border, 'L') !== false)
1162 1162
                     $b2 .= 'L';
1163
-                if(strpos($border,'R')!==false)
1163
+                if (strpos($border, 'R') !== false)
1164 1164
                     $b2 .= 'R';
1165
-                $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
1165
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
1166 1166
             }
1167 1167
         }
1168 1168
         $sep = -1;
@@ -1172,80 +1172,80 @@  discard block
 block discarded – undo
1172 1172
         $ns = 0;
1173 1173
         $nl = 1;
1174 1174
         $ls = 0;
1175
-        while($i<$nb)
1175
+        while ($i < $nb)
1176 1176
         {
1177 1177
             // Get next character
1178 1178
             $c = $s[$i];
1179
-            if($c=="\n")
1179
+            if ($c == "\n")
1180 1180
             {
1181 1181
                 // Explicit line break
1182
-                if($this->ws>0)
1182
+                if ($this->ws > 0)
1183 1183
                 {
1184 1184
                     $this->ws = 0;
1185 1185
                     $this->out('0 Tw');
1186 1186
                 }
1187
-                $this->cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1187
+                $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
1188 1188
                 $i++;
1189 1189
                 $sep = -1;
1190 1190
                 $j = $i;
1191 1191
                 $l = 0;
1192 1192
                 $ns = 0;
1193 1193
                 $nl++;
1194
-                if($border && $nl==2)
1194
+                if ($border && $nl == 2)
1195 1195
                     $b = $b2;
1196 1196
                 continue;
1197 1197
             }
1198
-            if($c==' ')
1198
+            if ($c == ' ')
1199 1199
             {
1200 1200
                 $sep = $i;
1201 1201
                 $ls = $l;
1202 1202
                 $ns++;
1203 1203
             }
1204 1204
             $l += $cw[$c];
1205
-            if($l>$wmax)
1205
+            if ($l > $wmax)
1206 1206
             {
1207 1207
                 // Automatic line break
1208
-                if($sep==-1)
1208
+                if ($sep == -1)
1209 1209
                 {
1210
-                    if($i==$j)
1210
+                    if ($i == $j)
1211 1211
                         $i++;
1212
-                    if($this->ws>0)
1212
+                    if ($this->ws > 0)
1213 1213
                     {
1214 1214
                         $this->ws = 0;
1215 1215
                         $this->out('0 Tw');
1216 1216
                     }
1217
-                    $this->cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1217
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
1218 1218
                 }
1219 1219
                 else
1220 1220
                 {
1221
-                    if($align=='J')
1221
+                    if ($align == 'J')
1222 1222
                     {
1223
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
1224
-                        $this->out(sprintf('%.3F Tw',$this->ws*$this->k));
1223
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
1224
+                        $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
1225 1225
                     }
1226
-                    $this->cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
1227
-                    $i = $sep+1;
1226
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
1227
+                    $i = $sep + 1;
1228 1228
                 }
1229 1229
                 $sep = -1;
1230 1230
                 $j = $i;
1231 1231
                 $l = 0;
1232 1232
                 $ns = 0;
1233 1233
                 $nl++;
1234
-                if($border && $nl==2)
1234
+                if ($border && $nl == 2)
1235 1235
                     $b = $b2;
1236 1236
             }
1237 1237
             else
1238 1238
                 $i++;
1239 1239
         }
1240 1240
         // Last chunk
1241
-        if($this->ws>0)
1241
+        if ($this->ws > 0)
1242 1242
         {
1243 1243
             $this->ws = 0;
1244 1244
             $this->out('0 Tw');
1245 1245
         }
1246
-        if($border && strpos($border,'B')!==false)
1246
+        if ($border && strpos($border, 'B') !== false)
1247 1247
             $b .= 'B';
1248
-        $this->cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1248
+        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
1249 1249
         $this->x = $this->lMargin;
1250 1250
     }
1251 1251
     
@@ -1259,78 +1259,78 @@  discard block
 block discarded – undo
1259 1259
      * @param string $txt       String to print.
1260 1260
      * @param string|int $link  URL or identifier for internal link created by AddLink().
1261 1261
      */
1262
-    public function write(float $h, string $txt, $link='') : void
1262
+    public function write(float $h, string $txt, $link = '') : void
1263 1263
     {
1264 1264
         // Output text in flowing mode
1265
-        if(!isset($this->CurrentFont))
1265
+        if (!isset($this->CurrentFont))
1266 1266
             $this->error('No font has been set');
1267 1267
         $cw = &$this->CurrentFont['cw'];
1268
-        $w = $this->w-$this->rMargin-$this->x;
1269
-        $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1270
-        $s = str_replace("\r",'',$txt);
1268
+        $w = $this->w - $this->rMargin - $this->x;
1269
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1270
+        $s = str_replace("\r", '', $txt);
1271 1271
         $nb = strlen($s);
1272 1272
         $sep = -1;
1273 1273
         $i = 0;
1274 1274
         $j = 0;
1275 1275
         $l = 0;
1276 1276
         $nl = 1;
1277
-        while($i<$nb)
1277
+        while ($i < $nb)
1278 1278
         {
1279 1279
             // Get next character
1280 1280
             $c = $s[$i];
1281
-            if($c=="\n")
1281
+            if ($c == "\n")
1282 1282
             {
1283 1283
                 // Explicit line break
1284
-                $this->cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
1284
+                $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', false, $link);
1285 1285
                 $i++;
1286 1286
                 $sep = -1;
1287 1287
                 $j = $i;
1288 1288
                 $l = 0;
1289
-                if($nl==1)
1289
+                if ($nl == 1)
1290 1290
                 {
1291 1291
                     $this->x = $this->lMargin;
1292
-                    $w = $this->w-$this->rMargin-$this->x;
1293
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1292
+                    $w = $this->w - $this->rMargin - $this->x;
1293
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1294 1294
                 }
1295 1295
                 $nl++;
1296 1296
                 continue;
1297 1297
             }
1298
-            if($c==' ')
1298
+            if ($c == ' ')
1299 1299
                 $sep = $i;
1300 1300
             $l += $cw[$c];
1301
-            if($l>$wmax)
1301
+            if ($l > $wmax)
1302 1302
             {
1303 1303
                 // Automatic line break
1304
-                if($sep==-1)
1304
+                if ($sep == -1)
1305 1305
                 {
1306
-                    if($this->x>$this->lMargin)
1306
+                    if ($this->x > $this->lMargin)
1307 1307
                     {
1308 1308
                         // Move to next line
1309 1309
                         $this->x = $this->lMargin;
1310 1310
                         $this->y += $h;
1311
-                        $w = $this->w-$this->rMargin-$this->x;
1312
-                        $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1311
+                        $w = $this->w - $this->rMargin - $this->x;
1312
+                        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1313 1313
                         $i++;
1314 1314
                         $nl++;
1315 1315
                         continue;
1316 1316
                     }
1317
-                    if($i==$j)
1317
+                    if ($i == $j)
1318 1318
                         $i++;
1319
-                    $this->cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
1319
+                    $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', false, $link);
1320 1320
                 }
1321 1321
                 else
1322 1322
                 {
1323
-                    $this->cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
1324
-                    $i = $sep+1;
1323
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', false, $link);
1324
+                    $i = $sep + 1;
1325 1325
                 }
1326 1326
                 $sep = -1;
1327 1327
                 $j = $i;
1328 1328
                 $l = 0;
1329
-                if($nl==1)
1329
+                if ($nl == 1)
1330 1330
                 {
1331 1331
                     $this->x = $this->lMargin;
1332
-                    $w = $this->w-$this->rMargin-$this->x;
1333
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1332
+                    $w = $this->w - $this->rMargin - $this->x;
1333
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
1334 1334
                 }
1335 1335
                 $nl++;
1336 1336
             }
@@ -1338,8 +1338,8 @@  discard block
 block discarded – undo
1338 1338
                 $i++;
1339 1339
         }
1340 1340
         // Last chunk
1341
-        if($i!=$j)
1342
-            $this->cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
1341
+        if ($i != $j)
1342
+            $this->cell($l / 1000 * $this->FontSize, $h, substr($s, $j), 0, 0, '', false, $link);
1343 1343
     }
1344 1344
     
1345 1345
     /**
@@ -1349,11 +1349,11 @@  discard block
 block discarded – undo
1349 1349
      * @param float $h  The height of the break. <br/>
1350 1350
      *                  By default, the value equals the height of the last printed cell.
1351 1351
      */
1352
-    public function ln(float $h=null) : void
1352
+    public function ln(float $h = null) : void
1353 1353
     {
1354 1354
         // Line feed; default value is the last cell height
1355 1355
         $this->x = $this->lMargin;
1356
-        if($h===null)
1356
+        if ($h === null)
1357 1357
             $this->y += $this->lasth;
1358 1358
         else
1359 1359
             $this->y += $h;
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
      *                      If not specified, the type is inferred from the file extension. <br/>
1406 1406
      * @param string|int $link  URL or identifier for internal link created by AddLink().
1407 1407
      */
1408
-    public function image(string $file, ?float $x=null, ?float $y=null, float $w=0, float $h=0, string $type='', $link='') : void
1408
+    public function image(string $file, ?float $x = null, ?float $y = null, float $w = 0, float $h = 0, string $type = '', $link = '') : void
1409 1409
     {
1410 1410
         // Put an image on the page
1411 1411
         if ($file == '') {
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
                 $type = substr($file, $pos + 1);
1424 1424
             }
1425 1425
             $type = strtolower($type);
1426
-            if($type=='jpeg') {
1426
+            if ($type == 'jpeg') {
1427 1427
                 $type = 'jpg';
1428 1428
             }
1429 1429
             $mtd = 'parse' . ucfirst($type);
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
         }
1474 1474
         $this->out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q', $w * $this->k, $h * $this->k, $x * $this->k, ($this->h - ($y + $h)) * $this->k, $info['i']));
1475 1475
         if ($link) {
1476
-            $this->link($x,$y,$w,$h,$link);
1476
+            $this->link($x, $y, $w, $h, $link);
1477 1477
         }
1478 1478
     }
1479 1479
     
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
      * @param int $level
1486 1486
      * @param int $y
1487 1487
      */
1488
-    public function bookmark(string $txt, bool $isUTF8=false, int $level=0, int $y=0) : void
1488
+    public function bookmark(string $txt, bool $isUTF8 = false, int $level = 0, int $y = 0) : void
1489 1489
     {
1490 1490
         if (!$isUTF8) {
1491 1491
             $txt = utf8_encode($txt);
@@ -1534,10 +1534,10 @@  discard block
 block discarded – undo
1534 1534
     public function setX(float $x) : void
1535 1535
     {
1536 1536
         // Set x position
1537
-        if($x>=0)
1537
+        if ($x >= 0)
1538 1538
             $this->x = $x;
1539 1539
         else
1540
-            $this->x = $this->w+$x;
1540
+            $this->x = $this->w + $x;
1541 1541
     }
1542 1542
 
1543 1543
     /**
@@ -1556,14 +1556,14 @@  discard block
 block discarded – undo
1556 1556
      * @param float $y
1557 1557
      * @param bool $resetX
1558 1558
      */
1559
-    public function setY(float $y, bool $resetX=true) : void
1559
+    public function setY(float $y, bool $resetX = true) : void
1560 1560
     {
1561 1561
         // Set y position and optionally reset x
1562
-        if($y>=0)
1562
+        if ($y >= 0)
1563 1563
             $this->y = $y;
1564 1564
         else
1565
-            $this->y = $this->h+$y;
1566
-        if($resetX)
1565
+            $this->y = $this->h + $y;
1566
+        if ($resetX)
1567 1567
             $this->x = $this->lMargin;
1568 1568
     }
1569 1569
     
@@ -1577,7 +1577,7 @@  discard block
 block discarded – undo
1577 1577
     {
1578 1578
         // Set x and y positions
1579 1579
         $this->setX($x);
1580
-        $this->setY($y,false);
1580
+        $this->setY($y, false);
1581 1581
     }
1582 1582
     
1583 1583
     /**
@@ -1602,27 +1602,27 @@  discard block
 block discarded – undo
1602 1602
     {
1603 1603
         // Output PDF to some destination
1604 1604
         $this->close();
1605
-        if(strlen($name)==1 && strlen($dest)!=1)
1605
+        if (strlen($name) == 1 && strlen($dest) != 1)
1606 1606
         {
1607 1607
             // Fix parameter order
1608 1608
             $tmp = $dest;
1609 1609
             $dest = $name;
1610 1610
             $name = $tmp;
1611 1611
         }
1612
-        if($dest=='')
1612
+        if ($dest == '')
1613 1613
             $dest = 'I';
1614
-        if($name=='')
1614
+        if ($name == '')
1615 1615
             $name = 'doc.pdf';
1616
-        switch(strtoupper($dest))
1616
+        switch (strtoupper($dest))
1617 1617
         {
1618 1618
             case 'I':
1619 1619
                 // Send to standard output
1620 1620
                 $this->checkOutput();
1621
-                if(PHP_SAPI!='cli')
1621
+                if (PHP_SAPI != 'cli')
1622 1622
                 {
1623 1623
                     // We send to a browser
1624 1624
                     header('Content-Type: application/pdf; charset=UTF-8');
1625
-                    header('Content-Disposition: inline; '.$this->httpEncode('filename',$name,$isUTF8));
1625
+                    header('Content-Disposition: inline; ' . $this->httpEncode('filename', $name, $isUTF8));
1626 1626
                     header('Cache-Control: private, max-age=0, must-revalidate');
1627 1627
                     header('Pragma: public');
1628 1628
                 }
@@ -1632,21 +1632,21 @@  discard block
 block discarded – undo
1632 1632
                 // Download file
1633 1633
                 $this->checkOutput();
1634 1634
                 header('Content-Type: application/x-download');
1635
-                header('Content-Disposition: attachment; '.$this->httpEncode('filename',$name,$isUTF8));
1635
+                header('Content-Disposition: attachment; ' . $this->httpEncode('filename', $name, $isUTF8));
1636 1636
                 header('Cache-Control: private, max-age=0, must-revalidate');
1637 1637
                 header('Pragma: public');
1638 1638
                 echo $this->buffer;
1639 1639
                 break;
1640 1640
             case 'F':
1641 1641
                 // Save to local file
1642
-                if(!file_put_contents($name,$this->buffer))
1643
-                    $this->error('Unable to create output file: '.$name);
1642
+                if (!file_put_contents($name, $this->buffer))
1643
+                    $this->error('Unable to create output file: ' . $name);
1644 1644
                 break;
1645 1645
             case 'S':
1646 1646
                 // Return as a string
1647 1647
                 return $this->buffer;
1648 1648
             default:
1649
-                $this->error('Incorrect output destination: '.$dest);
1649
+                $this->error('Incorrect output destination: ' . $dest);
1650 1650
         }
1651 1651
         return '';
1652 1652
     }
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
             $this->CurOrientation = $orientation;
1776 1776
             $this->CurPageSize = $size;
1777 1777
         }
1778
-        if($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) {
1778
+        if ($orientation != $this->DefOrientation || $size[0] != $this->DefPageSize[0] || $size[1] != $this->DefPageSize[1]) {
1779 1779
             $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt);
1780 1780
         }
1781 1781
         if ($rotation != 0) {
@@ -1909,7 +1909,7 @@  discard block
 block discarded – undo
1909 1909
             strpos($s, ')') !== false || 
1910 1910
             strpos($s, '\\') !== false || 
1911 1911
             strpos($s, "\r") !== false) {
1912
-            $s = str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
1912
+            $s = str_replace(array('\\', '(', ')', "\r"), array('\\\\', '\\(', '\\)', '\\r'), $s);
1913 1913
         }
1914 1914
         return $s;
1915 1915
     }
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
         // Underline text
1941 1941
         $up = $this->CurrentFont['up'];
1942 1942
         $ut = $this->CurrentFont['ut'];
1943
-        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt,' ');
1943
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1944 1944
         return sprintf('%.2F %.2F %.2F %.2F re f', $x * $this->k, ($this->h - ($y - $up / 1000 * $this->FontSize)) * $this->k, $w * $this->k, -$ut / 1000 * $this->FontSizePt);
1945 1945
     }
1946 1946
     
@@ -2069,7 +2069,7 @@  discard block
 block discarded – undo
2069 2069
                         $trns = array($pos);
2070 2070
                     }
2071 2071
                 }
2072
-                $this->readStream($f,4);
2072
+                $this->readStream($f, 4);
2073 2073
             } elseif ($type == 'IDAT') {
2074 2074
                 // Read image data block
2075 2075
                 $data .= $this->readStream($f, $n);
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
             $alpha = '';
2108 2108
             if ($ct == 4) {
2109 2109
                 // Gray image
2110
-                $len = 2*$w;
2110
+                $len = 2 * $w;
2111 2111
                 for ($i = 0; $i < $h; $i++) {
2112 2112
                     $pos = (1 + $len) * $i;
2113 2113
                     $color .= $data[$pos];
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
      * Begin a new object.
2265 2265
      * @param int $n
2266 2266
      */
2267
-    protected function newObject(?int $n=null) : void
2267
+    protected function newObject(?int $n = null) : void
2268 2268
     {
2269 2269
         // Begin a new object
2270 2270
         if ($n === null) {
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
             $this->put(sprintf('/MediaBox [0 0 %.2F %.2F]', $this->PageInfo[$n]['size'][0], $this->PageInfo[$n]['size'][1]));
2350 2350
         }
2351 2351
         if (isset($this->PageInfo[$n]['rotation'])) {
2352
-            $this->put('/Rotate '.$this->PageInfo[$n]['rotation']);
2352
+            $this->put('/Rotate ' . $this->PageInfo[$n]['rotation']);
2353 2353
         }
2354 2354
         $this->put('/Resources 2 0 R');
2355 2355
         if (isset($this->PageLinks[$n])) {
@@ -2365,12 +2365,12 @@  discard block
 block discarded – undo
2365 2365
                     if (isset($this->PageInfo[$l[0]]['size'])) {
2366 2366
                         $h = $this->PageInfo[$l[0]]['size'][1];
2367 2367
                     } else {
2368
-                        $h = ($this->DefOrientation=='P') ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k;
2368
+                        $h = ($this->DefOrientation == 'P') ? $this->DefPageSize[1] * $this->k : $this->DefPageSize[0] * $this->k;
2369 2369
                     }
2370 2370
                     $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', $this->PageInfo[$l[0]]['n'], $h - $l[1] * $this->k);
2371 2371
                 }
2372 2372
             }
2373
-            $this->put($annots.']');
2373
+            $this->put($annots . ']');
2374 2374
         }
2375 2375
         if ($this->WithAlpha) {
2376 2376
             $this->put('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
@@ -2407,7 +2407,7 @@  discard block
 block discarded – undo
2407 2407
             }
2408 2408
             $this->put('/Length1 ' . $info['length1']);
2409 2409
             if (isset($info['length2'])) {
2410
-                $this->put('/Length2 '.$info['length2'].' /Length3 0');
2410
+                $this->put('/Length2 ' . $info['length2'] . ' /Length3 0');
2411 2411
             }
2412 2412
             $this->put('>>');
2413 2413
             $this->putStream($font);
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
             if ($font['subsetted']) {
2445 2445
                 $name = 'AAAAAA+' . $name;
2446 2446
             }
2447
-            if ($type=='Core') {
2447
+            if ($type == 'Core') {
2448 2448
                 // Core font
2449 2449
                 $this->newObject();
2450 2450
                 $this->put('<</Type /Font');
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
      */
2563 2563
     protected function putImages() : void
2564 2564
     {
2565
-        foreach(array_keys($this->images) as $file) {
2565
+        foreach (array_keys($this->images) as $file) {
2566 2566
             $this->putImage($this->images[$file]);
2567 2567
             unset($this->images[$file]['data']);
2568 2568
             unset($this->images[$file]['smask']);
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
             $this->put('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
2586 2586
         } else {
2587 2587
             $this->put('/ColorSpace /' . $info['cs']);
2588
-            if($info['cs']=='DeviceCMYK') {
2588
+            if ($info['cs'] == 'DeviceCMYK') {
2589 2589
                 $this->put('/Decode [1 0 1 0 1 0 1 0]');
2590 2590
             }
2591 2591
         }
@@ -2596,7 +2596,7 @@  discard block
 block discarded – undo
2596 2596
         if (isset($info['dp'])) {
2597 2597
             $this->put('/DecodeParms <<' . $info['dp'] . '>>');
2598 2598
         }
2599
-        if (isset($info['trns']) && is_array($info['trns']))    {
2599
+        if (isset($info['trns']) && is_array($info['trns'])) {
2600 2600
             $trns = '';
2601 2601
             $cnt = count($info['trns']);
2602 2602
             for ($i = 0; $i < $cnt; $i++) {
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
             $this->put('/Mask [' . $trns . ']');
2606 2606
         }
2607 2607
         if (isset($info['smask'])) {
2608
-            $this->put('/SMask ' . ($this->n+1) . ' 0 R');
2608
+            $this->put('/SMask ' . ($this->n + 1) . ' 0 R');
2609 2609
         }
2610 2610
         $this->put('/Length ' . strlen($info['data']) . '>>');
2611 2611
         $this->putStream($info['data']);
@@ -2686,13 +2686,13 @@  discard block
 block discarded – undo
2686 2686
     protected function putBookmarks() : void
2687 2687
     {
2688 2688
         $nb = count($this->outlines);
2689
-        if( $nb==0 ) {
2689
+        if ($nb == 0) {
2690 2690
             return;
2691 2691
         }
2692 2692
         $lru = array();
2693 2693
         $level = 0;
2694 2694
         foreach ($this->outlines as $i => $o) {
2695
-            if ($o['l']>0) {
2695
+            if ($o['l'] > 0) {
2696 2696
                 $parent = $lru[$o['l'] - 1];
2697 2697
                 // Set parent and last pointers
2698 2698
                 $this->outlines[$i]['parent'] = $parent;
@@ -2714,7 +2714,7 @@  discard block
 block discarded – undo
2714 2714
                 $level = $o['l'];
2715 2715
         }
2716 2716
         // Outline items
2717
-        $n = $this->n+1;
2717
+        $n = $this->n + 1;
2718 2718
         foreach ($this->outlines as $i=>$o) {
2719 2719
             $this->newObject();
2720 2720
             $this->put('<</Title ' . $this->textString($o['t']));
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
         $this->newObject();
2740 2740
         $this->outlineRoot = $this->n;
2741 2741
         $this->put('<</Type /Outlines /First ' . $n . ' 0 R');
2742
-        $this->put('/Last ' . ($n+$lru[0]) . ' 0 R>>');
2742
+        $this->put('/Last ' . ($n + $lru[0]) . ' 0 R>>');
2743 2743
         $this->put('endobj');
2744 2744
     }
2745 2745
     
@@ -2773,24 +2773,24 @@  discard block
 block discarded – undo
2773 2773
         $n = $this->PageInfo[1]['n'];
2774 2774
         $this->put('/Type /Catalog');
2775 2775
         $this->put('/Pages 1 0 R');
2776
-        if($this->ZoomMode=='fullpage') {
2776
+        if ($this->ZoomMode == 'fullpage') {
2777 2777
             $this->put('/OpenAction [' . $n . ' 0 R /Fit]');
2778
-        } elseif ($this->ZoomMode=='fullwidth') {
2778
+        } elseif ($this->ZoomMode == 'fullwidth') {
2779 2779
             $this->put('/OpenAction [' . $n . ' 0 R /FitH null]');
2780
-        } elseif($this->ZoomMode=='real') {
2780
+        } elseif ($this->ZoomMode == 'real') {
2781 2781
             $this->put('/OpenAction [' . $n . ' 0 R /XYZ null null 1]');
2782
-        } elseif(!is_string($this->ZoomMode)) {
2782
+        } elseif (!is_string($this->ZoomMode)) {
2783 2783
             $this->put('/OpenAction [' . $n . ' 0 R /XYZ null null ' . sprintf('%.2F', $this->ZoomMode / 100) . ']');
2784 2784
         }
2785
-        if($this->LayoutMode=='single') {
2785
+        if ($this->LayoutMode == 'single') {
2786 2786
             $this->put('/PageLayout /SinglePage');
2787
-        } elseif($this->LayoutMode=='continuous') {
2787
+        } elseif ($this->LayoutMode == 'continuous') {
2788 2788
             $this->put('/PageLayout /OneColumn');
2789
-        } elseif($this->LayoutMode=='two') {
2789
+        } elseif ($this->LayoutMode == 'two') {
2790 2790
             $this->put('/PageLayout /TwoColumnLeft');
2791 2791
         }
2792 2792
         if (count($this->outlines) > 0) {
2793
-            $this->put('/Outlines ' . $this->outlineRoot.' 0 R');
2793
+            $this->put('/Outlines ' . $this->outlineRoot . ' 0 R');
2794 2794
             $this->put('/PageMode /UseOutlines');
2795 2795
         }
2796 2796
         
Please login to merge, or discard this patch.
Braces   +159 added lines, -120 removed lines patch added patch discarded remove patch
@@ -259,8 +259,9 @@  discard block
 block discarded – undo
259 259
         // Set left, top and right margins
260 260
         $this->lMargin = $left;
261 261
         $this->tMargin = $top;
262
-        if($right===null)
263
-            $right = $left;
262
+        if($right===null) {
263
+                    $right = $left;
264
+        }
264 265
         $this->rMargin = $right;
265 266
     }
266 267
 
@@ -274,8 +275,9 @@  discard block
 block discarded – undo
274 275
     {
275 276
         // Set left margin
276 277
         $this->lMargin = $margin;
277
-        if($this->page>0 && $this->x<$margin)
278
-            $this->x = $margin;
278
+        if($this->page>0 && $this->x<$margin) {
279
+                    $this->x = $margin;
280
+        }
279 281
     }
280 282
 
281 283
     /**
@@ -347,14 +349,16 @@  discard block
 block discarded – undo
347 349
     public function setDisplayMode($zoom, string $layout='default') : void
348 350
     {
349 351
         // Set display mode in viewer
350
-        if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
351
-            $this->ZoomMode = $zoom;
352
-        else
353
-            $this->error('Incorrect zoom display mode: '.$zoom);
354
-        if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
355
-            $this->LayoutMode = $layout;
356
-        else
357
-            $this->error('Incorrect layout display mode: '.$layout);
352
+        if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
353
+                    $this->ZoomMode = $zoom;
354
+        } else {
355
+                    $this->error('Incorrect zoom display mode: '.$zoom);
356
+        }
357
+        if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
358
+                    $this->LayoutMode = $layout;
359
+        } else {
360
+                    $this->error('Incorrect layout display mode: '.$layout);
361
+        }
358 362
     }
359 363
 
360 364
     /**
@@ -369,10 +373,11 @@  discard block
 block discarded – undo
369 373
     public function setCompression(bool $compress) : void
370 374
     {
371 375
         // Set page compression
372
-        if(function_exists('gzcompress'))
373
-            $this->compress = $compress;
374
-        else
375
-            $this->compress = false;
376
+        if(function_exists('gzcompress')) {
377
+                    $this->compress = $compress;
378
+        } else {
379
+                    $this->compress = false;
380
+        }
376 381
     }
377 382
 
378 383
     /**
@@ -463,10 +468,12 @@  discard block
 block discarded – undo
463 468
     public function close() : void
464 469
     {
465 470
         // Terminate document
466
-        if($this->state==3)
467
-            return;
468
-        if($this->page==0)
469
-            $this->addPage();
471
+        if($this->state==3) {
472
+                    return;
473
+        }
474
+        if($this->page==0) {
475
+                    $this->addPage();
476
+        }
470 477
         // Page footer
471 478
         $this->InFooter = true;
472 479
         $this->footer();
@@ -682,8 +689,9 @@  discard block
 block discarded – undo
682 689
         $cw = &$this->CurrentFont['cw'];
683 690
         $w = 0;
684 691
         $l = strlen($s);
685
-        for($i=0;$i<$l;$i++)
686
-            $w += $cw[$s[$i]];
692
+        for($i=0;$i<$l;$i++) {
693
+                    $w += $cw[$s[$i]];
694
+        }
687 695
         return $w*$this->FontSize/1000;
688 696
     }
689 697
     
@@ -697,8 +705,9 @@  discard block
 block discarded – undo
697 705
     {
698 706
         // Set line width
699 707
         $this->LineWidth = $width;
700
-        if($this->page>0)
701
-            $this->out(sprintf('%.2F w',$width*$this->k));
708
+        if($this->page>0) {
709
+                    $this->out(sprintf('%.2F w',$width*$this->k));
710
+        }
702 711
     }
703 712
     
704 713
     /**
@@ -734,12 +743,13 @@  discard block
 block discarded – undo
734 743
     public function rect(float $x, float $y, float $w, float $h, string $style='') : void
735 744
     {
736 745
         // Draw a rectangle
737
-        if($style=='F')
738
-            $op = 'f';
739
-        elseif($style=='FD' || $style=='DF')
740
-            $op = 'B';
741
-        else
742
-            $op = 'S';
746
+        if($style=='F') {
747
+                    $op = 'f';
748
+        } elseif($style=='FD' || $style=='DF') {
749
+                    $op = 'B';
750
+        } else {
751
+                    $op = 'S';
752
+        }
743 753
         $this->out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
744 754
     }
745 755
     
@@ -764,23 +774,27 @@  discard block
 block discarded – undo
764 774
     {
765 775
         // Add a TrueType, OpenType or Type1 font
766 776
         $family = strtolower($family);
767
-        if($file=='')
768
-            $file = str_replace(' ','',$family).strtolower($style).'.php';
777
+        if($file=='') {
778
+                    $file = str_replace(' ','',$family).strtolower($style).'.php';
779
+        }
769 780
         $style = strtoupper($style);
770
-        if($style=='IB')
771
-            $style = 'BI';
781
+        if($style=='IB') {
782
+                    $style = 'BI';
783
+        }
772 784
         $fontkey = $family.$style;
773
-        if(isset($this->fonts[$fontkey]))
774
-            return;
785
+        if(isset($this->fonts[$fontkey])) {
786
+                    return;
787
+        }
775 788
         $info = $this->loadFont($file);
776 789
         $info['i'] = count($this->fonts)+1;
777 790
         if(!empty($info['file']))
778 791
         {
779 792
             // Embedded font
780
-            if($info['type']=='TrueType')
781
-                $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
782
-            else
783
-                $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
793
+            if($info['type']=='TrueType') {
794
+                            $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
795
+            } else {
796
+                            $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
797
+            }
784 798
         }
785 799
         $this->fonts[$fontkey] = $info;
786 800
     }
@@ -823,42 +837,49 @@  discard block
 block discarded – undo
823 837
     public function setFont(string $family, string $style='', float $size=0) : void
824 838
     {
825 839
         // Select a font; size given in points
826
-        if($family=='')
827
-            $family = $this->FontFamily;
828
-        else
829
-            $family = strtolower($family);
840
+        if($family=='') {
841
+                    $family = $this->FontFamily;
842
+        } else {
843
+                    $family = strtolower($family);
844
+        }
830 845
         $style = strtoupper($style);
831 846
         if(strpos($style,'U')!==false)
832 847
         {
833 848
             $this->underline = true;
834 849
             $style = str_replace('U','',$style);
850
+        } else {
851
+                    $this->underline = false;
852
+        }
853
+        if($style=='IB') {
854
+                    $style = 'BI';
855
+        }
856
+        if($size==0) {
857
+                    $size = $this->FontSizePt;
835 858
         }
836
-        else
837
-            $this->underline = false;
838
-        if($style=='IB')
839
-            $style = 'BI';
840
-        if($size==0)
841
-            $size = $this->FontSizePt;
842 859
         // Test if font is already selected
843
-        if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
844
-            return;
860
+        if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) {
861
+                    return;
862
+        }
845 863
         // Test if font is already loaded
846 864
         $fontkey = $family.$style;
847 865
         if(!isset($this->fonts[$fontkey]))
848 866
         {
849 867
             // Test if one of the core fonts
850
-            if($family=='arial')
851
-                $family = 'helvetica';
868
+            if($family=='arial') {
869
+                            $family = 'helvetica';
870
+            }
852 871
             if(in_array($family,$this->CoreFonts))
853 872
             {
854
-                if($family=='symbol' || $family=='zapfdingbats')
855
-                    $style = '';
873
+                if($family=='symbol' || $family=='zapfdingbats') {
874
+                                    $style = '';
875
+                }
856 876
                 $fontkey = $family.$style;
857
-                if(!isset($this->fonts[$fontkey]))
858
-                    $this->addFont($family,$style);
877
+                if(!isset($this->fonts[$fontkey])) {
878
+                                    $this->addFont($family,$style);
879
+                }
880
+            } else {
881
+                            $this->error('Undefined font: '.$family.' '.$style);
859 882
             }
860
-            else
861
-                $this->error('Undefined font: '.$family.' '.$style);
862 883
         }
863 884
         // Select it
864 885
         $this->FontFamily = $family;
@@ -866,8 +887,9 @@  discard block
 block discarded – undo
866 887
         $this->FontSizePt = $size;
867 888
         $this->FontSize = $size/$this->k;
868 889
         $this->CurrentFont = &$this->fonts[$fontkey];
869
-        if($this->page>0)
870
-            $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
890
+        if($this->page>0) {
891
+                    $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
892
+        }
871 893
     }
872 894
     
873 895
     /**
@@ -1135,16 +1157,19 @@  discard block
 block discarded – undo
1135 1157
     public function multiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void
1136 1158
     {
1137 1159
         // Output text with automatic or explicit line breaks
1138
-        if(!isset($this->CurrentFont))
1139
-            $this->error('No font has been set');
1160
+        if(!isset($this->CurrentFont)) {
1161
+                    $this->error('No font has been set');
1162
+        }
1140 1163
         $cw = &$this->CurrentFont['cw'];
1141
-        if($w==0)
1142
-            $w = $this->w-$this->rMargin-$this->x;
1164
+        if($w==0) {
1165
+                    $w = $this->w-$this->rMargin-$this->x;
1166
+        }
1143 1167
         $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1144 1168
         $s = str_replace("\r",'',$txt);
1145 1169
         $nb = strlen($s);
1146
-        if($nb>0 && $s[$nb-1]=="\n")
1147
-            $nb--;
1170
+        if($nb>0 && $s[$nb-1]=="\n") {
1171
+                    $nb--;
1172
+        }
1148 1173
         $b = 0;
1149 1174
         $b2 = '';
1150 1175
         if($border)
@@ -1154,14 +1179,15 @@  discard block
 block discarded – undo
1154 1179
                 $border = 'LTRB';
1155 1180
                 $b = 'LRT';
1156 1181
                 $b2 = 'LR';
1157
-            }
1158
-            else
1182
+            } else
1159 1183
             {
1160 1184
                 $b2 = '';
1161
-                if(strpos($border,'L')!==false)
1162
-                    $b2 .= 'L';
1163
-                if(strpos($border,'R')!==false)
1164
-                    $b2 .= 'R';
1185
+                if(strpos($border,'L')!==false) {
1186
+                                    $b2 .= 'L';
1187
+                }
1188
+                if(strpos($border,'R')!==false) {
1189
+                                    $b2 .= 'R';
1190
+                }
1165 1191
                 $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
1166 1192
             }
1167 1193
         }
@@ -1191,8 +1217,9 @@  discard block
 block discarded – undo
1191 1217
                 $l = 0;
1192 1218
                 $ns = 0;
1193 1219
                 $nl++;
1194
-                if($border && $nl==2)
1195
-                    $b = $b2;
1220
+                if($border && $nl==2) {
1221
+                                    $b = $b2;
1222
+                }
1196 1223
                 continue;
1197 1224
             }
1198 1225
             if($c==' ')
@@ -1207,16 +1234,16 @@  discard block
 block discarded – undo
1207 1234
                 // Automatic line break
1208 1235
                 if($sep==-1)
1209 1236
                 {
1210
-                    if($i==$j)
1211
-                        $i++;
1237
+                    if($i==$j) {
1238
+                                            $i++;
1239
+                    }
1212 1240
                     if($this->ws>0)
1213 1241
                     {
1214 1242
                         $this->ws = 0;
1215 1243
                         $this->out('0 Tw');
1216 1244
                     }
1217 1245
                     $this->cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1218
-                }
1219
-                else
1246
+                } else
1220 1247
                 {
1221 1248
                     if($align=='J')
1222 1249
                     {
@@ -1231,11 +1258,12 @@  discard block
 block discarded – undo
1231 1258
                 $l = 0;
1232 1259
                 $ns = 0;
1233 1260
                 $nl++;
1234
-                if($border && $nl==2)
1235
-                    $b = $b2;
1261
+                if($border && $nl==2) {
1262
+                                    $b = $b2;
1263
+                }
1264
+            } else {
1265
+                            $i++;
1236 1266
             }
1237
-            else
1238
-                $i++;
1239 1267
         }
1240 1268
         // Last chunk
1241 1269
         if($this->ws>0)
@@ -1243,8 +1271,9 @@  discard block
 block discarded – undo
1243 1271
             $this->ws = 0;
1244 1272
             $this->out('0 Tw');
1245 1273
         }
1246
-        if($border && strpos($border,'B')!==false)
1247
-            $b .= 'B';
1274
+        if($border && strpos($border,'B')!==false) {
1275
+                    $b .= 'B';
1276
+        }
1248 1277
         $this->cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1249 1278
         $this->x = $this->lMargin;
1250 1279
     }
@@ -1262,8 +1291,9 @@  discard block
 block discarded – undo
1262 1291
     public function write(float $h, string $txt, $link='') : void
1263 1292
     {
1264 1293
         // Output text in flowing mode
1265
-        if(!isset($this->CurrentFont))
1266
-            $this->error('No font has been set');
1294
+        if(!isset($this->CurrentFont)) {
1295
+                    $this->error('No font has been set');
1296
+        }
1267 1297
         $cw = &$this->CurrentFont['cw'];
1268 1298
         $w = $this->w-$this->rMargin-$this->x;
1269 1299
         $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
@@ -1295,8 +1325,9 @@  discard block
 block discarded – undo
1295 1325
                 $nl++;
1296 1326
                 continue;
1297 1327
             }
1298
-            if($c==' ')
1299
-                $sep = $i;
1328
+            if($c==' ') {
1329
+                            $sep = $i;
1330
+            }
1300 1331
             $l += $cw[$c];
1301 1332
             if($l>$wmax)
1302 1333
             {
@@ -1314,11 +1345,11 @@  discard block
 block discarded – undo
1314 1345
                         $nl++;
1315 1346
                         continue;
1316 1347
                     }
1317
-                    if($i==$j)
1318
-                        $i++;
1348
+                    if($i==$j) {
1349
+                                            $i++;
1350
+                    }
1319 1351
                     $this->cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
1320
-                }
1321
-                else
1352
+                } else
1322 1353
                 {
1323 1354
                     $this->cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
1324 1355
                     $i = $sep+1;
@@ -1333,13 +1364,14 @@  discard block
 block discarded – undo
1333 1364
                     $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1334 1365
                 }
1335 1366
                 $nl++;
1367
+            } else {
1368
+                            $i++;
1336 1369
             }
1337
-            else
1338
-                $i++;
1339 1370
         }
1340 1371
         // Last chunk
1341
-        if($i!=$j)
1342
-            $this->cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
1372
+        if($i!=$j) {
1373
+                    $this->cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
1374
+        }
1343 1375
     }
1344 1376
     
1345 1377
     /**
@@ -1353,10 +1385,11 @@  discard block
 block discarded – undo
1353 1385
     {
1354 1386
         // Line feed; default value is the last cell height
1355 1387
         $this->x = $this->lMargin;
1356
-        if($h===null)
1357
-            $this->y += $this->lasth;
1358
-        else
1359
-            $this->y += $h;
1388
+        if($h===null) {
1389
+                    $this->y += $this->lasth;
1390
+        } else {
1391
+                    $this->y += $h;
1392
+        }
1360 1393
     }
1361 1394
     
1362 1395
     /**
@@ -1534,10 +1567,11 @@  discard block
 block discarded – undo
1534 1567
     public function setX(float $x) : void
1535 1568
     {
1536 1569
         // Set x position
1537
-        if($x>=0)
1538
-            $this->x = $x;
1539
-        else
1540
-            $this->x = $this->w+$x;
1570
+        if($x>=0) {
1571
+                    $this->x = $x;
1572
+        } else {
1573
+                    $this->x = $this->w+$x;
1574
+        }
1541 1575
     }
1542 1576
 
1543 1577
     /**
@@ -1559,12 +1593,14 @@  discard block
 block discarded – undo
1559 1593
     public function setY(float $y, bool $resetX=true) : void
1560 1594
     {
1561 1595
         // Set y position and optionally reset x
1562
-        if($y>=0)
1563
-            $this->y = $y;
1564
-        else
1565
-            $this->y = $this->h+$y;
1566
-        if($resetX)
1567
-            $this->x = $this->lMargin;
1596
+        if($y>=0) {
1597
+                    $this->y = $y;
1598
+        } else {
1599
+                    $this->y = $this->h+$y;
1600
+        }
1601
+        if($resetX) {
1602
+                    $this->x = $this->lMargin;
1603
+        }
1568 1604
     }
1569 1605
     
1570 1606
     /**
@@ -1609,10 +1645,12 @@  discard block
 block discarded – undo
1609 1645
             $dest = $name;
1610 1646
             $name = $tmp;
1611 1647
         }
1612
-        if($dest=='')
1613
-            $dest = 'I';
1614
-        if($name=='')
1615
-            $name = 'doc.pdf';
1648
+        if($dest=='') {
1649
+                    $dest = 'I';
1650
+        }
1651
+        if($name=='') {
1652
+                    $name = 'doc.pdf';
1653
+        }
1616 1654
         switch(strtoupper($dest))
1617 1655
         {
1618 1656
             case 'I':
@@ -1639,8 +1677,9 @@  discard block
 block discarded – undo
1639 1677
                 break;
1640 1678
             case 'F':
1641 1679
                 // Save to local file
1642
-                if(!file_put_contents($name,$this->buffer))
1643
-                    $this->error('Unable to create output file: '.$name);
1680
+                if(!file_put_contents($name,$this->buffer)) {
1681
+                                    $this->error('Unable to create output file: '.$name);
1682
+                }
1644 1683
                 break;
1645 1684
             case 'S':
1646 1685
                 // Return as a string
@@ -2701,9 +2740,9 @@  discard block
 block discarded – undo
2701 2740
                     // Level increasing: set first pointer
2702 2741
                     $this->outlines[$parent]['first'] = $i;
2703 2742
                 }
2743
+            } else {
2744
+                            $this->outlines[$i]['parent'] = $nb;
2704 2745
             }
2705
-            else
2706
-                $this->outlines[$i]['parent'] = $nb;
2707 2746
                 if ($o['l'] <= $level && $i > 0) {
2708 2747
                     // Set prev and next pointers
2709 2748
                     $prev = $lru[$o['l']];
Please login to merge, or discard this patch.