Passed
Push — main ( b08f68...83c25f )
by Stefan
02:16
created
OPlathey/FPDF/FPDF.php 1 patch
Braces   +231 added lines, -171 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
     /**
@@ -877,12 +899,14 @@  discard block
 block discarded – undo
877 899
     public function SetFontSize(float $size) : void
878 900
     {
879 901
         // Set font size in points
880
-        if($this->FontSizePt==$size)
881
-            return;
902
+        if($this->FontSizePt==$size) {
903
+                    return;
904
+        }
882 905
         $this->FontSizePt = $size;
883 906
         $this->FontSize = $size/$this->k;
884
-        if($this->page>0)
885
-            $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
907
+        if($this->page>0) {
908
+                    $this->out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
909
+        }
886 910
     }
887 911
     
888 912
     /**
@@ -909,10 +933,12 @@  discard block
 block discarded – undo
909 933
     public function SetLink(int $link, float $y=0, int $page=-1) : void
910 934
     {
911 935
         // Set destination of internal link
912
-        if($y==-1)
913
-            $y = $this->y;
914
-        if($page==-1)
915
-            $page = $this->page;
936
+        if($y==-1) {
937
+                    $y = $this->y;
938
+        }
939
+        if($page==-1) {
940
+                    $page = $this->page;
941
+        }
916 942
         $this->links[$link] = array($page, $y);
917 943
     }
918 944
     
@@ -946,13 +972,16 @@  discard block
 block discarded – undo
946 972
     public function Text(float $x, float $y, string $txt) : void
947 973
     {
948 974
         // Output a string
949
-        if(!isset($this->CurrentFont))
950
-            $this->Error('No font has been set');
975
+        if(!isset($this->CurrentFont)) {
976
+                    $this->Error('No font has been set');
977
+        }
951 978
         $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->escape($txt));
952
-        if($this->underline && $txt!='')
953
-            $s .= ' '.$this->doUnderline($x,$y,$txt);
954
-        if($this->ColorFlag)
955
-            $s = 'q '.$this->TextColor.' '.$s.' Q';
979
+        if($this->underline && $txt!='') {
980
+                    $s .= ' '.$this->doUnderline($x,$y,$txt);
981
+        }
982
+        if($this->ColorFlag) {
983
+                    $s = 'q '.$this->TextColor.' '.$s.' Q';
984
+        }
956 985
         $this->out($s);
957 986
     }
958 987
     
@@ -1032,62 +1061,76 @@  discard block
 block discarded – undo
1032 1061
                 $this->out(sprintf('%.3F Tw',$ws*$k));
1033 1062
             }
1034 1063
         }
1035
-        if($w==0)
1036
-            $w = $this->w-$this->rMargin-$this->x;
1064
+        if($w==0) {
1065
+                    $w = $this->w-$this->rMargin-$this->x;
1066
+        }
1037 1067
         $s = '';
1038 1068
         if($fill || $border==1)
1039 1069
         {
1040
-            if($fill)
1041
-                $op = ($border==1) ? 'B' : 'f';
1042
-            else
1043
-                $op = 'S';
1070
+            if($fill) {
1071
+                            $op = ($border==1) ? 'B' : 'f';
1072
+            } else {
1073
+                            $op = 'S';
1074
+            }
1044 1075
             $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
1045 1076
         }
1046 1077
         if(is_string($border))
1047 1078
         {
1048 1079
             $x = $this->x;
1049 1080
             $y = $this->y;
1050
-            if(strpos($border,'L')!==false)
1051
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
1052
-            if(strpos($border,'T')!==false)
1053
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
1054
-            if(strpos($border,'R')!==false)
1055
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
1056
-            if(strpos($border,'B')!==false)
1057
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
1081
+            if(strpos($border,'L')!==false) {
1082
+                            $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
1083
+            }
1084
+            if(strpos($border,'T')!==false) {
1085
+                            $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
1086
+            }
1087
+            if(strpos($border,'R')!==false) {
1088
+                            $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
1089
+            }
1090
+            if(strpos($border,'B')!==false) {
1091
+                            $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
1092
+            }
1058 1093
         }
1059 1094
         if($txt!=='')
1060 1095
         {
1061
-            if(!isset($this->CurrentFont))
1062
-                $this->Error('No font has been set');
1063
-            if($align=='R')
1064
-                $dx = $w-$this->cMargin-$this->getStringWidth($txt);
1065
-            elseif($align=='C')
1066
-                $dx = ($w-$this->getStringWidth($txt))/2;
1067
-            else
1068
-                $dx = $this->cMargin;
1069
-            if($this->ColorFlag)
1070
-                $s .= 'q '.$this->TextColor.' ';
1096
+            if(!isset($this->CurrentFont)) {
1097
+                            $this->Error('No font has been set');
1098
+            }
1099
+            if($align=='R') {
1100
+                            $dx = $w-$this->cMargin-$this->getStringWidth($txt);
1101
+            } elseif($align=='C') {
1102
+                            $dx = ($w-$this->getStringWidth($txt))/2;
1103
+            } else {
1104
+                            $dx = $this->cMargin;
1105
+            }
1106
+            if($this->ColorFlag) {
1107
+                            $s .= 'q '.$this->TextColor.' ';
1108
+            }
1071 1109
             $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->escape($txt));
1072
-            if($this->underline)
1073
-                $s .= ' '.$this->doUnderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
1074
-            if($this->ColorFlag)
1075
-                $s .= ' Q';
1076
-            if($link)
1077
-                $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link);
1078
-        }
1079
-        if($s)
1080
-            $this->out($s);
1110
+            if($this->underline) {
1111
+                            $s .= ' '.$this->doUnderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
1112
+            }
1113
+            if($this->ColorFlag) {
1114
+                            $s .= ' Q';
1115
+            }
1116
+            if($link) {
1117
+                            $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->getStringWidth($txt),$this->FontSize,$link);
1118
+            }
1119
+        }
1120
+        if($s) {
1121
+                    $this->out($s);
1122
+        }
1081 1123
         $this->lasth = $h;
1082 1124
         if($ln>0)
1083 1125
         {
1084 1126
             // Go to next line
1085 1127
             $this->y += $h;
1086
-            if($ln==1)
1087
-                $this->x = $this->lMargin;
1128
+            if($ln==1) {
1129
+                            $this->x = $this->lMargin;
1130
+            }
1131
+        } else {
1132
+                    $this->x += $w;
1088 1133
         }
1089
-        else
1090
-            $this->x += $w;
1091 1134
     }
1092 1135
     
1093 1136
     /**
@@ -1121,16 +1164,19 @@  discard block
 block discarded – undo
1121 1164
     public function MultiCell(float $w, float $h, string $txt, $border=0, string $align='J', bool $fill=false) : void
1122 1165
     {
1123 1166
         // Output text with automatic or explicit line breaks
1124
-        if(!isset($this->CurrentFont))
1125
-            $this->Error('No font has been set');
1167
+        if(!isset($this->CurrentFont)) {
1168
+                    $this->Error('No font has been set');
1169
+        }
1126 1170
         $cw = &$this->CurrentFont['cw'];
1127
-        if($w==0)
1128
-            $w = $this->w-$this->rMargin-$this->x;
1171
+        if($w==0) {
1172
+                    $w = $this->w-$this->rMargin-$this->x;
1173
+        }
1129 1174
         $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1130 1175
         $s = str_replace("\r",'',$txt);
1131 1176
         $nb = strlen($s);
1132
-        if($nb>0 && $s[$nb-1]=="\n")
1133
-            $nb--;
1177
+        if($nb>0 && $s[$nb-1]=="\n") {
1178
+                    $nb--;
1179
+        }
1134 1180
         $b = 0;
1135 1181
         $b2 = '';
1136 1182
         if($border)
@@ -1140,14 +1186,15 @@  discard block
 block discarded – undo
1140 1186
                 $border = 'LTRB';
1141 1187
                 $b = 'LRT';
1142 1188
                 $b2 = 'LR';
1143
-            }
1144
-            else
1189
+            } else
1145 1190
             {
1146 1191
                 $b2 = '';
1147
-                if(strpos($border,'L')!==false)
1148
-                    $b2 .= 'L';
1149
-                if(strpos($border,'R')!==false)
1150
-                    $b2 .= 'R';
1192
+                if(strpos($border,'L')!==false) {
1193
+                                    $b2 .= 'L';
1194
+                }
1195
+                if(strpos($border,'R')!==false) {
1196
+                                    $b2 .= 'R';
1197
+                }
1151 1198
                 $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
1152 1199
             }
1153 1200
         }
@@ -1177,8 +1224,9 @@  discard block
 block discarded – undo
1177 1224
                 $l = 0;
1178 1225
                 $ns = 0;
1179 1226
                 $nl++;
1180
-                if($border && $nl==2)
1181
-                    $b = $b2;
1227
+                if($border && $nl==2) {
1228
+                                    $b = $b2;
1229
+                }
1182 1230
                 continue;
1183 1231
             }
1184 1232
             if($c==' ')
@@ -1193,16 +1241,16 @@  discard block
 block discarded – undo
1193 1241
                 // Automatic line break
1194 1242
                 if($sep==-1)
1195 1243
                 {
1196
-                    if($i==$j)
1197
-                        $i++;
1244
+                    if($i==$j) {
1245
+                                            $i++;
1246
+                    }
1198 1247
                     if($this->ws>0)
1199 1248
                     {
1200 1249
                         $this->ws = 0;
1201 1250
                         $this->out('0 Tw');
1202 1251
                     }
1203 1252
                     $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1204
-                }
1205
-                else
1253
+                } else
1206 1254
                 {
1207 1255
                     if($align=='J')
1208 1256
                     {
@@ -1217,11 +1265,12 @@  discard block
 block discarded – undo
1217 1265
                 $l = 0;
1218 1266
                 $ns = 0;
1219 1267
                 $nl++;
1220
-                if($border && $nl==2)
1221
-                    $b = $b2;
1268
+                if($border && $nl==2) {
1269
+                                    $b = $b2;
1270
+                }
1271
+            } else {
1272
+                            $i++;
1222 1273
             }
1223
-            else
1224
-                $i++;
1225 1274
         }
1226 1275
         // Last chunk
1227 1276
         if($this->ws>0)
@@ -1229,8 +1278,9 @@  discard block
 block discarded – undo
1229 1278
             $this->ws = 0;
1230 1279
             $this->out('0 Tw');
1231 1280
         }
1232
-        if($border && strpos($border,'B')!==false)
1233
-            $b .= 'B';
1281
+        if($border && strpos($border,'B')!==false) {
1282
+                    $b .= 'B';
1283
+        }
1234 1284
         $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
1235 1285
         $this->x = $this->lMargin;
1236 1286
     }
@@ -1248,8 +1298,9 @@  discard block
 block discarded – undo
1248 1298
     public function Write(float $h, string $txt, $link='') : void
1249 1299
     {
1250 1300
         // Output text in flowing mode
1251
-        if(!isset($this->CurrentFont))
1252
-            $this->Error('No font has been set');
1301
+        if(!isset($this->CurrentFont)) {
1302
+                    $this->Error('No font has been set');
1303
+        }
1253 1304
         $cw = &$this->CurrentFont['cw'];
1254 1305
         $w = $this->w-$this->rMargin-$this->x;
1255 1306
         $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
@@ -1281,8 +1332,9 @@  discard block
 block discarded – undo
1281 1332
                 $nl++;
1282 1333
                 continue;
1283 1334
             }
1284
-            if($c==' ')
1285
-                $sep = $i;
1335
+            if($c==' ') {
1336
+                            $sep = $i;
1337
+            }
1286 1338
             $l += $cw[$c];
1287 1339
             if($l>$wmax)
1288 1340
             {
@@ -1300,11 +1352,11 @@  discard block
 block discarded – undo
1300 1352
                         $nl++;
1301 1353
                         continue;
1302 1354
                     }
1303
-                    if($i==$j)
1304
-                        $i++;
1355
+                    if($i==$j) {
1356
+                                            $i++;
1357
+                    }
1305 1358
                     $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
1306
-                }
1307
-                else
1359
+                } else
1308 1360
                 {
1309 1361
                     $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
1310 1362
                     $i = $sep+1;
@@ -1319,13 +1371,14 @@  discard block
 block discarded – undo
1319 1371
                     $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
1320 1372
                 }
1321 1373
                 $nl++;
1374
+            } else {
1375
+                            $i++;
1322 1376
             }
1323
-            else
1324
-                $i++;
1325 1377
         }
1326 1378
         // Last chunk
1327
-        if($i!=$j)
1328
-            $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
1379
+        if($i!=$j) {
1380
+                    $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
1381
+        }
1329 1382
     }
1330 1383
     
1331 1384
     /**
@@ -1339,10 +1392,11 @@  discard block
 block discarded – undo
1339 1392
     {
1340 1393
         // Line feed; default value is the last cell height
1341 1394
         $this->x = $this->lMargin;
1342
-        if($h===null)
1343
-            $this->y += $this->lasth;
1344
-        else
1345
-            $this->y += $h;
1395
+        if($h===null) {
1396
+                    $this->y += $this->lasth;
1397
+        } else {
1398
+                    $this->y += $h;
1399
+        }
1346 1400
     }
1347 1401
     
1348 1402
     /**
@@ -1520,10 +1574,11 @@  discard block
 block discarded – undo
1520 1574
     public function SetX(float $x) : void
1521 1575
     {
1522 1576
         // Set x position
1523
-        if($x>=0)
1524
-            $this->x = $x;
1525
-        else
1526
-            $this->x = $this->w+$x;
1577
+        if($x>=0) {
1578
+                    $this->x = $x;
1579
+        } else {
1580
+                    $this->x = $this->w+$x;
1581
+        }
1527 1582
     }
1528 1583
 
1529 1584
     /**
@@ -1545,12 +1600,14 @@  discard block
 block discarded – undo
1545 1600
     public function SetY(float $y, bool $resetX=true) : void
1546 1601
     {
1547 1602
         // Set y position and optionally reset x
1548
-        if($y>=0)
1549
-            $this->y = $y;
1550
-        else
1551
-            $this->y = $this->h+$y;
1552
-        if($resetX)
1553
-            $this->x = $this->lMargin;
1603
+        if($y>=0) {
1604
+                    $this->y = $y;
1605
+        } else {
1606
+                    $this->y = $this->h+$y;
1607
+        }
1608
+        if($resetX) {
1609
+                    $this->x = $this->lMargin;
1610
+        }
1554 1611
     }
1555 1612
     
1556 1613
     /**
@@ -1595,10 +1652,12 @@  discard block
 block discarded – undo
1595 1652
             $dest = $name;
1596 1653
             $name = $tmp;
1597 1654
         }
1598
-        if($dest=='')
1599
-            $dest = 'I';
1600
-        if($name=='')
1601
-            $name = 'doc.pdf';
1655
+        if($dest=='') {
1656
+                    $dest = 'I';
1657
+        }
1658
+        if($name=='') {
1659
+                    $name = 'doc.pdf';
1660
+        }
1602 1661
         switch(strtoupper($dest))
1603 1662
         {
1604 1663
             case 'I':
@@ -1625,8 +1684,9 @@  discard block
 block discarded – undo
1625 1684
                 break;
1626 1685
             case 'F':
1627 1686
                 // Save to local file
1628
-                if(!file_put_contents($name,$this->buffer))
1629
-                    $this->Error('Unable to create output file: '.$name);
1687
+                if(!file_put_contents($name,$this->buffer)) {
1688
+                                    $this->Error('Unable to create output file: '.$name);
1689
+                }
1630 1690
                 break;
1631 1691
             case 'S':
1632 1692
                 // Return as a string
@@ -2688,9 +2748,9 @@  discard block
 block discarded – undo
2688 2748
                     // Level increasing: set first pointer
2689 2749
                     $this->outlines[$parent]['first'] = $i;
2690 2750
                 }
2751
+            } else {
2752
+                            $this->outlines[$i]['parent'] = $nb;
2691 2753
             }
2692
-            else
2693
-                $this->outlines[$i]['parent'] = $nb;
2694 2754
                 if ($o['l'] <= $level && $i > 0) {
2695 2755
                     // Set prev and next pointers
2696 2756
                     $prev = $lru[$o['l']];
Please login to merge, or discard this patch.