Passed
Pull Request — master (#224)
by Eduardo
02:48
created
src/Legacy/FilesFolders.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 class FilesFolders
19 19
 {
20 20
     
21
-    protected static $ambientes = array('homologacao','producao');
21
+    protected static $ambientes = array('homologacao', 'producao');
22 22
     protected static $subdirs = array(
23 23
         'entradas',
24 24
         'assinadas',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             . DIRECTORY_SEPARATOR
70 70
             . $subdir;
71 71
         
72
-        if (! is_dir($path)) {
72
+        if (!is_dir($path)) {
73 73
             $msg = "Não existe o diretorio $path !";
74 74
             throw new RuntimeException($msg);
75 75
         }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         //monta a arvore de diretórios necessária e estabelece permissões de acesso
89 89
         self::createFolder($dirPath);
90 90
         foreach (self::$ambientes as $ambiente) {
91
-            $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente;
91
+            $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente;
92 92
             self::createFolder($folder);
93 93
             foreach (self::$subdirs as $subdir) {
94
-                $folder = $dirPath.DIRECTORY_SEPARATOR.$ambiente.DIRECTORY_SEPARATOR.$subdir;
94
+                $folder = $dirPath . DIRECTORY_SEPARATOR . $ambiente . DIRECTORY_SEPARATOR . $subdir;
95 95
                 self::createFolder($folder);
96 96
             }
97 97
         }
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function createFolder($folder = '')
107 107
     {
108
-        if (! is_dir($folder)) {
109
-            if (! mkdir($folder, 0777, true)) {
108
+        if (!is_dir($folder)) {
109
+            if (!mkdir($folder, 0777, true)) {
110 110
                 throw new RuntimeException(
111 111
                     "Não foi possivel criar o diretorio $folder. Verifique as permissões"
112 112
                 );
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
     public static function saveFile($path = '', $filename = '', $content = '')
125 125
     {
126 126
         self::createFolder($path);
127
-        $filePath = $path.DIRECTORY_SEPARATOR.$filename;
128
-        if (! file_put_contents($filePath, $content)) {
127
+        $filePath = $path . DIRECTORY_SEPARATOR . $filename;
128
+        if (!file_put_contents($filePath, $content)) {
129 129
             return false;
130 130
         }
131
-        if (! chmod($filePath, 0777)) {
131
+        if (!chmod($filePath, 0777)) {
132 132
             return false;
133 133
         }
134 134
         return true;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                 "É necessário passar os parametros diretório e filtro!!!"
151 151
             );
152 152
         }
153
-        if (! is_dir($folder)) {
153
+        if (!is_dir($folder)) {
154 154
             throw new InvalidArgumentException(
155 155
                 "O diretório não existe $folder !!!"
156 156
             );
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
         $aList = array();
159 159
         $search = $folder;
160 160
         if (substr($folder, -1) == DIRECTORY_SEPARATOR) {
161
-            $search = substr($folder, 0, strlen($folder)-1);
161
+            $search = substr($folder, 0, strlen($folder) - 1);
162 162
         }
163
-        $searchmatch = $search.DIRECTORY_SEPARATOR.$fileMatch;
163
+        $searchmatch = $search . DIRECTORY_SEPARATOR . $fileMatch;
164 164
         $aGlob = glob($searchmatch);
165 165
         $aList = $aGlob;
166
-        if (! $retpath && ! empty($aGlob)) {
166
+        if (!$retpath && !empty($aGlob)) {
167 167
             $aList = array();
168 168
             foreach ($aGlob as $pathFile) {
169
-                $aList[] = str_replace($search.DIRECTORY_SEPARATOR, '', $pathFile);
169
+                $aList[] = str_replace($search . DIRECTORY_SEPARATOR, '', $pathFile);
170 170
             }
171 171
         }
172 172
         return $aList;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         $comentDir = 'O diretório NÃO EXISTE';
188 188
         $corDir = $cRed;
189 189
         if (is_dir($path)) {
190
-            $filen = $path.DIRECTORY_SEPARATOR.'teste.txt';
190
+            $filen = $path . DIRECTORY_SEPARATOR . 'teste.txt';
191 191
             $comentDir = ' Sem permissão !!';
192 192
             if (file_put_contents($filen, "teste\r\n")) {
193 193
                 $corDir = $cGreen;
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public static function removeFolder($dirPath)
215 215
     {
216
-        $files = array_diff(scandir($dirPath), array('.','..'));
216
+        $files = array_diff(scandir($dirPath), array('.', '..'));
217 217
         foreach ($files as $file) {
218 218
             if (is_dir("$dirPath/$file")) {
219 219
                 self::removeFolder("$dirPath/$file");
220 220
             } else {
221
-                if (! unlink("$dirPath/$file")) {
221
+                if (!unlink("$dirPath/$file")) {
222 222
                     throw new RuntimeException(
223 223
                         "Falha! sem permissão de exclusão do arquivo $dirPath/$file"
224 224
                     );
225 225
                 }
226 226
             }
227 227
         }
228
-        if (! rmdir($dirPath)) {
228
+        if (!rmdir($dirPath)) {
229 229
             $msg = "Falha! sem permissão de exclusão do diretório $dirPath";
230 230
             throw new RuntimeException($msg);
231 231
         }
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
             $msg = "Um caminho para o arquivo deve ser passado!!";
246 246
             throw new InvalidArgumentException($msg);
247 247
         }
248
-        if (! is_file($pathFile)) {
248
+        if (!is_file($pathFile)) {
249 249
             $msg = "O arquivo indicado não foi localizado!! $pathFile";
250 250
             throw new InvalidArgumentException($msg);
251 251
         }
252
-        if (! is_readable($pathFile)) {
252
+        if (!is_readable($pathFile)) {
253 253
             $msg = "O arquivo indicado não pode ser lido. Permissões!! $pathFile";
254 254
             throw new RuntimeException($msg);
255 255
         }
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/courier.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-for ($i=0; $i<=255; $i++) {
3
-    $fpdf_charwidths['courier'][chr($i)]=600;
2
+for ($i = 0; $i <= 255; $i++) {
3
+    $fpdf_charwidths['courier'][chr($i)] = 600;
4 4
 }
5
-$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];
6
-$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];
7
-$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];
5
+$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier'];
6
+$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier'];
7
+$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier'];
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/makefont/makefont.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
10 10
 function readMap($enc)
11 11
 {
12 12
     //Read a map file
13
-    $file = dirname(__FILE__).'/'.strtolower($enc).'.map';
13
+    $file = dirname(__FILE__) . '/' . strtolower($enc) . '.map';
14 14
     $a = file($file);
15 15
     if (empty($a)) {
16
-        die('<b>Error:</b> encoding not found: '.$enc);
16
+        die('<b>Error:</b> encoding not found: ' . $enc);
17 17
     }
18 18
     $cc2gn = array();
19 19
     foreach ($a as $l) {
20
-        if ($l[0]=='!') {
20
+        if ($l[0] == '!') {
21 21
             $e = preg_split('/[ \\t]+/', rtrim($l));
22 22
             $cc = hexdec(substr($e[0], 1));
23 23
             $gn = $e[2];
24 24
             $cc2gn[$cc] = $gn;
25 25
         }
26 26
     }
27
-    for ($i=0; $i<=255; $i++) {
27
+    for ($i = 0; $i <= 255; $i++) {
28 28
         if (!isset($cc2gn[$i])) {
29
-            $cc2gn[$i]='.notdef';
29
+            $cc2gn[$i] = '.notdef';
30 30
         }
31 31
     }
32 32
     return $cc2gn;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
     ];
79 79
     foreach ($a as $l) {
80 80
         $e = explode(' ', rtrim($l));
81
-        if (count($e)<2) {
81
+        if (count($e) < 2) {
82 82
             continue;
83 83
         }
84 84
         $code = $e[0];
85 85
         $param = $e[1];
86 86
         if ($code == 'C') {
87 87
             //Character metrics
88
-            $cc = (int)$e[1];
88
+            $cc = (int) $e[1];
89 89
             $w = $e[4];
90 90
             $gn = $e[7];
91 91
             if (substr($gn, -4) == '20AC') {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 //Fix incorrect glyph name
96 96
                 foreach ($map as $c => $n) {
97 97
                     if ($n == $fix[$gn]) {
98
-                        $map[$c]=$gn;
98
+                        $map[$c] = $gn;
99 99
                     }
100 100
                 }
101 101
             }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             } else {
106 106
                 $widths[$gn] = $w;
107 107
                 if ($gn == 'X') {
108
-                    $fm['CapXHeight']=$e[13];
108
+                    $fm['CapXHeight'] = $e[13];
109 109
                 }
110 110
             }
111 111
             if ($gn == '.notdef') {
@@ -116,23 +116,23 @@  discard block
 block discarded – undo
116 116
         } elseif ($code == 'Weight') {
117 117
             $fm['Weight'] = $param;
118 118
         } elseif ($code == 'ItalicAngle') {
119
-            $fm['ItalicAngle'] = (double)$param;
119
+            $fm['ItalicAngle'] = (double) $param;
120 120
         } elseif ($code == 'Ascender') {
121
-            $fm['Ascender'] = (int)$param;
121
+            $fm['Ascender'] = (int) $param;
122 122
         } elseif ($code == 'Descender') {
123
-            $fm['Descender'] = (int)$param;
123
+            $fm['Descender'] = (int) $param;
124 124
         } elseif ($code == 'UnderlineThickness') {
125
-            $fm['UnderlineThickness'] = (int)$param;
125
+            $fm['UnderlineThickness'] = (int) $param;
126 126
         } elseif ($code == 'UnderlinePosition') {
127
-            $fm['UnderlinePosition'] = (int)$param;
127
+            $fm['UnderlinePosition'] = (int) $param;
128 128
         } elseif ($code == 'IsFixedPitch') {
129 129
             $fm['IsFixedPitch'] = ($param == 'true');
130 130
         } elseif ($code == 'FontBBox') {
131 131
             $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]);
132 132
         } elseif ($code == 'CapHeight') {
133
-            $fm['CapHeight'] = (int)$param;
133
+            $fm['CapHeight'] = (int) $param;
134 134
         } elseif ($code == 'StdVW') {
135
-            $fm['StdVW'] = (int)$param;
135
+            $fm['StdVW'] = (int) $param;
136 136
         }
137 137
     }
138 138
     if (!isset($fm['FontName'])) {
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
             $widths['Delta'] = $widths['increment'];
147 147
         }
148 148
         //Order widths according to map
149
-        for ($i=0; $i<=255; $i++) {
149
+        for ($i = 0; $i <= 255; $i++) {
150 150
             if (!isset($widths[$map[$i]])) {
151
-                echo '<b>Warning:</b> character '.$map[$i].' is missing<br>';
151
+                echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>';
152 152
                 $widths[$i] = $widths['.notdef'];
153 153
             } else {
154 154
                 $widths[$i] = $widths[$map[$i]];
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 function makeFontDescriptor($fm, $symbolic)
163 163
 {
164 164
     //Ascent
165
-    $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
-    $fd = "array('Ascent'=>".$asc;
165
+    $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000);
166
+    $fd = "array('Ascent'=>" . $asc;
167 167
     //Descent
168 168
     $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200);
169
-    $fd .= ",'Descent'=>".$desc;
169
+    $fd .= ",'Descent'=>" . $desc;
170 170
     //CapHeight
171 171
     if (isset($fm['CapHeight'])) {
172 172
         $ch = $fm['CapHeight'];
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     } else {
176 176
         $ch = $asc;
177 177
     }
178
-    $fd .= ",'CapHeight'=>".$ch;
178
+    $fd .= ",'CapHeight'=>" . $ch;
179 179
     //Flags
180 180
     $flags = 0;
181 181
     if (isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) {
@@ -185,22 +185,22 @@  discard block
 block discarded – undo
185 185
         $flags += 1 << 2;
186 186
     }
187 187
     if (!$symbolic) {
188
-        $flags += 1<< 5;
188
+        $flags += 1 << 5;
189 189
     }
190
-    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) {
190
+    if (isset($fm['ItalicAngle']) && $fm['ItalicAngle'] != 0) {
191 191
         $flags += 1 << 6;
192 192
     }
193
-    $fd.=",'Flags'=>".$flags;
193
+    $fd .= ",'Flags'=>" . $flags;
194 194
     //FontBBox
195 195
     if (isset($fm['FontBBox'])) {
196 196
         $fbb = $fm['FontBBox'];
197 197
     } else {
198
-        $fbb = array(0,$desc-100,1000,$asc+100);
198
+        $fbb = array(0, $desc - 100, 1000, $asc + 100);
199 199
     }
200
-    $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'";
200
+    $fd .= ",'FontBBox'=>'[" . $fbb[0] . ' ' . $fbb[1] . ' ' . $fbb[2] . ' ' . $fbb[3] . "]'";
201 201
     //ItalicAngle
202 202
     $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0);
203
-    $fd .= ",'ItalicAngle'=>".$ia;
203
+    $fd .= ",'ItalicAngle'=>" . $ia;
204 204
     //StemV
205 205
     if (isset($fm['StdVW'])) {
206 206
         $stemv = $fm['StdVW'];
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
     } else {
210 210
         $stemv = 70;
211 211
     }
212
-    $fd .= ",'StemV'=>".$stemv;
212
+    $fd .= ",'StemV'=>" . $stemv;
213 213
     //MissingWidth
214 214
     if (isset($fm['MissingWidth'])) {
215
-        $fd .= ",'MissingWidth'=>".$fm['MissingWidth'];
215
+        $fd .= ",'MissingWidth'=>" . $fm['MissingWidth'];
216 216
     }
217 217
     $fd .= ')';
218 218
     return $fd;
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
     //Make character width array
224 224
     $s = "array(\n\t";
225 225
     $cw = $fm['Widths'];
226
-    for ($i=0; $i<=255; $i++) {
226
+    for ($i = 0; $i <= 255; $i++) {
227 227
         if (chr($i) == "'") {
228 228
             $s .= "'\\''";
229 229
         } elseif (chr($i) == "\\") {
230 230
             $s .= "'\\\\'";
231 231
         } elseif ($i >= 32 && $i <= 126) {
232
-            $s .= "'".chr($i)."'";
232
+            $s .= "'" . chr($i) . "'";
233 233
         } else {
234 234
             $s .= "chr($i)";
235 235
         }
236
-        $s .= '=>'.$fm['Widths'][$i];
236
+        $s .= '=>' . $fm['Widths'][$i];
237 237
         if ($i < 255) {
238 238
             $s .= ',';
239 239
         }
240
-        if (($i+1)%22==0) {
240
+        if (($i + 1) % 22 == 0) {
241 241
             $s .= "\n\t";
242 242
         }
243 243
     }
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
     $ref = readMap('cp1252');
252 252
     $s = '';
253 253
     $last = 0;
254
-    for ($i=32; $i<=255; $i++) {
255
-        if ($map[$i]!=$ref[$i]) {
256
-            if ($i!=$last+1) {
257
-                $s .= $i.' ';
254
+    for ($i = 32; $i <= 255; $i++) {
255
+        if ($map[$i] != $ref[$i]) {
256
+            if ($i != $last + 1) {
257
+                $s .= $i . ' ';
258 258
             }
259 259
             $last = $i;
260
-            $s .= '/'.$map[$i].' ';
260
+            $s .= '/' . $map[$i] . ' ';
261 261
         }
262 262
     }
263 263
     return rtrim($s);
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 
266 266
 function saveToFile($file, $s, $mode)
267 267
 {
268
-    $f = fopen($file, 'w'.$mode);
268
+    $f = fopen($file, 'w' . $mode);
269 269
     if (!$f) {
270
-        die('Can\'t write to file '.$file);
270
+        die('Can\'t write to file ' . $file);
271 271
     }
272 272
     fwrite($f, $s, strlen($s));
273 273
     fclose($f);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     //Check if font license allows embedding
291 291
     $f = fopen($file, 'rb');
292 292
     if (!$f) {
293
-        die('<b>Error:</b> Can\'t open '.$file);
293
+        die('<b>Error:</b> Can\'t open ' . $file);
294 294
     }
295 295
     //Extract number of tables
296 296
     fseek($f, 4, SEEK_CUR);
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     fseek($f, 6, SEEK_CUR);
299 299
     //Seek OS/2 table
300 300
     $found = false;
301
-    for ($i=0; $i<$nb; $i++) {
302
-        if (fread($f, 4)=='OS/2') {
301
+    for ($i = 0; $i < $nb; $i++) {
302
+        if (fread($f, 4) == 'OS/2') {
303 303
             $found = true;
304 304
             break;
305 305
         }
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
     //Extract fsType flags
316 316
     fseek($f, 8, SEEK_CUR);
317 317
     $fsType = readShort($f);
318
-    $rl = ($fsType & 0x02)!=0;
319
-    $pp = ($fsType & 0x04)!=0;
320
-    $e = ($fsType & 0x08)!=0;
318
+    $rl = ($fsType & 0x02) != 0;
319
+    $pp = ($fsType & 0x04) != 0;
320
+    $e = ($fsType & 0x08) != 0;
321 321
     fclose($f);
322 322
     if ($rl && !$pp && !$e) {
323 323
         echo '<b>Warning:</b> font license does not allow embedding';
@@ -341,71 +341,71 @@  discard block
 block discarded – undo
341 341
     if ($enc) {
342 342
         $map = readMap($enc);
343 343
         foreach ($patch as $cc => $gn) {
344
-            $map[$cc]=$gn;
344
+            $map[$cc] = $gn;
345 345
         }
346 346
     } else {
347
-        $map=array();
347
+        $map = array();
348 348
     }
349 349
     if (!file_exists($afmfile)) {
350
-        die('<b>Error:</b> AFM file not found: '.$afmfile);
350
+        die('<b>Error:</b> AFM file not found: ' . $afmfile);
351 351
     }
352 352
     $fm = readAFM($afmfile, $map);
353 353
     if ($enc) {
354 354
         $diff = makeFontEncoding($map);
355 355
     } else {
356
-        $diff='';
356
+        $diff = '';
357 357
     }
358 358
     $fd = makeFontDescriptor($fm, empty($map));
359 359
     //Find font type
360 360
     if ($fontfile) {
361 361
         $ext = strtolower(substr($fontfile, -3));
362 362
         if ($ext == 'ttf') {
363
-            $type='TrueType';
363
+            $type = 'TrueType';
364 364
         } elseif ($ext == 'pfb') {
365 365
             $type = 'Type1';
366 366
         } else {
367
-            die('<b>Error:</b> unrecognized font file extension: '.$ext);
367
+            die('<b>Error:</b> unrecognized font file extension: ' . $ext);
368 368
         }
369 369
     } else {
370
-        if ($type!='TrueType' && $type!='Type1') {
371
-            die('<b>Error:</b> incorrect font type: '.$type);
370
+        if ($type != 'TrueType' && $type != 'Type1') {
371
+            die('<b>Error:</b> incorrect font type: ' . $type);
372 372
         }
373 373
     }
374 374
     //Start generation
375
-    $s = '<?php'."\n";
376
-    $s .= '$type=\''.$type."';\n";
377
-    $s .= '$name=\''.$fm['FontName']."';\n";
378
-    $s .= '$desc='.$fd.";\n";
375
+    $s = '<?php' . "\n";
376
+    $s .= '$type=\'' . $type . "';\n";
377
+    $s .= '$name=\'' . $fm['FontName'] . "';\n";
378
+    $s .= '$desc=' . $fd . ";\n";
379 379
     if (!isset($fm['UnderlinePosition'])) {
380 380
         $fm['UnderlinePosition'] = -100;
381 381
     }
382 382
     if (!isset($fm['UnderlineThickness'])) {
383 383
         $fm['UnderlineThickness'] = 50;
384 384
     }
385
-    $s .= '$up='.$fm['UnderlinePosition'].";\n";
386
-    $s .= '$ut='.$fm['UnderlineThickness'].";\n";
385
+    $s .= '$up=' . $fm['UnderlinePosition'] . ";\n";
386
+    $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n";
387 387
     $w = makeWidthArray($fm);
388
-    $s .= '$cw='.$w.";\n";
389
-    $s .= '$enc=\''.$enc."';\n";
390
-    $s.= '$diff=\''.$diff."';\n";
388
+    $s .= '$cw=' . $w . ";\n";
389
+    $s .= '$enc=\'' . $enc . "';\n";
390
+    $s .= '$diff=\'' . $diff . "';\n";
391 391
     $basename = substr(basename($afmfile), 0, -4);
392 392
     if ($fontfile) {
393 393
         //Embedded font
394 394
         if (!file_exists($fontfile)) {
395
-            die('<b>Error:</b> font file not found: '.$fontfile);
395
+            die('<b>Error:</b> font file not found: ' . $fontfile);
396 396
         }
397
-        if ($type=='TrueType') {
397
+        if ($type == 'TrueType') {
398 398
             checkTTF($fontfile);
399 399
         }
400 400
         $f = fopen($fontfile, 'rb');
401 401
         if (!$f) {
402
-            die('<b>Error:</b> Can\'t open '.$fontfile);
402
+            die('<b>Error:</b> Can\'t open ' . $fontfile);
403 403
         }
404 404
         $file = fread($f, filesize($fontfile));
405 405
         fclose($f);
406 406
         if ($type == 'Type1') {
407 407
             //Find first two sections and discard third one
408
-            $header = (ord($file[0])==128);
408
+            $header = (ord($file[0]) == 128);
409 409
             if ($header) {
410 410
                 //Strip first binary header
411 411
                 $file = substr($file, 6);
@@ -414,38 +414,38 @@  discard block
 block discarded – undo
414 414
             if (!$pos) {
415 415
                 die('<b>Error:</b> font file does not seem to be valid Type1');
416 416
             }
417
-            $size1 = $pos+6;
418
-            if ($header && ord($file[$size1])==128) {
417
+            $size1 = $pos + 6;
418
+            if ($header && ord($file[$size1]) == 128) {
419 419
                 //Strip second binary header
420
-                $file = substr($file, 0, $size1).substr($file, $size1+6);
420
+                $file = substr($file, 0, $size1) . substr($file, $size1 + 6);
421 421
             }
422 422
             $pos = strpos($file, '00000000');
423 423
             if (!$pos) {
424 424
                 die('<b>Error:</b> font file does not seem to be valid Type1');
425 425
             }
426
-            $size2 = $pos-$size1;
427
-            $file = substr($file, 0, $size1+$size2);
426
+            $size2 = $pos - $size1;
427
+            $file = substr($file, 0, $size1 + $size2);
428 428
         }
429 429
         if (function_exists('gzcompress')) {
430
-            $cmp=$basename.'.z';
430
+            $cmp = $basename . '.z';
431 431
             saveToFile($cmp, gzcompress($file), 'b');
432
-            $s .= '$file=\''.$cmp."';\n";
433
-            echo 'Font file compressed ('.$cmp.')<br>';
432
+            $s .= '$file=\'' . $cmp . "';\n";
433
+            echo 'Font file compressed (' . $cmp . ')<br>';
434 434
         } else {
435
-            $s .= '$file=\''.basename($fontfile)."';\n";
435
+            $s .= '$file=\'' . basename($fontfile) . "';\n";
436 436
             echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>';
437 437
         }
438 438
         if ($type == 'Type1') {
439
-            $s .= '$size1='.$size1.";\n";
440
-            $s .= '$size2='.$size2.";\n";
439
+            $s .= '$size1=' . $size1 . ";\n";
440
+            $s .= '$size2=' . $size2 . ";\n";
441 441
         } else {
442
-            $s .= '$originalsize='.filesize($fontfile).";\n";
442
+            $s .= '$originalsize=' . filesize($fontfile) . ";\n";
443 443
         }
444 444
     } else {
445 445
         //Not embedded font
446
-        $s .= '$file='."'';\n";
446
+        $s .= '$file=' . "'';\n";
447 447
     }
448
-    $s.="?>\n";
449
-    saveToFile($basename.'.php', $s, 't');
450
-    echo 'Font definition file generated ('.$basename.'.php'.')<br>';
448
+    $s .= "?>\n";
449
+    saveToFile($basename . '.php', $s, 't');
450
+    echo 'Font definition file generated (' . $basename . '.php' . ')<br>';
451 451
 }
Please login to merge, or discard this patch.
src/Legacy/Dom.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         if (substr($xmlString, 0, 1) != '<') {
36 36
             throw new InvalidArgumentException($msg);
37 37
         }
38
-        if (! $this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
38
+        if (!$this->loadXML($xmlString, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG)) {
39 39
             throw new InvalidArgumentException($msg);
40 40
         }
41 41
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         if (empty($node)) {
77 77
             return '';
78 78
         }
79
-        $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
79
+        $texto = !empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
80 80
             $node->getElementsByTagName($name)->item(0)->nodeValue : '';
81 81
         return html_entity_decode($texto, ENT_QUOTES, 'UTF-8');
82 82
     }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
     public function getChave($nodeName = 'infNFe')
106 106
     {
107 107
         $node = $this->getElementsByTagName($nodeName)->item(0);
108
-        if (! empty($node)) {
108
+        if (!empty($node)) {
109 109
             $chaveId = $node->getAttribute("Id");
110
-            $chave =  preg_replace('/[^0-9]/', '', $chaveId);
110
+            $chave = preg_replace('/[^0-9]/', '', $chaveId);
111 111
             return $chave;
112 112
         }
113 113
         return '';
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function addArrayChild(&$parent, $arr)
198 198
     {
199 199
         $num = 0;
200
-        if (! empty($arr) && ! empty($parent)) {
200
+        if (!empty($arr) && !empty($parent)) {
201 201
             foreach ($arr as $node) {
202 202
                 $this->appChild($parent, $node, '');
203 203
                 $num++;
Please login to merge, or discard this patch.
src/CTe/Daevento.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
134 134
         $this->rinfEvento       = $this->retEvento->getElementsByTagName("infEvento")->item(0);
135 135
         $this->tpEvento         = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue;
136 136
         if (!in_array($this->tpEvento, array('110110', '110111'))) {
137
-            $this->errMsg = 'Evento não implementado '.$tpEvento.' !!';
137
+            $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!';
138 138
             $this->errStatus = true;
139 139
             return false;
140 140
         }
141 141
         $this->id = str_replace('ID', '', $this->infEvento->getAttribute("Id"));
142 142
         $this->chCTe = $this->infEvento->getElementsByTagName("chCTe")->item(0)->nodeValue;
143
-        $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14);
143
+        $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14);
144 144
         $this->tpAmb = $this->infEvento->getElementsByTagName("tpAmb")->item(0)->nodeValue;
145 145
         $this->cOrgao = $this->infEvento->getElementsByTagName("cOrgao")->item(0)->nodeValue;
146 146
         $this->xCorrecao = $this->infEvento->getElementsByTagName("xCorrecao")->item(0);
147
-        $this->xCorrecao=(empty($this->xCorrecao)?'':$this->xCorrecao->nodeValue);
147
+        $this->xCorrecao = (empty($this->xCorrecao) ? '' : $this->xCorrecao->nodeValue);
148 148
         $this->xCondUso = $this->infEvento->getElementsByTagName("xCondUso")->item(0);
149
-        $this->xCondUso=(empty($this->xCondUso)?'':$this->xCondUso->nodeValue);
150
-        $this->xJust =  $this->infEvento->getElementsByTagName("xJust")->item(0);
151
-        $this->xJust=(empty($this->xJust)?'':$this->xJust->nodeValue);
149
+        $this->xCondUso = (empty($this->xCondUso) ? '' : $this->xCondUso->nodeValue);
150
+        $this->xJust = $this->infEvento->getElementsByTagName("xJust")->item(0);
151
+        $this->xJust = (empty($this->xJust) ? '' : $this->xJust->nodeValue);
152 152
         $this->dhEvento = $this->infEvento->getElementsByTagName("dhEvento")->item(0)->nodeValue;
153 153
         $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue;
154 154
         $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue;
155
-        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue)?
156
-                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue:'';
157
-        $this->CPFDest =  !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue)?
158
-                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue:'';
155
+        $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ?
156
+                $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : '';
157
+        $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ?
158
+                $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : '';
159 159
         $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue;
160 160
         $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue;
161 161
     }
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
         $this->orientacao = $orientacao;
220 220
         $this->papel = $papel;
221 221
         $this->logoAlign = $logoAlign;
222
-        if ($classPDF!==false) {
223
-            $this->pdf = $classPDF ;
222
+        if ($classPDF !== false) {
223
+            $this->pdf = $classPDF;
224 224
         } else {
225 225
             $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
226 226
         }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             // posição inicial do relatorio
233 233
             $xInic = 1;
234 234
             $yInic = 1;
235
-            if ($this->papel =='A4') { //A4 210x297mm
235
+            if ($this->papel == 'A4') { //A4 210x297mm
236 236
                 $maxW = 210;
237 237
                 $maxH = 297;
238 238
             }
@@ -244,16 +244,16 @@  discard block
 block discarded – undo
244 244
             // posição inicial do relatorio
245 245
             $xInic = 5;
246 246
             $yInic = 5;
247
-            if ($papel =='A4') {
247
+            if ($papel == 'A4') {
248 248
                 //A4 210x297mm
249 249
                 $maxH = 210;
250 250
                 $maxW = 297;
251 251
             }
252 252
         }
253 253
         //largura imprimivel em mm
254
-        $this->wPrint = $maxW-($margEsq+$xInic);
254
+        $this->wPrint = $maxW - ($margEsq + $xInic);
255 255
         //comprimento imprimivel em mm
256
-        $this->hPrint = $maxH-($margSup+$yInic);
256
+        $this->hPrint = $maxH - ($margSup + $yInic);
257 257
         // estabelece contagem de paginas
258 258
         $this->pdf->aliasNbPages();
259 259
         // fixa as margens
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
         //coloca o cabeçalho
274 274
         $y = $this->zCabecalho($x, $y, $pag, $situacao_externa);
275 275
         //coloca os dados da CCe
276
-        $y = $this->zCorpo($x, $y+15);
276
+        $y = $this->zCorpo($x, $y + 15);
277 277
         //coloca os dados da CCe
278
-        $y = $this->zRodape($x, $y+$this->hPrint-20);
278
+        $y = $this->zRodape($x, $y + $this->hPrint - 20);
279 279
         //retorna o ID do evento
280
-        if ($classPDF !==false) {
280
+        if ($classPDF !== false) {
281 281
             $aR = array(
282 282
                 'id'=>$this->id,
283 283
                 'classe_PDF'=>$this->pdf);
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
         $maxW = $this->wPrint;
305 305
         //####################################################################################
306 306
         //coluna esquerda identificação do emitente
307
-        $w = round($maxW*0.41, 0);// 80;
307
+        $w = round($maxW * 0.41, 0); // 80;
308 308
         if ($this->orientacao == 'P') {
309 309
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
310 310
         } else {
311 311
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
312 312
         }
313 313
         $w1 = $w;
314
-        $h=32;
314
+        $h = 32;
315 315
         $oldY += $h;
316 316
         $this->pTextBox($x, $y, $w, $h);
317 317
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -319,130 +319,130 @@  discard block
 block discarded – undo
319 319
         if (is_file($this->logomarca)) {
320 320
             $logoInfo = getimagesize($this->logomarca);
321 321
             //largura da imagem em mm
322
-            $logoWmm = ($logoInfo[0]/72)*25.4;
322
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
323 323
             //altura da imagem em mm
324
-            $logoHmm = ($logoInfo[1]/72)*25.4;
325
-            if ($this->logoAlign=='L') {
326
-                $nImgW = round($w/3, 0);
327
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
328
-                $xImg = $x+1;
329
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
324
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
325
+            if ($this->logoAlign == 'L') {
326
+                $nImgW = round($w / 3, 0);
327
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
328
+                $xImg = $x + 1;
329
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
330 330
                 //estabelecer posições do texto
331
-                $x1 = round($xImg + $nImgW +1, 0);
332
-                $y1 = round($h/3+$y, 0);
333
-                $tw = round(2*$w/3, 0);
331
+                $x1 = round($xImg + $nImgW + 1, 0);
332
+                $y1 = round($h / 3 + $y, 0);
333
+                $tw = round(2 * $w / 3, 0);
334 334
             }
335
-            if ($this->logoAlign=='C') {
336
-                $nImgH = round($h/3, 0);
337
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
338
-                $xImg = round(($w-$nImgW)/2+$x, 0);
339
-                $yImg = $y+3;
335
+            if ($this->logoAlign == 'C') {
336
+                $nImgH = round($h / 3, 0);
337
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
338
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
339
+                $yImg = $y + 3;
340 340
                 $x1 = $x;
341 341
                 $y1 = round($yImg + $nImgH + 1, 0);
342 342
                 $tw = $w;
343 343
             }
344
-            if ($this->logoAlign=='R') {
345
-                $nImgW = round($w/3, 0);
346
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
347
-                $xImg = round($x+($w-(1+$nImgW)), 0);
348
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
344
+            if ($this->logoAlign == 'R') {
345
+                $nImgW = round($w / 3, 0);
346
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
347
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
348
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
349 349
                 $x1 = $x;
350
-                $y1 = round($h/3+$y, 0);
351
-                $tw = round(2*$w/3, 0);
350
+                $y1 = round($h / 3 + $y, 0);
351
+                $tw = round(2 * $w / 3, 0);
352 352
             }
353 353
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
354 354
         } else {
355 355
             $x1 = $x;
356
-            $y1 = round($h/3+$y, 0);
356
+            $y1 = round($h / 3 + $y, 0);
357 357
             $tw = $w;
358 358
         }
359 359
         //Nome emitente
360 360
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
361
-        $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:'');
361
+        $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : '');
362 362
         $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
363 363
         //endereço
364
-        $y1 = $y1+6;
364
+        $y1 = $y1 + 6;
365 365
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
366
-        $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:'');
367
-        $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:'');
368
-        $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:'');
369
-        $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:'');
370
-        $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:'');
366
+        $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : '');
367
+        $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : '');
368
+        $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : '');
369
+        $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : '');
370
+        $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : '');
371 371
         $CEP = $this->pFormat($CEP, "#####-###");
372
-        $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:'');
373
-        $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:'');
374
-        $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:'');
375
-        $email = (isset($this->aEnd['email'])?$this->aEnd['email']:'');
372
+        $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : '');
373
+        $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : '');
374
+        $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : '');
375
+        $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : '');
376 376
         $foneLen = strlen($fone);
377 377
         if ($foneLen > 0) {
378
-            $fone2 = substr($fone, 0, $foneLen-4);
379
-            $fone1 = substr($fone, 0, $foneLen-8);
378
+            $fone2 = substr($fone, 0, $foneLen - 4);
379
+            $fone1 = substr($fone, 0, $foneLen - 8);
380 380
             $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
381 381
         } else {
382 382
             $fone = '';
383 383
         }
384 384
         if ($email != '') {
385
-            $email = 'Email: '.$email;
385
+            $email = 'Email: ' . $email;
386 386
         }
387 387
         $texto = "";
388
-        $tmp_txt = trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":''));
389
-        $tmp_txt = ($tmp_txt=='SN'?'':$tmp_txt);
390
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
391
-        $tmp_txt = trim($bairro.($bairro!='' && $CEP!=''?" - ":'').$CEP);
392
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
388
+        $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : ''));
389
+        $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt);
390
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
391
+        $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP);
392
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
393 393
         $tmp_txt = $mun;
394
-        $tmp_txt.= ($tmp_txt!='' && $UF!=''?" - ":'').$UF;
395
-        $tmp_txt.= ($tmp_txt!='' && $fone!=''?" - ":'').$fone;
396
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
394
+        $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF;
395
+        $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone;
396
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
397 397
         $tmp_txt = $email;
398
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
399
-        $this->pTextBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
398
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
399
+        $this->pTextBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
400 400
         //##################################################
401 401
         $w2 = round($maxW - $w, 0);
402 402
         $x += $w;
403 403
         $this->pTextBox($x, $y, $w2, $h);
404 404
         $y1 = $y + $h;
405 405
         $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B');
406
-        if ($this->tpEvento=='110110') {
407
-            $texto='Representação Gráfica de CCe';
406
+        if ($this->tpEvento == '110110') {
407
+            $texto = 'Representação Gráfica de CCe';
408 408
         } else {
409
-            $texto='Representação Gráfica de Evento';
409
+            $texto = 'Representação Gráfica de Evento';
410 410
         }
411
-        $this->pTextBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
411
+        $this->pTextBox($x, $y + 2, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
412 412
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I');
413
-        if ($this->tpEvento=='110110') {
414
-            $texto='(Carta de Correção Eletrônica)';
415
-        } elseif ($this->tpEvento=='110111') {
416
-            $texto='(Cancelamento de CTe)';
413
+        if ($this->tpEvento == '110110') {
414
+            $texto = '(Carta de Correção Eletrônica)';
415
+        } elseif ($this->tpEvento == '110111') {
416
+            $texto = '(Cancelamento de CTe)';
417 417
         }
418
-        $this->pTextBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
-        $texto = 'ID do Evento: '.$this->id;
418
+        $this->pTextBox($x, $y + 7, $w2, 8, $texto, $aFont, 'T', 'C', 0, '');
419
+        $texto = 'ID do Evento: ' . $this->id;
420 420
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
421
-        $this->pTextBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
421
+        $this->pTextBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
422 422
         $tsHora = $this->pConvertTime($this->dhEvento);
423
-        $texto = 'Criado em : '. date('d/m/Y   H:i:s', $tsHora);
424
-        $this->pTextBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
423
+        $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
424
+        $this->pTextBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
425 425
         $tsHora = $this->pConvertTime($this->dhRegEvento);
426
-        $texto = 'Prococolo: '.$this->nProt.'  -  Registrado na SEFAZ em: '.date('d/m/Y   H:i:s', $tsHora);
427
-        $this->pTextBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
426
+        $texto = 'Prococolo: ' . $this->nProt . '  -  Registrado na SEFAZ em: ' . date('d/m/Y   H:i:s', $tsHora);
427
+        $this->pTextBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
428 428
         //####################################################
429 429
         $x = $oldX;
430 430
         $this->pTextBox($x, $y1, $maxW, 40);
431
-        $sY = $y1+40;
432
-        if ($this->tpEvento=='110110') {
431
+        $sY = $y1 + 40;
432
+        if ($this->tpEvento == '110110') {
433 433
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
434 434
                     . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, '
435 435
                     . 'contêm irregularidades que estão destacadas e suas respectivas '
436 436
                     . 'correções, solicitamos que sejam aplicadas essas correções ao '
437 437
                     . 'executar seus lançamentos fiscais.';
438
-        } elseif ($this->tpEvento=='110111') {
438
+        } elseif ($this->tpEvento == '110111') {
439 439
             $texto = 'De acordo com as determinações legais vigentes, vimos por meio '
440 440
                     . 'desta comunicar-lhe que o  Conhecimento de Transporte, abaixo referenciado, está '
441 441
                     . 'cancelado, solicitamos que sejam aplicadas essas correções ao '
442 442
                     . 'executar seus lançamentos fiscais.';
443 443
         }
444 444
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
445
-        $this->pTextBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
445
+        $this->pTextBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
446 446
         //############################################
447 447
         $x = $oldX;
448 448
         $y = $y1;
@@ -450,45 +450,45 @@  discard block
 block discarded – undo
450 450
         $numNF = substr($this->chCTe, 25, 9);
451 451
         $serie = substr($this->chCTe, 22, 3);
452 452
         $numNF = $this->pFormat($numNF, "###.###.###");
453
-        $texto = "Conhecimento: " . $numNF .'  -   Série: '.$serie;
454
-        $this->pTextBox($x+2, $y+19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
453
+        $texto = "Conhecimento: " . $numNF . '  -   Série: ' . $serie;
454
+        $this->pTextBox($x + 2, $y + 19, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
455 455
         $bW = 87;
456 456
         $bH = 15;
457 457
         $x = 55;
458
-        $y = $y1+13;
458
+        $y = $y1 + 13;
459 459
         $w = $maxW;
460 460
         $this->pdf->setFillColor(0, 0, 0);
461
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH);
461
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH);
462 462
         $this->pdf->setFillColor(255, 255, 255);
463
-        $y1 = $y+2+$bH;
463
+        $y1 = $y + 2 + $bH;
464 464
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
465 465
         $texto = $this->pFormat($this->chCTe, $this->formatoChave);
466
-        $this->pTextBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
-        $retVal = $sY+2;
468
-        if ($this->tpEvento=='110110') {
466
+        $this->pTextBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
467
+        $retVal = $sY + 2;
468
+        if ($this->tpEvento == '110110') {
469 469
             $x = $oldX;
470 470
             $this->pTextBox($x, $sY, $maxW, 15);
471 471
             $texto = $this->xCondUso;
472 472
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I');
473
-            $this->pTextBox($x+2, $sY+2, $maxW-2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
-            $retVal = $sY+2;
473
+            $this->pTextBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474
+            $retVal = $sY + 2;
475 475
         }
476 476
         if ($this->tpAmb != 1) {
477 477
             $x = 10;
478 478
             if ($this->orientacao == 'P') {
479
-                $y = round($this->hPrint*2/3, 0);
479
+                $y = round($this->hPrint * 2 / 3, 0);
480 480
             } else {
481
-                $y = round($this->hPrint/2, 0);
481
+                $y = round($this->hPrint / 2, 0);
482 482
             }
483 483
             $h = 5;
484
-            $w = $maxW-(2*$x);
484
+            $w = $maxW - (2 * $x);
485 485
             $this->pdf->setTextColor(90, 90, 90);
486 486
             $texto = "SEM VALOR FISCAL";
487 487
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
488 488
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
489 489
             $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
490 490
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
491
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
491
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
492 492
             $this->pdf->setTextColor(0, 0, 0);
493 493
         }
494 494
         return $retVal;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
     private function zCorpo($x, $y)
503 503
     {
504 504
         $maxW = $this->wPrint;
505
-        if ($this->tpEvento=='110110') {
505
+        if ($this->tpEvento == '110110') {
506 506
             $texto = 'CORREÇÕES A SEREM CONSIDERADAS';
507 507
         } else {
508 508
             $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
         $this->pTextBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
512 512
         $y += 5;
513 513
         $this->pTextBox($x, $y, $maxW, 190);
514
-        if ($this->tpEvento=='110110') {
514
+        if ($this->tpEvento == '110110') {
515 515
             $texto = $this->xCorrecao;
516
-        } elseif ($this->tpEvento=='110111') {
516
+        } elseif ($this->tpEvento == '110111') {
517 517
             $texto = $this->xJust;
518 518
         }
519 519
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
520
-        $this->pTextBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
520
+        $this->pTextBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
521 521
     }
522 522
     
523 523
     /**
@@ -528,12 +528,12 @@  discard block
 block discarded – undo
528 528
     private function zRodape($x, $y)
529 529
     {
530 530
         $w = $this->wPrint;
531
-        if ($this->tpEvento=='110110') {
531
+        if ($this->tpEvento == '110110') {
532 532
             $texto = "Este documento é uma representação gráfica da CCe e foi "
533 533
                     . "impresso apenas para sua informação e não possue validade fiscal."
534 534
                     . "\n A CCe deve ser recebida e mantida em arquivo eletrônico XML e "
535 535
                     . "pode ser consultada através dos Portais das SEFAZ.";
536
-        } elseif ($this->tpEvento=='110111') {
536
+        } elseif ($this->tpEvento == '110111') {
537 537
             $texto = "Este documento é uma representação gráfica do evento de CTe e foi "
538 538
                     . "impresso apenas para sua informação e não possue validade fiscal."
539 539
                     . "\n O Evento deve ser recebido e mantido em arquivo eletrônico XML e "
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
         }
542 542
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I');
543 543
         $this->pTextBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
544
-        $y = $this->hPrint -4;
545
-        $texto = "Impresso em  ". date('d/m/Y   H:i:s');
546
-        $w = $this->wPrint-4;
544
+        $y = $this->hPrint - 4;
545
+        $texto = "Impresso em  " . date('d/m/Y   H:i:s');
546
+        $w = $this->wPrint - 4;
547 547
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
548 548
         $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
549 549
         $texto = "Daevento ver. " . $this->version
Please login to merge, or discard this patch.
src/CTe/Dacanc.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
         $this->id = str_replace('ID', '', $this->infCanc->getAttribute("Id"));
129 129
         $this->chCTe = $this->infCanc->getElementsByTagName("chCTe")->item(0)->nodeValue;
130
-        $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14);
130
+        $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14);
131 131
         $this->tpAmb = $this->infCanc->getElementsByTagName("tpAmb")->item(0)->nodeValue;
132 132
         $this->xJust = $this->infCanc->getElementsByTagName("xJust")->item(0)->nodeValue;
133 133
         $this->dhEvento = $this->retCancCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
         $this->orientacao = $orientacao;
180 180
         $this->papel = $papel;
181 181
         $this->logoAlign = $logoAlign;
182
-        if ($classPDF!==false) {
182
+        if ($classPDF !== false) {
183 183
             $this->pdf = $classPDF;
184 184
         } else {
185 185
             $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
             // posição inicial do relatorio
192 192
             $xInic = 1;
193 193
             $yInic = 1;
194
-            if ($this->papel =='A4') {
194
+            if ($this->papel == 'A4') {
195 195
                 $maxW = 210;
196 196
                 $maxH = 297;
197 197
             }
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
             // posição inicial do relatorio
203 203
             $xInic = 5;
204 204
             $yInic = 5;
205
-            if ($papel =='A4') {
205
+            if ($papel == 'A4') {
206 206
                 $maxH = 210;
207 207
                 $maxW = 297;
208 208
             }
209 209
         }
210 210
         //largura imprimivel em mm
211
-        $this->wPrint = $maxW-($margEsq+$xInic);
211
+        $this->wPrint = $maxW - ($margEsq + $xInic);
212 212
         //comprimento imprimivel em mm
213
-        $this->hPrint = $maxH-($margSup+$yInic);
213
+        $this->hPrint = $maxH - ($margSup + $yInic);
214 214
         // estabelece contagem de paginas
215 215
         $this->pdf->aliasNbPages();
216 216
         // fixa as margens
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
         //coloca o cabeçalho
231 231
         $y = $this->headerCCe($x, $y, $pag);
232 232
         //coloca os dados da CCe
233
-        $y = $this->bodyCCe($x, $y+15);
233
+        $y = $this->bodyCCe($x, $y + 15);
234 234
         //coloca os dados da CCe
235
-        $y = $this->footerCCe($x, $y+$this->hPrint-20);
235
+        $y = $this->footerCCe($x, $y + $this->hPrint - 20);
236 236
         //retorna o ID do evento
237
-        if ($classPDF!==false) {
238
-            $aR = ['id'=>$this->id,'classe_PDF'=>$this->pdf];
237
+        if ($classPDF !== false) {
238
+            $aR = ['id'=>$this->id, 'classe_PDF'=>$this->pdf];
239 239
             return $aR;
240 240
         } else {
241 241
             return $this->id;
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
         $maxW = $this->wPrint;
257 257
         //#############################################################
258 258
         //coluna esquerda identificação do emitente
259
-        $w = round($maxW*0.41, 0);// 80;
259
+        $w = round($maxW * 0.41, 0); // 80;
260 260
         if ($this->orientacao == 'P') {
261
-            $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
261
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
262 262
         } else {
263
-            $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'B');
263
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
264 264
         }
265 265
         $w1 = $w;
266
-        $h=32;
266
+        $h = 32;
267 267
         $oldY += $h;
268 268
         $this->textBox($x, $y, $w, $h);
269 269
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -271,147 +271,147 @@  discard block
 block discarded – undo
271 271
         if (is_file($this->logomarca)) {
272 272
             $logoInfo = getimagesize($this->logomarca);
273 273
             //largura da imagem em mm
274
-            $logoWmm = ($logoInfo[0]/72)*25.4;
274
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
275 275
             //altura da imagem em mm
276
-            $logoHmm = ($logoInfo[1]/72)*25.4;
277
-            if ($this->logoAlign=='L') {
278
-                $nImgW = round($w/3, 0);
279
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
280
-                $xImg = $x+1;
281
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
276
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
277
+            if ($this->logoAlign == 'L') {
278
+                $nImgW = round($w / 3, 0);
279
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
280
+                $xImg = $x + 1;
281
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
282 282
                 //estabelecer posições do texto
283
-                $x1 = round($xImg + $nImgW +1, 0);
284
-                $y1 = round($h/3+$y, 0);
285
-                $tw = round(2*$w/3, 0);
283
+                $x1 = round($xImg + $nImgW + 1, 0);
284
+                $y1 = round($h / 3 + $y, 0);
285
+                $tw = round(2 * $w / 3, 0);
286 286
             }
287
-            if ($this->logoAlign=='C') {
288
-                $nImgH = round($h/3, 0);
289
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
290
-                $xImg = round(($w-$nImgW)/2+$x, 0);
291
-                $yImg = $y+3;
287
+            if ($this->logoAlign == 'C') {
288
+                $nImgH = round($h / 3, 0);
289
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
290
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
291
+                $yImg = $y + 3;
292 292
                 $x1 = $x;
293 293
                 $y1 = round($yImg + $nImgH + 1, 0);
294 294
                 $tw = $w;
295 295
             }
296
-            if ($this->logoAlign=='R') {
297
-                $nImgW = round($w/3, 0);
298
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
299
-                $xImg = round($x+($w-(1+$nImgW)), 0);
300
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
296
+            if ($this->logoAlign == 'R') {
297
+                $nImgW = round($w / 3, 0);
298
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
299
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
300
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
301 301
                 $x1 = $x;
302
-                $y1 = round($h/3+$y, 0);
303
-                $tw = round(2*$w/3, 0);
302
+                $y1 = round($h / 3 + $y, 0);
303
+                $tw = round(2 * $w / 3, 0);
304 304
             }
305 305
             $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg');
306 306
         } else {
307 307
             $x1 = $x;
308
-            $y1 = round($h/3+$y, 0);
308
+            $y1 = round($h / 3 + $y, 0);
309 309
             $tw = $w;
310 310
         }
311 311
         //Nome emitente
312
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B');
313
-        $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:'');
312
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
313
+        $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : '');
314 314
         $this->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
315 315
         //endereço
316
-        $y1 = $y1+6;
317
-        $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'');
318
-        $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:'');
319
-        $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:'');
320
-        $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:'');
321
-        $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:'');
322
-        $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:'');
316
+        $y1 = $y1 + 6;
317
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
318
+        $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : '');
319
+        $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : '');
320
+        $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : '');
321
+        $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : '');
322
+        $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : '');
323 323
         $CEP = $this->format($CEP, "#####-###");
324
-        $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:'');
325
-        $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:'');
326
-        $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:'');
327
-        $email = (isset($this->aEnd['email'])?$this->aEnd['email']:'');
324
+        $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : '');
325
+        $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : '');
326
+        $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : '');
327
+        $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : '');
328 328
         $foneLen = strlen($fone);
329 329
         if ($foneLen > 0) {
330
-            $fone2 = substr($fone, 0, $foneLen-4);
331
-            $fone1 = substr($fone, 0, $foneLen-8);
330
+            $fone2 = substr($fone, 0, $foneLen - 4);
331
+            $fone1 = substr($fone, 0, $foneLen - 8);
332 332
             $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4);
333 333
         } else {
334 334
             $fone = '';
335 335
         }
336 336
         if ($email != '') {
337
-            $email = 'Email: '.$email;
337
+            $email = 'Email: ' . $email;
338 338
         }
339 339
         $texto = "";
340
-        $tmp_txt=trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":''));
341
-        $tmp_txt=($tmp_txt=='SN'?'':$tmp_txt);
342
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
343
-        $tmp_txt=trim($bairro . ($bairro!='' && $CEP!=''?" - ":'') . $CEP);
344
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
345
-        $tmp_txt=$mun;
346
-        $tmp_txt.=($tmp_txt!='' && $UF!=''?" - ":'').$UF;
347
-        $tmp_txt.=($tmp_txt!='' && $fone!=''?" - ":'').$fone;
348
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
349
-        $tmp_txt=$email;
350
-        $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt;
351
-        $this->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
340
+        $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : ''));
341
+        $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt);
342
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
343
+        $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP);
344
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
345
+        $tmp_txt = $mun;
346
+        $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF;
347
+        $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone;
348
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
349
+        $tmp_txt = $email;
350
+        $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt;
351
+        $this->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
352 352
         //##################################################
353 353
         $w2 = round($maxW - $w, 0);
354 354
         $x += $w;
355 355
         $this->textBox($x, $y, $w2, $h);
356 356
         $y1 = $y + $h;
357
-        $aFont = array('font'=>$this->fontePadrao,'size'=>16,'style'=>'B');
358
-        $this->textBox($x, $y+2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, '');
359
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'I');
360
-        $this->textBox($x, $y+7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, '');
357
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B');
358
+        $this->textBox($x, $y + 2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, '');
359
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I');
360
+        $this->textBox($x, $y + 7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, '');
361 361
         $tsHora = $this->convertTime($this->dhEvento);
362
-        $texto = 'Criado em : '. date('d/m/Y   H:i:s', $tsHora);
363
-        $this->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
362
+        $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
363
+        $this->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
364 364
         $tsHora = $this->convertTime($this->dhRegEvento);
365
-        $texto = 'Prococolo: '.$this->nProt.'  -  Registrado na SEFAZ em: '.date('d/m/Y   H:i:s', $tsHora);
366
-        $this->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
365
+        $texto = 'Prococolo: ' . $this->nProt . '  -  Registrado na SEFAZ em: ' . date('d/m/Y   H:i:s', $tsHora);
366
+        $this->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
367 367
         //####################################################
368 368
         $x = $oldX;
369 369
         $this->textBox($x, $y1, $maxW, 33);
370
-        $sY = $y1+23;
370
+        $sY = $y1 + 23;
371 371
         $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta '
372 372
                 . 'comunicar-lhe que o Conhecimento de Transporte Eletrônico, abaixo '
373 373
                 . 'referenciada, encontra-se cancelada, solicitamos que sejam aplicadas '
374 374
                 . 'essas correções ao executar seus lançamentos fiscais.';
375
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'');
376
-        $this->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
375
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
376
+        $this->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
377 377
         //############################################
378 378
         $x = $oldX;
379 379
         $y = $y1;
380 380
         $numNF = substr($this->chCTe, 25, 9);
381 381
         $serie = substr($this->chCTe, 22, 3);
382 382
         $numNF = $this->format($numNF, "###.###.###");
383
-        $texto = "Conhecimento: " . $numNF .'  -   Série: '.$serie;
384
-        $this->textBox($x+2, $y+11, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
383
+        $texto = "Conhecimento: " . $numNF . '  -   Série: ' . $serie;
384
+        $this->textBox($x + 2, $y + 11, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
385 385
         $bW = 87;
386 386
         $bH = 15;
387 387
         $x = 55;
388
-        $y = $y1+10;
388
+        $y = $y1 + 10;
389 389
         $w = $maxW;
390 390
         $this->pdf->setFillColor(0, 0, 0);
391
-        $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH);
391
+        $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH);
392 392
         $this->pdf->setFillColor(255, 255, 255);
393
-        $y1 = $y+2+$bH;
394
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'');
393
+        $y1 = $y + 2 + $bH;
394
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'');
395 395
         $texto = $this->format($this->chCTe, $this->formatoChave);
396
-        $this->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
396
+        $this->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
397 397
         $retVal = $sY;
398 398
         //indicar sem valor
399 399
         if ($this->tpAmb != 1) {
400 400
             $x = 10;
401 401
             if ($this->orientacao == 'P') {
402
-                $y = round($this->hPrint*2/3, 0);
402
+                $y = round($this->hPrint * 2 / 3, 0);
403 403
             } else {
404
-                $y = round($this->hPrint/2, 0);
404
+                $y = round($this->hPrint / 2, 0);
405 405
             }
406 406
             $h = 5;
407
-            $w = $maxW-(2*$x);
407
+            $w = $maxW - (2 * $x);
408 408
             $this->pdf->setTextColor(90, 90, 90);
409 409
             $texto = "SEM VALOR FISCAL";
410
-            $aFont = array('font'=>$this->fontePadrao,'size'=>48,'style'=>'B');
410
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
411 411
             $this->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
412
-            $aFont = array('font'=>$this->fontePadrao,'size'=>30,'style'=>'B');
412
+            $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
413 413
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
414
-            $this->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
414
+            $this->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
415 415
             $this->pdf->setTextColor(0, 0, 0);
416 416
         }
417 417
         return $retVal;
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
     {
427 427
         $maxW = $this->wPrint;
428 428
         $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
429
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'B');
429
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
430 430
         $this->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
431 431
         $y += 5;
432 432
         $this->textBox($x, $y, $maxW, 210);
433 433
         $texto = $this->xJust;
434
-        $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B');
435
-        $this->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
434
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
435
+        $this->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
436 436
     }
437 437
     
438 438
     /**
@@ -449,17 +449,17 @@  discard block
 block discarded – undo
449 449
                 . "validade fiscal.\n O Protocolo deve ser recebido e mantido"
450 450
                 . " em arquivo eletrônico XML e pode ser consultada através dos"
451 451
                 . " Portais das SEFAZ.";
452
-        $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'I');
452
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I');
453 453
         $this->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
454
-        $y = $this->hPrint -4;
455
-        $texto = "Impresso em  ". date('d/m/Y   H:i:s');
456
-        $w = $this->wPrint-4;
457
-        $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
454
+        $y = $this->hPrint - 4;
455
+        $texto = "Impresso em  " . date('d/m/Y   H:i:s');
456
+        $w = $this->wPrint - 4;
457
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
458 458
         $this->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
459 459
         $texto = "DaCanccteNFePHP ver. "
460 460
             . $this->version
461 461
             .  "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
462
-        $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I');
462
+        $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
463 463
         $this->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org');
464 464
     }
465 465
     
Please login to merge, or discard this patch.
src/NFe/Daevento.php 1 patch
Spacing   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $this->retEvento = $this->dom->getElementsByTagName("retEvento")->item(0);
135 135
         $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0);
136 136
         $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue;
137
-        if (!in_array($this->tpEvento, ['110110','110111'])) {
137
+        if (!in_array($this->tpEvento, ['110110', '110111'])) {
138 138
             $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!';
139 139
             $this->errStatus = true;
140 140
             return false;
@@ -154,11 +154,9 @@  discard block
 block discarded – undo
154 154
         $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue;
155 155
         $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue;
156 156
         $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ?
157
-            $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue :
158
-            '';
157
+            $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : '';
159 158
         $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ?
160
-            $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue :
161
-            '';
159
+            $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : '';
162 160
         $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue;
163 161
         $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue;
164 162
     }
@@ -280,9 +278,9 @@  discard block
 block discarded – undo
280 278
         // coluna esquerda identificação do emitente
281 279
         $w = round($maxW * 0.41, 0); // 80;
282 280
         if ($this->orientacao == 'P') {
283
-            $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
281
+            $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
284 282
         } else {
285
-            $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'B'];
283
+            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B'];
286 284
         }
287 285
         $w1 = $w;
288 286
         $h = 32;
@@ -434,7 +432,7 @@  discard block
 block discarded – undo
434 432
                     . 'abaixo referenciada, está cancelada, solicitamos que sejam '
435 433
                     . 'aplicadas essas correções ao executar seus lançamentos fiscais.';
436 434
         }
437
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
435
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
438 436
         $this->pTextBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false);
439 437
         // ############################################
440 438
         $x = $oldX;
@@ -445,7 +443,7 @@  discard block
 block discarded – undo
445 443
         if ($this->CPFDest != '') {
446 444
             $texto = 'CPF do Destinatário: ' . $this->pFormat($this->CPFDest, "###.###.###-##");
447 445
         }
448
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
446
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
449 447
         $this->pTextBox($x + 2, $y + 13, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
450 448
         $numNF = substr($this->chNFe, 25, 9);
451 449
         $serie = substr($this->chNFe, 22, 3);
@@ -461,7 +459,7 @@  discard block
 block discarded – undo
461 459
         $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $this->chNFe, $bW, $bH);
462 460
         $this->pdf->SetFillColor(255, 255, 255);
463 461
         $y1 = $y + 2 + $bH;
464
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
462
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
465 463
         $texto = $this->pFormat($this->chNFe, $this->formatoChave);
466 464
         $this->pTextBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
467 465
         $retVal = $sY + 2;
@@ -469,7 +467,7 @@  discard block
 block discarded – undo
469 467
             $x = $oldX;
470 468
             $this->pTextBox($x, $sY, $maxW, 15);
471 469
             $texto = $this->xCondUso;
472
-            $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'I'];
470
+            $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I'];
473 471
             $this->pTextBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false);
474 472
             $retVal = $sY + 2;
475 473
         }
@@ -485,9 +483,9 @@  discard block
 block discarded – undo
485 483
             $w = $maxW - (2 * $x);
486 484
             $this->pdf->setTextColor(90, 90, 90);
487 485
             $texto = "SEM VALOR FISCAL";
488
-            $aFont = ['font' => $this->fontePadrao,'size' => 48,'style' => 'B'];
486
+            $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B'];
489 487
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
490
-            $aFont = ['font' => $this->fontePadrao,'size' => 30,'style' => 'B'];
488
+            $aFont = ['font' => $this->fontePadrao, 'size' => 30, 'style' => 'B'];
491 489
             $texto = "AMBIENTE DE HOMOLOGAÇÃO";
492 490
             $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
493 491
             $this->pdf->setTextColor(0, 0, 0);
@@ -509,7 +507,7 @@  discard block
 block discarded – undo
509 507
         } else {
510 508
             $texto = 'JUSTIFICATIVA DO CANCELAMENTO';
511 509
         }
512
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'B'];
510
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B'];
513 511
         $this->pTextBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false);
514 512
         $y += 5;
515 513
         $this->pTextBox($x, $y, $maxW, 190);
@@ -518,7 +516,7 @@  discard block
 block discarded – undo
518 516
         } elseif ($this->tpEvento == '110111') {
519 517
             $texto = $this->xJust;
520 518
         }
521
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
519
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
522 520
         $this->pTextBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false);
523 521
     }
524 522
 
@@ -543,15 +541,15 @@  discard block
 block discarded – undo
543 541
                     . "eletrônico XML e pode ser consultada através dos Portais "
544 542
                     . "das SEFAZ.";
545 543
         }
546
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'I'];
544
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'I'];
547 545
         $this->pTextBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false);
548 546
         $y = $this->hPrint - 4;
549 547
         $texto = "Impresso em  " . date('d/m/Y   H:i:s');
550 548
         $w = $this->wPrint - 4;
551
-        $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
549
+        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
552 550
         $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, '');
553 551
         $texto = "Daevento ver. " . $this->version . "  Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org";
554
-        $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I'];
552
+        $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I'];
555 553
         $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org');
556 554
     }
557 555
 
Please login to merge, or discard this patch.
src/MDFe/Damdfe.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     protected $xml; // string XML NFe
31 31
     protected $logomarca = ''; // path para logomarca em jpg
32 32
     protected $errMsg = ''; // mesagens de erro
33
-    protected $errStatus = false;// status de erro TRUE um erro ocorreu false sem erros
33
+    protected $errStatus = false; // status de erro TRUE um erro ocorreu false sem erros
34 34
     protected $orientacao = 'P'; //orientação da DANFE P-Retrato ou L-Paisagem
35 35
     protected $papel = 'A4'; //formato do papel
36 36
     //destivo do arquivo pdf I-borwser, S-retorna o arquivo, D-força download, F-salva em arquivo local
Please login to merge, or discard this patch.
src/Legacy/FPDF/Fpdf.php 1 patch
Spacing   +353 added lines, -353 removed lines patch added patch discarded remove patch
@@ -8,64 +8,64 @@  discard block
 block discarded – undo
8 8
 {
9 9
     const FPDF_VERSION = '1.6';
10 10
     
11
-    public $page;               //current page number
12
-    public $n;                  //current object number
13
-    public $offsets;            //array of object offsets
14
-    public $buffer;             //buffer holding in-memory PDF
15
-    public $pages;              //array containing pages
16
-    public $state;              //current document state
17
-    public $compress;           //compression flag
18
-    public $k;                  //scale factor (number of points in user unit)
19
-    public $defOrientation;     //default orientation
20
-    public $curOrientation;     //current orientation
21
-    public $pageFormats;        //available page formats
22
-    public $defPageFormat;      //default page format
23
-    public $curPageFormat;      //current page format
24
-    public $pageSizes;          //array storing non-default page sizes
11
+    public $page; //current page number
12
+    public $n; //current object number
13
+    public $offsets; //array of object offsets
14
+    public $buffer; //buffer holding in-memory PDF
15
+    public $pages; //array containing pages
16
+    public $state; //current document state
17
+    public $compress; //compression flag
18
+    public $k; //scale factor (number of points in user unit)
19
+    public $defOrientation; //default orientation
20
+    public $curOrientation; //current orientation
21
+    public $pageFormats; //available page formats
22
+    public $defPageFormat; //default page format
23
+    public $curPageFormat; //current page format
24
+    public $pageSizes; //array storing non-default page sizes
25 25
     public $wPt;
26
-    public $hPt;           //dimensions of current page in points
26
+    public $hPt; //dimensions of current page in points
27 27
     public $w;
28
-    public $h;               //dimensions of current page in user unit
29
-    public $lMargin;            //left margin
30
-    public $tMargin;            //top margin
31
-    public $rMargin;            //right margin
32
-    public $bMargin;            //page break margin
33
-    public $cMargin;            //cell margin
28
+    public $h; //dimensions of current page in user unit
29
+    public $lMargin; //left margin
30
+    public $tMargin; //top margin
31
+    public $rMargin; //right margin
32
+    public $bMargin; //page break margin
33
+    public $cMargin; //cell margin
34 34
     public $x;
35
-    public $y;               //current position in user unit
36
-    public $lasth;              //height of last printed cell
37
-    public $lineWidth;          //line width in user unit
38
-    public $coreFonts;          //array of standard font names
39
-    public $fonts;              //array of used fonts
40
-    public $fontFiles;          //array of font files
41
-    public $diffs;              //array of encoding differences
42
-    public $fontFamily;         //current font family
43
-    public $fontStyle;          //current font style
44
-    public $underline;          //underlining flag
45
-    public $currentFont;        //current font info
46
-    public $fontSizePt;         //current font size in points
47
-    public $fontSize;           //current font size in user unit
48
-    public $drawColor;          //commands for drawing color
49
-    public $fillColor;          //commands for filling color
50
-    public $textColor;          //commands for text color
51
-    public $colorFlag;          //indicates whether fill and text colors are different
52
-    public $ws;                 //word spacing
53
-    public $images;             //array of used images
54
-    public $PageLinks;          //array of links in pages
55
-    public $links;              //array of internal links
56
-    public $autoPageBreak;      //automatic page breaking
57
-    public $pageBreakTrigger;   //threshold used to trigger page breaks
58
-    public $inHeader;           //flag set when processing header
59
-    public $inFooter;           //flag set when processing footer
60
-    public $zoomMode;           //zoom display mode
61
-    public $layoutMode;         //layout display mode
62
-    public $title;              //title
63
-    public $subject;            //subject
64
-    public $author;             //author
65
-    public $keywords;           //keywords
66
-    public $creator;            //creator
67
-    public $aliasNbPages;       //alias for total number of pages
68
-    public $pdfVersion;         //PDF version number
35
+    public $y; //current position in user unit
36
+    public $lasth; //height of last printed cell
37
+    public $lineWidth; //line width in user unit
38
+    public $coreFonts; //array of standard font names
39
+    public $fonts; //array of used fonts
40
+    public $fontFiles; //array of font files
41
+    public $diffs; //array of encoding differences
42
+    public $fontFamily; //current font family
43
+    public $fontStyle; //current font style
44
+    public $underline; //underlining flag
45
+    public $currentFont; //current font info
46
+    public $fontSizePt; //current font size in points
47
+    public $fontSize; //current font size in user unit
48
+    public $drawColor; //commands for drawing color
49
+    public $fillColor; //commands for filling color
50
+    public $textColor; //commands for text color
51
+    public $colorFlag; //indicates whether fill and text colors are different
52
+    public $ws; //word spacing
53
+    public $images; //array of used images
54
+    public $PageLinks; //array of links in pages
55
+    public $links; //array of internal links
56
+    public $autoPageBreak; //automatic page breaking
57
+    public $pageBreakTrigger; //threshold used to trigger page breaks
58
+    public $inHeader; //flag set when processing header
59
+    public $inFooter; //flag set when processing footer
60
+    public $zoomMode; //zoom display mode
61
+    public $layoutMode; //layout display mode
62
+    public $title; //title
63
+    public $subject; //subject
64
+    public $author; //author
65
+    public $keywords; //keywords
66
+    public $creator; //creator
67
+    public $aliasNbPages; //alias for total number of pages
68
+    public $pdfVersion; //PDF version number
69 69
     
70 70
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
71 71
     {
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
         if ($unit == 'pt') {
117 117
             $this->k = 1;
118 118
         } elseif ($unit == 'mm') {
119
-            $this->k = 72/25.4;
119
+            $this->k = 72 / 25.4;
120 120
         } elseif ($unit == 'cm') {
121
-            $this->k = 72/2.54;
121
+            $this->k = 72 / 2.54;
122 122
         } elseif ($unit == 'in') {
123 123
             $this->k = 72;
124 124
         } else {
125
-            $this->error('Incorrect unit: '.$unit);
125
+            $this->error('Incorrect unit: ' . $unit);
126 126
         }
127 127
         //Page format
128 128
         $this->pageFormats = array(
129
-            'a3' => array(841.89,1190.55),
130
-            'a4' => array(595.28,841.89),
131
-            'a5' => array(420.94,595.28),
132
-            'letter' => array(612,792),
133
-            'legal' => array(612,1008)
129
+            'a3' => array(841.89, 1190.55),
130
+            'a4' => array(595.28, 841.89),
131
+            'a5' => array(420.94, 595.28),
132
+            'letter' => array(612, 792),
133
+            'legal' => array(612, 1008)
134 134
         );
135 135
         if (is_string($format)) {
136 136
             $format = $this->getpageformat($format);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         //Page orientation
141 141
         $orientation = strtolower($orientation);
142 142
         if ($orientation == 'p' || $orientation == 'portrait') {
143
-            $this->defOrientation='P';
143
+            $this->defOrientation = 'P';
144 144
             $this->w = $this->defPageFormat[0];
145 145
             $this->h = $this->defPageFormat[1];
146 146
         } elseif ($orientation == 'l' || $orientation == 'landscape') {
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
             $this->w = $this->defPageFormat[1];
149 149
             $this->h = $this->defPageFormat[0];
150 150
         } else {
151
-            $this->error('Incorrect orientation: '.$orientation);
151
+            $this->error('Incorrect orientation: ' . $orientation);
152 152
         }
153 153
         $this->curOrientation = $this->defOrientation;
154
-        $this->wPt = $this->w*$this->k;
155
-        $this->hPt = $this->h*$this->k;
154
+        $this->wPt = $this->w * $this->k;
155
+        $this->hPt = $this->h * $this->k;
156 156
         //Page margins (1 cm)
157
-        $margin = 28.35/$this->k;
157
+        $margin = 28.35 / $this->k;
158 158
         $this->setMargins($margin, $margin);
159 159
         //Interior cell margin (1 mm)
160
-        $this->cMargin = $margin/10;
160
+        $this->cMargin = $margin / 10;
161 161
         //Line width (0.2 mm)
162
-        $this->lineWidth = .567/$this->k;
162
+        $this->lineWidth = .567 / $this->k;
163 163
         //Automatic page break
164
-        $this->setAutoPageBreak(true, 2*$margin);
164
+        $this->setAutoPageBreak(true, 2 * $margin);
165 165
         //Full width display mode
166 166
         $this->setDisplayMode('fullwidth');
167 167
         //Enable compression
168 168
         $this->setCompression(true);
169 169
         //Set default PDF version number
170
-        $this->pdfVersion='1.3';
170
+        $this->pdfVersion = '1.3';
171 171
     }
172 172
     
173 173
     public function setMargins($left, $top, $right = null)
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
         if ($right === null) {
179 179
             $right = $left;
180 180
         }
181
-        $this->rMargin=$right;
181
+        $this->rMargin = $right;
182 182
     }
183 183
     
184 184
     public function setLeftMargin($margin)
185 185
     {
186 186
         //Set left margin
187 187
         $this->lMargin = $margin;
188
-        if ($this->page>0 && $this->x<$margin) {
188
+        if ($this->page > 0 && $this->x < $margin) {
189 189
             $this->x = $margin;
190 190
         }
191 191
     }
@@ -207,21 +207,21 @@  discard block
 block discarded – undo
207 207
         //Set auto page break mode and triggering margin
208 208
         $this->autoPageBreak = $auto;
209 209
         $this->bMargin = $margin;
210
-        $this->pageBreakTrigger = $this->h-$margin;
210
+        $this->pageBreakTrigger = $this->h - $margin;
211 211
     }
212 212
     
213 213
     public function setDisplayMode($zoom, $layout = 'continuous')
214 214
     {
215 215
         //Set display mode in viewer
216
-        if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
216
+        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
217 217
             $this->zoomMode = $zoom;
218 218
         } else {
219
-            $this->error('Incorrect zoom display mode: '.$zoom);
219
+            $this->error('Incorrect zoom display mode: ' . $zoom);
220 220
         }
221
-        if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
221
+        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') {
222 222
             $this->layoutMode = $layout;
223 223
         } else {
224
-            $this->error('Incorrect layout display mode: '.$layout);
224
+            $this->error('Incorrect layout display mode: ' . $layout);
225 225
         }
226 226
     }
227 227
     
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         if ($isUTF8) {
260 260
             $author = $this->utf8Toutf16($author);
261 261
         }
262
-        $this->author=$author;
262
+        $this->author = $author;
263 263
     }
264 264
     
265 265
     public function setKeywords($keywords, $isUTF8 = false)
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
     public function aliasNbPages($alias = '{nb}')
284 284
     {
285 285
         //Define an alias for total number of pages
286
-        $this->aliasNbPages=$alias;
286
+        $this->aliasNbPages = $alias;
287 287
     }
288 288
     
289 289
     public function error($msg)
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             $this->open();
323 323
         }
324 324
         $family = $this->fontFamily;
325
-        $style = $this->fontStyle.($this->underline ? 'U' : '');
325
+        $style = $this->fontStyle . ($this->underline ? 'U' : '');
326 326
         $size = $this->fontSizePt;
327 327
         $lw = $this->lineWidth;
328 328
         $dc = $this->drawColor;
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
         $this->out('2 J');
344 344
         //Set line width
345 345
         $this->lineWidth = $lw;
346
-        $this->out(sprintf('%.2F w', $lw*$this->k));
346
+        $this->out(sprintf('%.2F w', $lw * $this->k));
347 347
         //Set font
348 348
         if ($family) {
349 349
             $this->setFont($family, $style, $size);
350 350
         }
351 351
         //Set colors
352 352
         $this->drawColor = $dc;
353
-        if ($dc!='0 G') {
353
+        if ($dc != '0 G') {
354 354
             $this->out($dc);
355 355
         }
356 356
         $this->fillColor = $fc;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         //Restore line width
367 367
         if ($this->lineWidth != $lw) {
368 368
             $this->lineWidth = $lw;
369
-            $this->out(sprintf('%.2F w', $lw*$this->k));
369
+            $this->out(sprintf('%.2F w', $lw * $this->k));
370 370
         }
371 371
         //Restore font
372 372
         if ($family) {
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
     public function setDrawColor($r, $g = null, $b = null)
405 405
     {
406 406
         //Set color for all stroking operations
407
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
408
-            $this->drawColor = sprintf('%.3F G', $r/255);
407
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
408
+            $this->drawColor = sprintf('%.3F G', $r / 255);
409 409
         } else {
410
-            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255);
410
+            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
411 411
         }
412 412
         if ($this->page > 0) {
413 413
             $this->out($this->drawColor);
@@ -417,10 +417,10 @@  discard block
 block discarded – undo
417 417
     public function setFillColor($r, $g = null, $b = null)
418 418
     {
419 419
         //Set color for all filling operations
420
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
421
-            $this->fillColor = sprintf('%.3F g', $r/255);
420
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
421
+            $this->fillColor = sprintf('%.3F g', $r / 255);
422 422
         } else {
423
-            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
423
+            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
424 424
         }
425 425
         $this->colorFlag = ($this->fillColor != $this->textColor);
426 426
         if ($this->page > 0) {
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
     public function settextColor($r, $g = null, $b = null)
432 432
     {
433 433
         //Set color for text
434
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
435
-            $this->textColor = sprintf('%.3F g', $r/255);
434
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
435
+            $this->textColor = sprintf('%.3F g', $r / 255);
436 436
         } else {
437
-            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
437
+            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
438 438
         }
439 439
         $this->colorFlag = ($this->fillColor != $this->textColor);
440 440
     }
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
     public function getStringWidth($s)
443 443
     {
444 444
         //Get width of a string in the current font
445
-        $s = (string)$s;
446
-        $cw =& $this->currentFont['cw'];
445
+        $s = (string) $s;
446
+        $cw = & $this->currentFont['cw'];
447 447
         $w = 0;
448 448
         $l = strlen($s);
449
-        for ($i=0; $i<$l; $i++) {
449
+        for ($i = 0; $i < $l; $i++) {
450 450
             $w += $cw[$s[$i]];
451 451
         }
452
-        return $w*$this->fontSize/1000;
452
+        return $w * $this->fontSize / 1000;
453 453
     }
454 454
     
455 455
     public function setLineWidth($width)
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
         //Set line width
458 458
         $this->lineWidth = $width;
459 459
         if ($this->page > 0) {
460
-            $this->out(sprintf('%.2F w', $width*$this->k));
460
+            $this->out(sprintf('%.2F w', $width * $this->k));
461 461
         }
462 462
     }
463 463
     
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
         $this->out(
468 468
             sprintf(
469 469
                 '%.2F %.2F m %.2F %.2F l S',
470
-                $x1*$this->k,
471
-                ($this->h-$y1)*$this->k,
472
-                $x2*$this->k,
473
-                ($this->h-$y2)*$this->k
470
+                $x1 * $this->k,
471
+                ($this->h - $y1) * $this->k,
472
+                $x2 * $this->k,
473
+                ($this->h - $y2) * $this->k
474 474
             )
475 475
         );
476 476
     }
@@ -488,10 +488,10 @@  discard block
 block discarded – undo
488 488
         $this->out(
489 489
             sprintf(
490 490
                 '%.2F %.2F %.2F %.2F re %s',
491
-                $x*$this->k,
492
-                ($this->h-$y)*$this->k,
493
-                $w*$this->k,
494
-                -$h*$this->k,
491
+                $x * $this->k,
492
+                ($this->h - $y) * $this->k,
493
+                $w * $this->k,
494
+                -$h * $this->k,
495 495
                 $op
496 496
             )
497 497
         );
@@ -502,24 +502,24 @@  discard block
 block discarded – undo
502 502
         //Add a TrueType or Type1 font
503 503
         $family = strtolower($family);
504 504
         if ($file == '') {
505
-            $file = str_replace(' ', '', $family).strtolower($style).'.php';
505
+            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
506 506
         }
507
-        if ($family=='arial') {
508
-            $family='helvetica';
507
+        if ($family == 'arial') {
508
+            $family = 'helvetica';
509 509
         }
510 510
         $style = strtoupper($style);
511 511
         if ($style == 'IB') {
512 512
             $style = 'BI';
513 513
         }
514
-        $fontkey = $family.$style;
514
+        $fontkey = $family . $style;
515 515
         if (isset($this->fonts[$fontkey])) {
516 516
             return;
517 517
         }
518
-        include $this->getFontPath().$file;
518
+        include $this->getFontPath() . $file;
519 519
         if (!isset($name)) {
520 520
             $this->error('Could not include font definition file');
521 521
         }
522
-        $i = count($this->fonts)+1;
522
+        $i = count($this->fonts) + 1;
523 523
         $this->fonts[$fontkey] = [
524 524
             'i'=>$i,
525 525
             'type'=>$type,
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
             //Search existing encodings
536 536
             $d = 0;
537 537
             $nb = count($this->diffs);
538
-            for ($i=1; $i<=$nb; $i++) {
538
+            for ($i = 1; $i <= $nb; $i++) {
539 539
                 if ($this->diffs[$i] == $diff) {
540 540
                     $d = $i;
541 541
                     break;
542 542
                 }
543 543
             }
544 544
             if ($d == 0) {
545
-                $d = $nb+1;
545
+                $d = $nb + 1;
546 546
                 $this->diffs[$d] = $diff;
547 547
             }
548 548
             $this->fonts[$fontkey]['diff'] = $d;
549 549
         }
550 550
         if ($file) {
551
-            if ($type=='TrueType') {
551
+            if ($type == 'TrueType') {
552 552
                 $this->fontFiles[$file] = array('length1'=>$originalsize);
553 553
             } else {
554 554
                 $this->fontFiles[$file] = array('length1'=>$size1, 'length2'=>$size2);
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
             $size = $this->fontSizePt;
584 584
         }
585 585
         //Test if font is already selected
586
-        if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) {
586
+        if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) {
587 587
             return;
588 588
         }
589 589
         //Test if used for the first time
590
-        $fontkey = $family.$style;
590
+        $fontkey = $family . $style;
591 591
         if (!isset($this->fonts[$fontkey])) {
592 592
             //Check if one of the standard fonts
593 593
             if (isset($this->coreFonts[$fontkey])) {
594 594
                 if (!isset($fpdf_charwidths[$fontkey])) {
595 595
                     //Load metric file
596
-                    $file=$family;
597
-                    if ($family=='times' || $family=='helvetica') {
596
+                    $file = $family;
597
+                    if ($family == 'times' || $family == 'helvetica') {
598 598
                         $file .= strtolower($style);
599 599
                     }
600
-                    include $this->getFontPath().$file.'.php';
600
+                    include $this->getFontPath() . $file . '.php';
601 601
                     if (!isset($fpdf_charwidths[$fontkey])) {
602 602
                         $this->error('Could not include font metric file');
603 603
                     }
604 604
                 }
605
-                $i = count($this->fonts)+1;
605
+                $i = count($this->fonts) + 1;
606 606
                 $name = $this->coreFonts[$fontkey];
607 607
                 $cw = $fpdf_charwidths[$fontkey];
608 608
                 $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw];
609 609
             } else {
610
-                $this->error('Undefined font: '.$family.' '.$style);
610
+                $this->error('Undefined font: ' . $family . ' ' . $style);
611 611
             }
612 612
         }
613 613
         //Select it
614 614
         $this->fontFamily = $family;
615 615
         $this->fontStyle = $style;
616 616
         $this->fontSizePt = $size;
617
-        $this->fontSize = $size/$this->k;
618
-        $this->currentFont =& $this->fonts[$fontkey];
617
+        $this->fontSize = $size / $this->k;
618
+        $this->currentFont = & $this->fonts[$fontkey];
619 619
         if ($this->page > 0) {
620 620
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
621 621
         }
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             return;
629 629
         }
630 630
         $this->fontSizePt = $size;
631
-        $this->fontSize = $size/$this->k;
631
+        $this->fontSize = $size / $this->k;
632 632
         if ($this->page > 0) {
633 633
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
634 634
         }
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
     public function addlink()
638 638
     {
639 639
         //Create a new internal link
640
-        $n = count($this->links)+1;
640
+        $n = count($this->links) + 1;
641 641
         $this->links[$n] = array(0, 0);
642 642
         return $n;
643 643
     }
@@ -658,10 +658,10 @@  discard block
 block discarded – undo
658 658
     {
659 659
         //Put a link on the page
660 660
         $this->PageLinks[$this->page][] = [
661
-            $x*$this->k,
662
-            $this->hPt-$y*$this->k,
663
-            $w*$this->k,
664
-            $h*$this->k,
661
+            $x * $this->k,
662
+            $this->hPt - $y * $this->k,
663
+            $w * $this->k,
664
+            $h * $this->k,
665 665
             $link
666 666
         ];
667 667
     }
@@ -669,12 +669,12 @@  discard block
 block discarded – undo
669 669
     public function text($x, $y, $txt)
670 670
     {
671 671
         //Output a string
672
-        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt));
673
-        if ($this->underline && $txt!='') {
674
-            $s .= ' '.$this->doUnderLine($x, $y, $txt);
672
+        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt));
673
+        if ($this->underline && $txt != '') {
674
+            $s .= ' ' . $this->doUnderLine($x, $y, $txt);
675 675
         }
676 676
         if ($this->colorFlag) {
677
-            $s = 'q '.$this->textColor.' '.$s.' Q';
677
+            $s = 'q ' . $this->textColor . ' ' . $s . ' Q';
678 678
         }
679 679
         $this->out($s);
680 680
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
     {
690 690
         //Output a cell
691 691
         $k = $this->k;
692
-        if ($this->y+$h > $this->PageBreakTrigger
692
+        if ($this->y + $h > $this->PageBreakTrigger
693 693
             && !$this->InHeader
694 694
             && !$this->InFooter
695 695
             && $this->acceptPageBreak()
@@ -705,77 +705,77 @@  discard block
 block discarded – undo
705 705
             $this->x = $x;
706 706
             if ($ws > 0) {
707 707
                 $this->ws = $ws;
708
-                $this->out(sprintf('%.3F Tw', $ws*$k));
708
+                $this->out(sprintf('%.3F Tw', $ws * $k));
709 709
             }
710 710
         }
711 711
         if ($w == 0) {
712
-            $w = $this->w-$this->rMargin-$this->x;
712
+            $w = $this->w - $this->rMargin - $this->x;
713 713
         }
714
-        $s='';
715
-        if ($fill || $border==1) {
714
+        $s = '';
715
+        if ($fill || $border == 1) {
716 716
             if ($fill) {
717
-                $op=($border==1) ? 'B' : 'f';
717
+                $op = ($border == 1) ? 'B' : 'f';
718 718
             } else {
719
-                $op='S';
719
+                $op = 'S';
720 720
             }
721
-            $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op);
721
+            $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
722 722
         }
723 723
         if (is_string($border)) {
724 724
             $x = $this->x;
725 725
             $y = $this->y;
726 726
             if (strpos($border, 'L') !== false) {
727
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k);
727
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k);
728 728
             }
729 729
             if (strpos($border, 'T') !== false) {
730
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k);
730
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
731 731
             }
732 732
             if (strpos($border, 'R') !== false) {
733 733
                 $s .= sprintf(
734 734
                     '%.2F %.2F m %.2F %.2F l S ',
735
-                    ($x+$w)*$k,
736
-                    ($this->h-$y)*$k,
737
-                    ($x+$w)*$k,
738
-                    ($this->h-($y+$h))*$k
735
+                    ($x + $w) * $k,
736
+                    ($this->h - $y) * $k,
737
+                    ($x + $w) * $k,
738
+                    ($this->h - ($y + $h)) * $k
739 739
                 );
740 740
             }
741 741
             if (strpos($border, 'B') !== false) {
742 742
                 $s .= sprintf(
743 743
                     '%.2F %.2F m %.2F %.2F l S ',
744
-                    $x*$k,
745
-                    ($this->h-($y+$h))*$k,
746
-                    ($x+$w)*$k,
747
-                    ($this->h-($y+$h))*$k
744
+                    $x * $k,
745
+                    ($this->h - ($y + $h)) * $k,
746
+                    ($x + $w) * $k,
747
+                    ($this->h - ($y + $h)) * $k
748 748
                 );
749 749
             }
750 750
         }
751 751
         if ($txt !== '') {
752 752
             if ($align == 'R') {
753
-                $dx = $w-$this->cMargin-$this->getStringWidth($txt);
753
+                $dx = $w - $this->cMargin - $this->getStringWidth($txt);
754 754
             } elseif ($align == 'C') {
755
-                $dx = ($w-$this->getStringWidth($txt))/2;
755
+                $dx = ($w - $this->getStringWidth($txt)) / 2;
756 756
             } else {
757 757
                 $dx = $this->cMargin;
758 758
             }
759 759
             if ($this->colorFlag) {
760
-                $s .= 'q '.$this->textColor.' ';
760
+                $s .= 'q ' . $this->textColor . ' ';
761 761
             }
762 762
             $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
763 763
             $s .= sprintf(
764 764
                 'BT %.2F %.2F Td (%s) Tj ET',
765
-                ($this->x+$dx)*$k,
766
-                ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k,
765
+                ($this->x + $dx) * $k,
766
+                ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k,
767 767
                 $txt2
768 768
             );
769 769
             if ($this->underline) {
770
-                $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt);
770
+                $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt);
771 771
             }
772 772
             if ($this->colorFlag) {
773
-                $s.=' Q';
773
+                $s .= ' Q';
774 774
             }
775 775
             if ($link) {
776 776
                 $this->link(
777
-                    $this->x+$dx,
778
-                    $this->y+.5*$h-.5*$this->fontSize,
777
+                    $this->x + $dx,
778
+                    $this->y + .5 * $h - .5 * $this->fontSize,
779 779
                     $this->getStringWidth($txt),
780 780
                     $this->fontSize,
781 781
                     $link
@@ -800,14 +800,14 @@  discard block
 block discarded – undo
800 800
     public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false)
801 801
     {
802 802
         //Output text with automatic or explicit line breaks
803
-        $cw =& $this->currentFont['cw'];
803
+        $cw = & $this->currentFont['cw'];
804 804
         if ($w == 0) {
805
-            $w = $this->w-$this->rMargin-$this->x;
805
+            $w = $this->w - $this->rMargin - $this->x;
806 806
         }
807
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
807
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
808 808
         $s = str_replace("\r", '', $txt);
809 809
         $nb = strlen($s);
810
-        if ($nb>0 && $s[$nb-1] == "\n") {
810
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
811 811
             $nb--;
812 812
         }
813 813
         $b = 0;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
                 if (strpos($border, 'R') !== false) {
825 825
                     $b2 .= 'R';
826 826
                 }
827
-                $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2;
827
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
828 828
             }
829 829
         }
830 830
         $sep = -1;
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
         $l = 0;
834 834
         $ns = 0;
835 835
         $nl = 1;
836
-        while ($i<$nb) {
836
+        while ($i < $nb) {
837 837
             //Get next character
838 838
             $c = $s[$i];
839 839
             if ($c == "\n") {
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
                     $this->ws = 0;
843 843
                     $this->out('0 Tw');
844 844
                 }
845
-                $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
845
+                $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
846 846
                 $i++;
847 847
                 $sep = -1;
848 848
                 $j = $i;
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
                 $ns = 0;
851 851
                 $nl++;
852 852
                 if ($border && $nl == 2) {
853
-                    $b=$b2;
853
+                    $b = $b2;
854 854
                 }
855 855
                 continue;
856 856
             }
@@ -870,14 +870,14 @@  discard block
 block discarded – undo
870 870
                         $this->ws = 0;
871 871
                         $this->out('0 Tw');
872 872
                     }
873
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
873
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
874 874
                 } else {
875
-                    if ($align=='J') {
876
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0;
877
-                        $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
875
+                    if ($align == 'J') {
876
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0;
877
+                        $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
878 878
                     }
879
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
880
-                    $i = $sep+1;
879
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
880
+                    $i = $sep + 1;
881 881
                 }
882 882
                 $sep = -1;
883 883
                 $j = $i;
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
             $this->ws = 0;
897 897
             $this->out('0 Tw');
898 898
         }
899
-        if ($border && strpos($border, 'B')!==false) {
899
+        if ($border && strpos($border, 'B') !== false) {
900 900
             $b .= 'B';
901 901
         }
902
-        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
902
+        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
903 903
         $this->x = $this->lMargin;
904 904
     }
905 905
     
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
     public function write($h, $txt, $link = '')
908 908
     {
909 909
         //Output text in flowing mode
910
-        $cw =& $this->currentFont['cw'];
911
-        $w = $this->w-$this->rMargin-$this->x;
912
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
910
+        $cw = & $this->currentFont['cw'];
911
+        $w = $this->w - $this->rMargin - $this->x;
912
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
913 913
         $s = str_replace("\r", '', $txt);
914 914
         $nb = strlen($s);
915 915
         $sep = -1;
@@ -919,18 +919,18 @@  discard block
 block discarded – undo
919 919
         $nl = 1;
920 920
         while ($i < $nb) {
921 921
             //Get next character
922
-            $c=$s[$i];
923
-            if ($c=="\n") {
922
+            $c = $s[$i];
923
+            if ($c == "\n") {
924 924
                 //Explicit line break
925
-                $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
925
+                $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
926 926
                 $i++;
927 927
                 $sep = -1;
928 928
                 $j = $i;
929 929
                 $l = 0;
930 930
                 if ($nl == 1) {
931 931
                     $this->x = $this->lMargin;
932
-                    $w = $this->w-$this->rMargin-$this->x;
933
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
932
+                    $w = $this->w - $this->rMargin - $this->x;
933
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
934 934
                 }
935 935
                 $nl++;
936 936
                 continue;
@@ -946,8 +946,8 @@  discard block
 block discarded – undo
946 946
                         //Move to next line
947 947
                         $this->x = $this->lMargin;
948 948
                         $this->y += $h;
949
-                        $w = $this->w-$this->rMargin-$this->x;
950
-                        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
949
+                        $w = $this->w - $this->rMargin - $this->x;
950
+                        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
951 951
                         $i++;
952 952
                         $nl++;
953 953
                         continue;
@@ -955,18 +955,18 @@  discard block
 block discarded – undo
955 955
                     if ($i == $j) {
956 956
                         $i++;
957 957
                     }
958
-                    $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
958
+                    $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
959 959
                 } else {
960
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link);
961
-                    $i = $sep+1;
960
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link);
961
+                    $i = $sep + 1;
962 962
                 }
963 963
                 $sep = -1;
964 964
                 $j = $i;
965 965
                 $l = 0;
966 966
                 if ($nl == 1) {
967 967
                     $this->x = $this->lMargin;
968
-                    $w = $this->w-$this->rMargin-$this->x;
969
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
968
+                    $w = $this->w - $this->rMargin - $this->x;
969
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
970 970
                 }
971 971
                 $nl++;
972 972
             } else {
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
         }
976 976
         //Last chunk
977 977
         if ($i != $j) {
978
-            $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
978
+            $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
979 979
         }
980 980
     }
981 981
     
@@ -998,20 +998,20 @@  discard block
 block discarded – undo
998 998
             if ($type == '') {
999 999
                 $pos = strrpos($file, '.');
1000 1000
                 if (!$pos) {
1001
-                    $this->error('Image file has no extension and no type was specified: '.$file);
1001
+                    $this->error('Image file has no extension and no type was specified: ' . $file);
1002 1002
                 }
1003
-                $type = substr($file, $pos+1);
1003
+                $type = substr($file, $pos + 1);
1004 1004
             }
1005 1005
             $type = strtolower($type);
1006 1006
             if ($type == 'jpeg') {
1007 1007
                 $type = 'jpg';
1008 1008
             }
1009
-            $mtd = 'parse'.strtoupper($type);
1009
+            $mtd = 'parse' . strtoupper($type);
1010 1010
             if (!method_exists($this, $mtd)) {
1011
-                $this->error('Unsupported image type: '.$type);
1011
+                $this->error('Unsupported image type: ' . $type);
1012 1012
             }
1013 1013
             $info = $this->$mtd($file);
1014
-            $info['i'] = count($this->images)+1;
1014
+            $info['i'] = count($this->images) + 1;
1015 1015
             $this->images[$file] = $info;
1016 1016
         } else {
1017 1017
             $info = $this->images[$file];
@@ -1019,16 +1019,16 @@  discard block
 block discarded – undo
1019 1019
         //Automatic width and height calculation if needed
1020 1020
         if ($w == 0 && $h == 0) {
1021 1021
             //Put image at 72 dpi
1022
-            $w = $info['w']/$this->k;
1023
-            $h = $info['h']/$this->k;
1022
+            $w = $info['w'] / $this->k;
1023
+            $h = $info['h'] / $this->k;
1024 1024
         } elseif ($w == 0) {
1025
-            $w = $h*$info['w']/$info['h'];
1025
+            $w = $h * $info['w'] / $info['h'];
1026 1026
         } elseif ($h == 0) {
1027
-            $h = $w*$info['h']/$info['w'];
1027
+            $h = $w * $info['h'] / $info['w'];
1028 1028
         }
1029 1029
         //Flowing mode
1030 1030
         if ($y === null) {
1031
-            if ($this->y+$h > $this->pageBreakTrigger
1031
+            if ($this->y + $h > $this->pageBreakTrigger
1032 1032
                 && !$this->inHeader
1033 1033
                 && !$this->inFooter
1034 1034
                 && $this->acceptPageBreak()
@@ -1047,10 +1047,10 @@  discard block
 block discarded – undo
1047 1047
         $this->out(
1048 1048
             sprintf(
1049 1049
                 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',
1050
-                $w*$this->k,
1051
-                $h*$this->k,
1052
-                $x*$this->k,
1053
-                ($this->h-($y+$h))*$this->k,
1050
+                $w * $this->k,
1051
+                $h * $this->k,
1052
+                $x * $this->k,
1053
+                ($this->h - ($y + $h)) * $this->k,
1054 1054
                 $info['i']
1055 1055
             )
1056 1056
         );
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         if ($x >= 0) {
1074 1074
             $this->x = $x;
1075 1075
         } else {
1076
-            $this->x = $this->w+$x;
1076
+            $this->x = $this->w + $x;
1077 1077
         }
1078 1078
     }
1079 1079
     
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
         if ($y >= 0) {
1093 1093
             $this->y = $y;
1094 1094
         } else {
1095
-            $this->y = $this->h+$y;
1095
+            $this->y = $this->h + $y;
1096 1096
         }
1097 1097
     }
1098 1098
     
@@ -1139,8 +1139,8 @@  discard block
 block discarded – undo
1139 1139
                     if (headers_sent()) {
1140 1140
                         $this->error('Some data has already been output, can\'t send PDF file');
1141 1141
                     }
1142
-                    header('Content-Length: '.strlen($this->buffer));
1143
-                    header('Content-Disposition: inline; filename="'.$name.'"');
1142
+                    header('Content-Length: ' . strlen($this->buffer));
1143
+                    header('Content-Disposition: inline; filename="' . $name . '"');
1144 1144
                     header('Cache-Control: private, max-age=0, must-revalidate');
1145 1145
                     header('Pragma: public');
1146 1146
                     ini_set('zlib.output_compression', '0');
@@ -1156,8 +1156,8 @@  discard block
 block discarded – undo
1156 1156
                 if (headers_sent()) {
1157 1157
                     $this->error('Some data has already been output, can\'t send PDF file');
1158 1158
                 }
1159
-                header('Content-Length: '.strlen($this->buffer));
1160
-                header('Content-Disposition: attachment; filename="'.$name.'"');
1159
+                header('Content-Length: ' . strlen($this->buffer));
1160
+                header('Content-Disposition: attachment; filename="' . $name . '"');
1161 1161
                 header('Cache-Control: private, max-age=0, must-revalidate');
1162 1162
                 header('Pragma: public');
1163 1163
                 ini_set('zlib.output_compression', '0');
@@ -1165,9 +1165,9 @@  discard block
 block discarded – undo
1165 1165
                 break;
1166 1166
             case 'F':
1167 1167
                 //Save to local file
1168
-                $f=fopen($name, 'wb');
1168
+                $f = fopen($name, 'wb');
1169 1169
                 if (!$f) {
1170
-                    $this->error('Unable to create output file: '.$name);
1170
+                    $this->error('Unable to create output file: ' . $name);
1171 1171
                 }
1172 1172
                 fwrite($f, $this->buffer, strlen($this->buffer));
1173 1173
                 fclose($f);
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
                 //Return as a string
1177 1177
                 return $this->buffer;
1178 1178
             default:
1179
-                $this->error('Incorrect output destination: '.$dest);
1179
+                $this->error('Incorrect output destination: ' . $dest);
1180 1180
         }
1181 1181
         return '';
1182 1182
     }
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
     protected function dochecks()
1186 1186
     {
1187 1187
         //Check availability of %F
1188
-        if (sprintf('%.1F', 1.0)!='1.0') {
1188
+        if (sprintf('%.1F', 1.0) != '1.0') {
1189 1189
             $this->error('This version of PHP is not supported');
1190 1190
         }
1191 1191
         //Check mbstring overloading
@@ -1197,19 +1197,19 @@  discard block
 block discarded – undo
1197 1197
     
1198 1198
     protected function getpageformat($format)
1199 1199
     {
1200
-        $format=strtolower($format);
1200
+        $format = strtolower($format);
1201 1201
         if (!isset($this->pageFormats[$format])) {
1202
-            $this->error('Unknown page format: '.$format);
1202
+            $this->error('Unknown page format: ' . $format);
1203 1203
         }
1204
-        $a=$this->pageFormats[$format];
1205
-        return array($a[0]/$this->k, $a[1]/$this->k);
1204
+        $a = $this->pageFormats[$format];
1205
+        return array($a[0] / $this->k, $a[1] / $this->k);
1206 1206
     }
1207 1207
     
1208 1208
     
1209 1209
     protected function getFontPath()
1210 1210
     {
1211
-        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) {
1212
-            define('FPDF_FONTPATH', dirname(__FILE__).'/font/');
1211
+        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font')) {
1212
+            define('FPDF_FONTPATH', dirname(__FILE__) . '/font/');
1213 1213
         }
1214 1214
         return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
1215 1215
     }
@@ -1233,12 +1233,12 @@  discard block
 block discarded – undo
1233 1233
             $format = $this->defPageFormat;
1234 1234
         } else {
1235 1235
             if (is_string($format)) {
1236
-                $format=$this->getpageformat($format);
1236
+                $format = $this->getpageformat($format);
1237 1237
             }
1238 1238
         }
1239 1239
         if ($orientation != $this->curOrientation
1240
-            || $format[0]!=$this->curPageFormat[0]
1241
-            || $format[1]!=$this->curPageFormat[1]
1240
+            || $format[0] != $this->curPageFormat[0]
1241
+            || $format[1] != $this->curPageFormat[1]
1242 1242
         ) {
1243 1243
             //New size
1244 1244
             if ($orientation == 'P') {
@@ -1248,9 +1248,9 @@  discard block
 block discarded – undo
1248 1248
                 $this->w = $format[1];
1249 1249
                 $this->h = $format[0];
1250 1250
             }
1251
-            $this->wPt = $this->w*$this->k;
1252
-            $this->hPt = $this->h*$this->k;
1253
-            $this->pageBreakTrigger = $this->h-$this->bMargin;
1251
+            $this->wPt = $this->w * $this->k;
1252
+            $this->hPt = $this->h * $this->k;
1253
+            $this->pageBreakTrigger = $this->h - $this->bMargin;
1254 1254
             $this->curOrientation = $orientation;
1255 1255
             $this->curPageFormat = $format;
1256 1256
         }
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
     protected function textString($s)
1284 1284
     {
1285 1285
         //Format a text string
1286
-        return '('.$this->escape($s).')';
1286
+        return '(' . $this->escape($s) . ')';
1287 1287
     }
1288 1288
     
1289 1289
     
@@ -1299,16 +1299,16 @@  discard block
 block discarded – undo
1299 1299
                 //3-byte character
1300 1300
                 $c2 = ord($s[$i++]);
1301 1301
                 $c3 = ord($s[$i++]);
1302
-                $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
1303
-                $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
1302
+                $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2));
1303
+                $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F));
1304 1304
             } elseif ($c1 >= 192) {
1305 1305
                 //2-byte character
1306 1306
                 $c2 = ord($s[$i++]);
1307
-                $res .= chr(($c1 & 0x1C)>>2);
1308
-                $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
1307
+                $res .= chr(($c1 & 0x1C) >> 2);
1308
+                $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F));
1309 1309
             } else {
1310 1310
                 //Single-byte character
1311
-                $res .= "\0".chr($c1);
1311
+                $res .= "\0" . chr($c1);
1312 1312
             }
1313 1313
         }
1314 1314
         return $res;
@@ -1320,13 +1320,13 @@  discard block
 block discarded – undo
1320 1320
         //Underline text
1321 1321
         $up = $this->currentFont['up'];
1322 1322
         $ut = $this->currentFont['ut'];
1323
-        $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' ');
1323
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1324 1324
         return sprintf(
1325 1325
             '%.2F %.2F %.2F %.2F re f',
1326
-            $x*$this->k,
1327
-            ($this->h-($y-$up/1000*$this->fontSize))*$this->k,
1328
-            $w*$this->k,
1329
-            -$ut/1000*$this->fontSizePt
1326
+            $x * $this->k,
1327
+            ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k,
1328
+            $w * $this->k,
1329
+            -$ut / 1000 * $this->fontSizePt
1330 1330
         );
1331 1331
     }
1332 1332
     
@@ -1336,17 +1336,17 @@  discard block
 block discarded – undo
1336 1336
         //Extract info from a JPEG file
1337 1337
         $a = getImageSize($file);
1338 1338
         if (!$a) {
1339
-            $this->error('Missing or incorrect image file: '.$file);
1339
+            $this->error('Missing or incorrect image file: ' . $file);
1340 1340
         }
1341
-        if ($a[2]!=2) {
1342
-            $this->error('Not a JPEG file: '.$file);
1341
+        if ($a[2] != 2) {
1342
+            $this->error('Not a JPEG file: ' . $file);
1343 1343
         }
1344 1344
         if (!isset($a['channels']) || $a['channels'] == 3) {
1345 1345
             $colspace = 'DeviceRGB';
1346 1346
         } elseif ($a['channels'] == 4) {
1347 1347
             $colspace = 'DeviceCMYK';
1348 1348
         } else {
1349
-            $colspace='DeviceGray';
1349
+            $colspace = 'DeviceGray';
1350 1350
         }
1351 1351
         $bpc = isset($a['bits']) ? $a['bits'] : 8;
1352 1352
         //Read whole file
@@ -1365,22 +1365,22 @@  discard block
 block discarded – undo
1365 1365
         //Extract info from a PNG file
1366 1366
         $f = fopen($file, 'rb');
1367 1367
         if (!$f) {
1368
-            $this->error('Can\'t open image file: '.$file);
1368
+            $this->error('Can\'t open image file: ' . $file);
1369 1369
         }
1370 1370
         //Check signature
1371
-        if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
1372
-            $this->error('Not a PNG file: '.$file);
1371
+        if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
1372
+            $this->error('Not a PNG file: ' . $file);
1373 1373
         }
1374 1374
         //Read header chunk
1375 1375
         $this->readstream($f, 4);
1376
-        if ($this->readstream($f, 4)!='IHDR') {
1377
-            $this->error('Incorrect PNG file: '.$file);
1376
+        if ($this->readstream($f, 4) != 'IHDR') {
1377
+            $this->error('Incorrect PNG file: ' . $file);
1378 1378
         }
1379 1379
         $w = $this->readint($f);
1380 1380
         $h = $this->readint($f);
1381 1381
         $bpc = ord($this->readstream($f, 1));
1382
-        if ($bpc>8) {
1383
-            $this->error('16-bit depth not supported: '.$file);
1382
+        if ($bpc > 8) {
1383
+            $this->error('16-bit depth not supported: ' . $file);
1384 1384
         }
1385 1385
         $ct = ord($this->readstream($f, 1));
1386 1386
         if ($ct == 0) {
@@ -1390,20 +1390,20 @@  discard block
 block discarded – undo
1390 1390
         } elseif ($ct == 3) {
1391 1391
             $colspace = 'Indexed';
1392 1392
         } else {
1393
-            $this->error('Alpha channel not supported: '.$file);
1393
+            $this->error('Alpha channel not supported: ' . $file);
1394 1394
         }
1395 1395
         if (ord($this->readstream($f, 1)) != 0) {
1396
-            $this->error('Unknown compression method: '.$file);
1396
+            $this->error('Unknown compression method: ' . $file);
1397 1397
         }
1398 1398
         if (ord($this->readstream($f, 1)) != 0) {
1399
-            $this->error('Unknown filter method: '.$file);
1399
+            $this->error('Unknown filter method: ' . $file);
1400 1400
         }
1401 1401
         if (ord($this->readstream($f, 1)) != 0) {
1402
-            $this->error('Interlacing not supported: '.$file);
1402
+            $this->error('Interlacing not supported: ' . $file);
1403 1403
         }
1404 1404
         $this->readstream($f, 4);
1405 1405
         $parms = '/DecodeParms <</Predictor 15 /Colors '
1406
-            . ($ct==2 ? 3 : 1)
1406
+            . ($ct == 2 ? 3 : 1)
1407 1407
             . ' /BitsPerComponent '
1408 1408
             . $bpc
1409 1409
             . ' /Columns '
@@ -1441,11 +1441,11 @@  discard block
 block discarded – undo
1441 1441
             } elseif ($type == 'IEND') {
1442 1442
                 break;
1443 1443
             } else {
1444
-                $this->readstream($f, $n+4);
1444
+                $this->readstream($f, $n + 4);
1445 1445
             }
1446 1446
         } while ($n);
1447 1447
         if ($colspace == 'Indexed' && empty($pal)) {
1448
-            $this->error('Missing palette in '.$file);
1448
+            $this->error('Missing palette in ' . $file);
1449 1449
         }
1450 1450
         fclose($f);
1451 1451
         return [
@@ -1465,9 +1465,9 @@  discard block
 block discarded – undo
1465 1465
     protected function readstream($f, $n)
1466 1466
     {
1467 1467
         //Read n bytes from stream
1468
-        $res='';
1468
+        $res = '';
1469 1469
         while ($n > 0 && !feof($f)) {
1470
-            $s=fread($f, $n);
1470
+            $s = fread($f, $n);
1471 1471
             if ($s === false) {
1472 1472
                 $this->error('Error while reading stream');
1473 1473
             }
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
         }
1501 1501
         $im = imagecreatefromgif($file);
1502 1502
         if (!$im) {
1503
-            $this->error('Missing or incorrect image file: '.$file);
1503
+            $this->error('Missing or incorrect image file: ' . $file);
1504 1504
         }
1505 1505
         imageinterlace($im, 0);
1506 1506
         $tmp = tempnam('.', 'gif');
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
             $this->error('Error while saving to temporary file');
1512 1512
         }
1513 1513
         imagedestroy($im);
1514
-        $info=$this->parsePNG($tmp);
1514
+        $info = $this->parsePNG($tmp);
1515 1515
         unlink($tmp);
1516 1516
         return $info;
1517 1517
     }
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
         //Begin a new object
1523 1523
         $this->n++;
1524 1524
         $this->offsets[$this->n] = strlen($this->buffer);
1525
-        $this->out($this->n.' 0 obj');
1525
+        $this->out($this->n . ' 0 obj');
1526 1526
     }
1527 1527
     
1528 1528
     
@@ -1538,9 +1538,9 @@  discard block
 block discarded – undo
1538 1538
     {
1539 1539
         //Add a line to the document
1540 1540
         if ($this->state == 2) {
1541
-            $this->pages[$this->page].=$s."\n";
1541
+            $this->pages[$this->page] .= $s . "\n";
1542 1542
         } else {
1543
-            $this->buffer .= $s."\n";
1543
+            $this->buffer .= $s . "\n";
1544 1544
         }
1545 1545
     }
1546 1546
     
@@ -1550,19 +1550,19 @@  discard block
 block discarded – undo
1550 1550
         $nb = $this->page;
1551 1551
         if (!empty($this->aliasNbPages)) {
1552 1552
             //Replace number of pages
1553
-            for ($n=1; $n<=$nb; $n++) {
1553
+            for ($n = 1; $n <= $nb; $n++) {
1554 1554
                 $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]);
1555 1555
             }
1556 1556
         }
1557 1557
         if ($this->defOrientation == 'P') {
1558
-            $wPt = $this->defPageFormat[0]*$this->k;
1559
-            $hPt = $this->defPageFormat[1]*$this->k;
1558
+            $wPt = $this->defPageFormat[0] * $this->k;
1559
+            $hPt = $this->defPageFormat[1] * $this->k;
1560 1560
         } else {
1561
-            $wPt = $this->defPageFormat[1]*$this->k;
1562
-            $hPt = $this->defPageFormat[0]*$this->k;
1561
+            $wPt = $this->defPageFormat[1] * $this->k;
1562
+            $hPt = $this->defPageFormat[0] * $this->k;
1563 1563
         }
1564 1564
         $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
1565
-        for ($n=1; $n<=$nb; $n++) {
1565
+        for ($n = 1; $n <= $nb; $n++) {
1566 1566
             //Page
1567 1567
             $this->newObj();
1568 1568
             $this->out('<</Type /Page');
@@ -1575,37 +1575,37 @@  discard block
 block discarded – undo
1575 1575
                 //Links
1576 1576
                 $annots = '/Annots [';
1577 1577
                 foreach ($this->PageLinks[$n] as $pl) {
1578
-                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]);
1579
-                    $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1578
+                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
1579
+                    $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
1580 1580
                     if (is_string($pl[4])) {
1581
-                        $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>';
1581
+                        $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>';
1582 1582
                     } else {
1583 1583
                         $l = $this->links[$pl[4]];
1584 1584
                         $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
1585
-                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k);
1585
+                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k);
1586 1586
                     }
1587 1587
                 }
1588
-                $this->out($annots.']');
1588
+                $this->out($annots . ']');
1589 1589
             }
1590
-            $this->out('/Contents '.($this->n+1).' 0 R>>');
1590
+            $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>');
1591 1591
             $this->out('endobj');
1592 1592
             //Page content
1593
-            $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1593
+            $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1594 1594
             $this->newObj();
1595
-            $this->out('<<'.$filter.'/Length '.strlen($p).'>>');
1595
+            $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>');
1596 1596
             $this->putStream($p);
1597 1597
             $this->out('endobj');
1598 1598
         }
1599 1599
         //Pages root
1600
-        $this->offsets[1]=strlen($this->buffer);
1600
+        $this->offsets[1] = strlen($this->buffer);
1601 1601
         $this->out('1 0 obj');
1602 1602
         $this->out('<</Type /Pages');
1603 1603
         $kids = '/Kids [';
1604
-        for ($i=0; $i<$nb; $i++) {
1605
-            $kids .= (3+2*$i).' 0 R ';
1604
+        for ($i = 0; $i < $nb; $i++) {
1605
+            $kids .= (3 + 2 * $i) . ' 0 R ';
1606 1606
         }
1607
-        $this->out($kids.']');
1608
-        $this->out('/Count '.$nb);
1607
+        $this->out($kids . ']');
1608
+        $this->out('/Count ' . $nb);
1609 1609
         $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt));
1610 1610
         $this->out('>>');
1611 1611
         $this->out('endobj');
@@ -1618,41 +1618,41 @@  discard block
 block discarded – undo
1618 1618
         foreach ($this->diffs as $diff) {
1619 1619
             //Encodings
1620 1620
             $this->newObj();
1621
-            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
1621
+            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
1622 1622
             $this->out('endobj');
1623 1623
         }
1624 1624
         foreach ($this->fontFiles as $file => $info) {
1625 1625
             //Font file embedding
1626 1626
             $this->newObj();
1627
-            $this->fontFiles[$file]['n']=$this->n;
1628
-            $font='';
1629
-            $f = fopen($this->getFontPath().$file, 'rb', 1);
1627
+            $this->fontFiles[$file]['n'] = $this->n;
1628
+            $font = '';
1629
+            $f = fopen($this->getFontPath() . $file, 'rb', 1);
1630 1630
             if (!$f) {
1631 1631
                 $this->error('Font file not found');
1632 1632
             }
1633 1633
             while (!feof($f)) {
1634
-                $font.=fread($f, 8192);
1634
+                $font .= fread($f, 8192);
1635 1635
             }
1636 1636
             fclose($f);
1637
-            $compressed = (substr($file, -2)=='.z');
1637
+            $compressed = (substr($file, -2) == '.z');
1638 1638
             if (!$compressed && isset($info['length2'])) {
1639
-                $header = (ord($font[0])==128);
1639
+                $header = (ord($font[0]) == 128);
1640 1640
                 if ($header) {
1641 1641
                     //Strip first binary header
1642 1642
                     $font = substr($font, 6);
1643 1643
                 }
1644 1644
                 if ($header && ord($font[$info['length1']]) == 128) {
1645 1645
                     //Strip second binary header
1646
-                    $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6);
1646
+                    $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
1647 1647
                 }
1648 1648
             }
1649
-            $this->out('<</Length '.strlen($font));
1649
+            $this->out('<</Length ' . strlen($font));
1650 1650
             if ($compressed) {
1651 1651
                 $this->out('/Filter /FlateDecode');
1652 1652
             }
1653
-            $this->out('/Length1 '.$info['length1']);
1653
+            $this->out('/Length1 ' . $info['length1']);
1654 1654
             if (isset($info['length2'])) {
1655
-                $this->out('/Length2 '.$info['length2'].' /Length3 0');
1655
+                $this->out('/Length2 ' . $info['length2'] . ' /Length3 0');
1656 1656
             }
1657 1657
             $this->out('>>');
1658 1658
             $this->putStream($font);
@@ -1660,32 +1660,32 @@  discard block
 block discarded – undo
1660 1660
         }
1661 1661
         foreach ($this->fonts as $k => $font) {
1662 1662
             //Font objects
1663
-            $this->fonts[$k]['n']=$this->n+1;
1663
+            $this->fonts[$k]['n'] = $this->n + 1;
1664 1664
             $type = $font['type'];
1665 1665
             $name = $font['name'];
1666 1666
             if ($type == 'core') {
1667 1667
                 //Standard font
1668 1668
                 $this->newObj();
1669 1669
                 $this->out('<</Type /Font');
1670
-                $this->out('/BaseFont /'.$name);
1670
+                $this->out('/BaseFont /' . $name);
1671 1671
                 $this->out('/Subtype /Type1');
1672 1672
                 if ($name != 'Symbol' && $name != 'ZapfDingbats') {
1673 1673
                     $this->out('/Encoding /WinAnsiEncoding');
1674 1674
                 }
1675 1675
                 $this->out('>>');
1676 1676
                 $this->out('endobj');
1677
-            } elseif ($type=='Type1' || $type=='TrueType') {
1677
+            } elseif ($type == 'Type1' || $type == 'TrueType') {
1678 1678
                 //Additional Type1 or TrueType font
1679 1679
                 $this->newObj();
1680 1680
                 $this->out('<</Type /Font');
1681
-                $this->out('/BaseFont /'.$name);
1682
-                $this->out('/Subtype /'.$type);
1681
+                $this->out('/BaseFont /' . $name);
1682
+                $this->out('/Subtype /' . $type);
1683 1683
                 $this->out('/FirstChar 32 /LastChar 255');
1684
-                $this->out('/Widths '.($this->n+1).' 0 R');
1685
-                $this->out('/FontDescriptor '.($this->n+2).' 0 R');
1684
+                $this->out('/Widths ' . ($this->n + 1) . ' 0 R');
1685
+                $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
1686 1686
                 if ($font['enc']) {
1687 1687
                     if (isset($font['diff'])) {
1688
-                        $this->out('/Encoding '.($nf+$font['diff']).' 0 R');
1688
+                        $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
1689 1689
                     } else {
1690 1690
                         $this->out('/Encoding /WinAnsiEncoding');
1691 1691
                     }
@@ -1694,30 +1694,30 @@  discard block
 block discarded – undo
1694 1694
                 $this->out('endobj');
1695 1695
                 //Widths
1696 1696
                 $this->newObj();
1697
-                $cw =& $font['cw'];
1697
+                $cw = & $font['cw'];
1698 1698
                 $s = '[';
1699
-                for ($i=32; $i<=255; $i++) {
1700
-                    $s .= $cw[chr($i)].' ';
1699
+                for ($i = 32; $i <= 255; $i++) {
1700
+                    $s .= $cw[chr($i)] . ' ';
1701 1701
                 }
1702
-                $this->out($s.']');
1702
+                $this->out($s . ']');
1703 1703
                 $this->out('endobj');
1704 1704
                 //Descriptor
1705 1705
                 $this->newObj();
1706
-                $s='<</Type /FontDescriptor /FontName /'.$name;
1706
+                $s = '<</Type /FontDescriptor /FontName /' . $name;
1707 1707
                 foreach ($font['desc'] as $k => $v) {
1708
-                    $s .= ' /'.$k.' '.$v;
1708
+                    $s .= ' /' . $k . ' ' . $v;
1709 1709
                 }
1710
-                $file=$font['file'];
1710
+                $file = $font['file'];
1711 1711
                 if ($file) {
1712
-                    $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R';
1712
+                    $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R';
1713 1713
                 }
1714
-                $this->out($s.'>>');
1714
+                $this->out($s . '>>');
1715 1715
                 $this->out('endobj');
1716 1716
             } else {
1717 1717
                 //Allow for additional types
1718
-                $mtd='_put'.strtolower($type);
1718
+                $mtd = '_put' . strtolower($type);
1719 1719
                 if (!method_exists($this, $mtd)) {
1720
-                    $this->error('Unsupported font type: '.$type);
1720
+                    $this->error('Unsupported font type: ' . $type);
1721 1721
                 }
1722 1722
                 $this->$mtd($font);
1723 1723
             }
@@ -1735,39 +1735,39 @@  discard block
 block discarded – undo
1735 1735
             $this->images[$file]['n'] = $this->n;
1736 1736
             $this->out('<</Type /XObject');
1737 1737
             $this->out('/Subtype /Image');
1738
-            $this->out('/Width '.$info['w']);
1739
-            $this->out('/Height '.$info['h']);
1740
-            if ($info['cs']=='Indexed') {
1741
-                $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
1738
+            $this->out('/Width ' . $info['w']);
1739
+            $this->out('/Height ' . $info['h']);
1740
+            if ($info['cs'] == 'Indexed') {
1741
+                $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
1742 1742
             } else {
1743
-                $this->out('/ColorSpace /'.$info['cs']);
1744
-                if ($info['cs']=='DeviceCMYK') {
1743
+                $this->out('/ColorSpace /' . $info['cs']);
1744
+                if ($info['cs'] == 'DeviceCMYK') {
1745 1745
                     $this->out('/Decode [1 0 1 0 1 0 1 0]');
1746 1746
                 }
1747 1747
             }
1748
-            $this->out('/BitsPerComponent '.$info['bpc']);
1748
+            $this->out('/BitsPerComponent ' . $info['bpc']);
1749 1749
             if (isset($info['f'])) {
1750
-                $this->out('/Filter /'.$info['f']);
1750
+                $this->out('/Filter /' . $info['f']);
1751 1751
             }
1752 1752
             if (isset($info['parms'])) {
1753 1753
                 $this->out($info['parms']);
1754 1754
             }
1755 1755
             if (isset($info['trns']) && is_array($info['trns'])) {
1756 1756
                 $trns = '';
1757
-                for ($i=0; $i<count($info['trns']); $i++) {
1758
-                    $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
1757
+                for ($i = 0; $i < count($info['trns']); $i++) {
1758
+                    $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
1759 1759
                 }
1760
-                $this->out('/Mask ['.$trns.']');
1760
+                $this->out('/Mask [' . $trns . ']');
1761 1761
             }
1762
-            $this->out('/Length '.strlen($info['data']).'>>');
1762
+            $this->out('/Length ' . strlen($info['data']) . '>>');
1763 1763
             $this->putStream($info['data']);
1764 1764
             unset($this->images[$file]['data']);
1765 1765
             $this->out('endobj');
1766 1766
             //Palette
1767 1767
             if ($info['cs'] == 'Indexed') {
1768 1768
                 $this->newObj();
1769
-                $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1770
-                $this->out('<<'.$filter.'/Length '.strlen($pal).'>>');
1769
+                $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1770
+                $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>');
1771 1771
                 $this->putStream($pal);
1772 1772
                 $this->out('endobj');
1773 1773
             }
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
     protected function putXobjectDict()
1778 1778
     {
1779 1779
         foreach ($this->images as $image) {
1780
-            $this->out('/I'.$image['i'].' '.$image['n'].' 0 R');
1780
+            $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
1781 1781
         }
1782 1782
     }
1783 1783
     
@@ -1786,7 +1786,7 @@  discard block
 block discarded – undo
1786 1786
         $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1787 1787
         $this->out('/Font <<');
1788 1788
         foreach ($this->fonts as $font) {
1789
-            $this->out('/F'.$font['i'].' '.$font['n'].' 0 R');
1789
+            $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
1790 1790
         }
1791 1791
         $this->out('>>');
1792 1792
         $this->out('/XObject <<');
@@ -1809,57 +1809,57 @@  discard block
 block discarded – undo
1809 1809
     
1810 1810
     protected function putInfo()
1811 1811
     {
1812
-        $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION));
1812
+        $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION));
1813 1813
         if (!empty($this->title)) {
1814
-            $this->out('/Title '.$this->textString($this->title));
1814
+            $this->out('/Title ' . $this->textString($this->title));
1815 1815
         }
1816 1816
         if (!empty($this->subject)) {
1817
-            $this->out('/Subject '.$this->textString($this->subject));
1817
+            $this->out('/Subject ' . $this->textString($this->subject));
1818 1818
         }
1819 1819
         if (!empty($this->author)) {
1820
-            $this->out('/Author '.$this->textString($this->author));
1820
+            $this->out('/Author ' . $this->textString($this->author));
1821 1821
         }
1822 1822
         if (!empty($this->keywords)) {
1823
-            $this->out('/Keywords '.$this->textString($this->keywords));
1823
+            $this->out('/Keywords ' . $this->textString($this->keywords));
1824 1824
         }
1825 1825
         if (!empty($this->creator)) {
1826
-            $this->out('/Creator '.$this->textString($this->creator));
1826
+            $this->out('/Creator ' . $this->textString($this->creator));
1827 1827
         }
1828
-        $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis')));
1828
+        $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis')));
1829 1829
     }
1830 1830
     
1831 1831
     protected function putCatalog()
1832 1832
     {
1833 1833
         $this->out('/Type /Catalog');
1834 1834
         $this->out('/Pages 1 0 R');
1835
-        if ($this->zoomMode=='fullpage') {
1835
+        if ($this->zoomMode == 'fullpage') {
1836 1836
             $this->out('/OpenAction [3 0 R /Fit]');
1837
-        } elseif ($this->zoomMode=='fullwidth') {
1837
+        } elseif ($this->zoomMode == 'fullwidth') {
1838 1838
             $this->out('/OpenAction [3 0 R /FitH null]');
1839
-        } elseif ($this->zoomMode=='real') {
1839
+        } elseif ($this->zoomMode == 'real') {
1840 1840
             $this->out('/OpenAction [3 0 R /XYZ null null 1]');
1841 1841
         } elseif (!is_string($this->zoomMode)) {
1842
-            $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']');
1842
+            $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']');
1843 1843
         }
1844
-        if ($this->layoutMode=='single') {
1844
+        if ($this->layoutMode == 'single') {
1845 1845
             $this->out('/PageLayout /SinglePage');
1846
-        } elseif ($this->layoutMode=='continuous') {
1846
+        } elseif ($this->layoutMode == 'continuous') {
1847 1847
             $this->out('/PageLayout /OneColumn');
1848
-        } elseif ($this->layoutMode=='two') {
1848
+        } elseif ($this->layoutMode == 'two') {
1849 1849
             $this->out('/PageLayout /TwoColumnLeft');
1850 1850
         }
1851 1851
     }
1852 1852
     
1853 1853
     protected function putHeader()
1854 1854
     {
1855
-        $this->out('%PDF-'.$this->pdfVersion);
1855
+        $this->out('%PDF-' . $this->pdfVersion);
1856 1856
     }
1857 1857
     
1858 1858
     protected function putTrailer()
1859 1859
     {
1860
-        $this->out('/Size '.($this->n+1));
1861
-        $this->out('/Root '.$this->n.' 0 R');
1862
-        $this->out('/Info '.($this->n-1).' 0 R');
1860
+        $this->out('/Size ' . ($this->n + 1));
1861
+        $this->out('/Root ' . $this->n . ' 0 R');
1862
+        $this->out('/Info ' . ($this->n - 1) . ' 0 R');
1863 1863
     }
1864 1864
     
1865 1865
     protected function endDoc()
@@ -1880,11 +1880,11 @@  discard block
 block discarded – undo
1880 1880
         $this->out('>>');
1881 1881
         $this->out('endobj');
1882 1882
         //Cross-ref
1883
-        $o=strlen($this->buffer);
1883
+        $o = strlen($this->buffer);
1884 1884
         $this->out('xref');
1885
-        $this->out('0 '.($this->n+1));
1885
+        $this->out('0 ' . ($this->n + 1));
1886 1886
         $this->out('0000000000 65535 f ');
1887
-        for ($i=1; $i<=$this->n; $i++) {
1887
+        for ($i = 1; $i <= $this->n; $i++) {
1888 1888
             $this->out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1889 1889
         }
1890 1890
         //Trailer
@@ -1895,6 +1895,6 @@  discard block
 block discarded – undo
1895 1895
         $this->out('startxref');
1896 1896
         $this->out($o);
1897 1897
         $this->out('%%EOF');
1898
-        $this->state=3;
1898
+        $this->state = 3;
1899 1899
     }
1900 1900
 }
Please login to merge, or discard this patch.