Passed
Pull Request — master (#114)
by Roberto
06:37
created
src/Legacy/Common.php 1 patch
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
      * @param  array   $aFont   Matriz com as informações para formatação do texto com fonte, tamanho e estilo
237 237
      * @param  string  $vAlign  Alinhamento vertical do texto, T-topo C-centro B-base
238 238
      * @param  string  $hAlign  Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita
239
-     * @param  boolean $border  TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
239
+     * @param  integer $border  TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
240 240
      * @param  string  $link    Insere um hiperlink
241 241
      * @param  boolean $force   Se for true força a caixa com uma unica linha e para isso atera o tamanho do
242 242
      * fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
243 243
      * e para isso atera o tamanho do fonte até caber no espaço,
244 244
      * se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
245
-     * @param  number  $hmax
246
-     * @param  number  $vOffSet incremento forçado na na posição Y
245
+     * @param  integer  $hmax
246
+     * @param  integer  $vOffSet incremento forçado na na posição Y
247 247
      * @return number $height Qual a altura necessária para desenhar esta textBox
248 248
      */
249 249
     protected function pTextBox(
@@ -363,20 +363,20 @@  discard block
 block discarded – undo
363 363
      * 'size'=>10,'style='B'),'C','L',FALSE,'http://www.nfephp.org')
364 364
      * @param  number $x Posição horizontal da caixa, canto esquerdo superior
365 365
      * @param  number $y Posição vertical da caixa, canto esquerdo superior
366
-     * @param  number $w Largura da caixa
367
-     * @param  number $h Altura da caixa
366
+     * @param  double $w Largura da caixa
367
+     * @param  integer $h Altura da caixa
368 368
      * @param  string $text Conteúdo da caixa
369 369
      * @param  array $aFont Matriz com as informações para formatação do texto com fonte, tamanho e estilo
370 370
      * @param  string $vAlign Alinhamento vertical do texto, T-topo C-centro B-base
371 371
      * @param  string $hAlign Alinhamento horizontal do texto, L-esquerda, C-centro, R-direita
372
-     * @param  boolean $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
372
+     * @param  integer $border TRUE ou 1 desenha a borda, FALSE ou 0 Sem borda
373 373
      * @param  string $link Insere um hiperlink
374 374
      * @param  boolean $force Se for true força a caixa com uma unica linha e para isso atera o tamanho do
375 375
      *  fonte até caber no espaço, se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
376 376
      *  linha e para isso atera o tamanho do fonte até caber no espaço,
377 377
      *  se falso mantem o tamanho do fonte e usa quantas linhas forem necessárias
378
-     * @param  number  $hmax
379
-     * @param  number  $vOffSet incremento forçado na na posição Y
378
+     * @param  integer  $hmax
379
+     * @param  integer  $vOffSet incremento forçado na na posição Y
380 380
      * @return number $height Qual a altura necessária para desenhar esta textBox
381 381
      */
382 382
     protected function pTextBox90(
Please login to merge, or discard this patch.
src/Legacy/FPDF/Fpdf.php 2 patches
Doc Comments   +59 added lines patch added patch discarded remove patch
@@ -169,6 +169,10 @@  discard block
 block discarded – undo
169 169
         //Set default PDF version number
170 170
         $this->pdfVersion='1.3';
171 171
     }
172
+
173
+    /**
174
+     * @param integer $right
175
+     */
172 176
     public function setMargins($left, $top, $right = null)
173 177
     {
174 178
         //Set left, top and right margins
@@ -197,6 +201,10 @@  discard block
 block discarded – undo
197 201
         //Set right margin
198 202
         $this->rMargin = $margin;
199 203
     }
204
+
205
+    /**
206
+     * @param boolean $auto
207
+     */
200 208
     public function setAutoPageBreak($auto, $margin = 0)
201 209
     {
202 210
         //Set auto page break mode and triggering margin
@@ -204,6 +212,10 @@  discard block
 block discarded – undo
204 212
         $this->bMargin = $margin;
205 213
         $this->pageBreakTrigger = $this->h-$margin;
206 214
     }
215
+
216
+    /**
217
+     * @param string $zoom
218
+     */
207 219
     public function setDisplayMode($zoom, $layout = 'continuous')
208 220
     {
209 221
         //Set display mode in viewer
@@ -218,6 +230,10 @@  discard block
 block discarded – undo
218 230
             $this->error('Incorrect layout display mode: '.$layout);
219 231
         }
220 232
     }
233
+
234
+    /**
235
+     * @param boolean $compress
236
+     */
221 237
     public function setCompression($compress)
222 238
     {
223 239
         //Set page compression
@@ -272,6 +288,10 @@  discard block
 block discarded – undo
272 288
         //Define an alias for total number of pages
273 289
         $this->aliasNbPages=$alias;
274 290
     }
291
+
292
+    /**
293
+     * @param string $msg
294
+     */
275 295
     public function error($msg)
276 296
     {
277 297
         throw Exception($msg);
@@ -381,6 +401,12 @@  discard block
 block discarded – undo
381 401
         //Get current page number
382 402
         return $this->page;
383 403
     }
404
+
405
+    /**
406
+     * @param integer $r
407
+     * @param integer $g
408
+     * @param integer $b
409
+     */
384 410
     public function setDrawColor($r, $g = null, $b = null)
385 411
     {
386 412
         //Set color for all stroking operations
@@ -393,6 +419,12 @@  discard block
 block discarded – undo
393 419
             $this->out($this->drawColor);
394 420
         }
395 421
     }
422
+
423
+    /**
424
+     * @param integer $r
425
+     * @param integer $g
426
+     * @param integer $b
427
+     */
396 428
     public function setFillColor($r, $g = null, $b = null)
397 429
     {
398 430
         //Set color for all filling operations
@@ -406,6 +438,12 @@  discard block
 block discarded – undo
406 438
             $this->out($this->fillColor);
407 439
         }
408 440
     }
441
+
442
+    /**
443
+     * @param integer $r
444
+     * @param integer $g
445
+     * @param integer $b
446
+     */
409 447
     public function settextColor($r, $g = null, $b = null)
410 448
     {
411 449
         //Set color for text
@@ -528,6 +566,10 @@  discard block
 block discarded – undo
528 566
             }
529 567
         }
530 568
     }
569
+
570
+    /**
571
+     * @param string $family
572
+     */
531 573
     public function setFont($family, $style = '', $size = 0)
532 574
     {
533 575
         //Select a font; size given in points
@@ -626,6 +668,10 @@  discard block
 block discarded – undo
626 668
         $this->links[$link] = array($page, $y);
627 669
     }
628 670
     
671
+    /**
672
+     * @param double $y
673
+     * @param string $link
674
+     */
629 675
     public function link($x, $y, $w, $h, $link)
630 676
     {
631 677
         //Put a link on the page
@@ -962,6 +1008,9 @@  discard block
 block discarded – undo
962 1008
         }
963 1009
     }
964 1010
     
1011
+    /**
1012
+     * @param string $file
1013
+     */
965 1014
     public function image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '')
966 1015
     {
967 1016
         //Put an image on the page
@@ -1167,6 +1216,9 @@  discard block
 block discarded – undo
1167 1216
     }
1168 1217
     
1169 1218
     
1219
+    /**
1220
+     * @param string $format
1221
+     */
1170 1222
     protected function getpageformat($format)
1171 1223
     {
1172 1224
         $format=strtolower($format);
@@ -1187,6 +1239,10 @@  discard block
 block discarded – undo
1187 1239
     }
1188 1240
     
1189 1241
     
1242
+    /**
1243
+     * @param string $orientation
1244
+     * @param string $format
1245
+     */
1190 1246
     protected function beginPage($orientation, $format)
1191 1247
     {
1192 1248
         $this->page++;
@@ -1332,6 +1388,9 @@  discard block
 block discarded – undo
1332 1388
     }
1333 1389
     
1334 1390
     
1391
+    /**
1392
+     * @param string $file
1393
+     */
1335 1394
     protected function parsePNG($file)
1336 1395
     {
1337 1396
         //Extract info from a PNG file
Please login to merge, or discard this 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
     public function setMargins($left, $top, $right = null)
173 173
     {
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
         if ($right === null) {
178 178
             $right = $left;
179 179
         }
180
-        $this->rMargin=$right;
180
+        $this->rMargin = $right;
181 181
     }
182 182
     public function setLeftMargin($margin)
183 183
     {
184 184
         //Set left margin
185 185
         $this->lMargin = $margin;
186
-        if ($this->page>0 && $this->x<$margin) {
186
+        if ($this->page > 0 && $this->x < $margin) {
187 187
             $this->x = $margin;
188 188
         }
189 189
     }
@@ -202,20 +202,20 @@  discard block
 block discarded – undo
202 202
         //Set auto page break mode and triggering margin
203 203
         $this->autoPageBreak = $auto;
204 204
         $this->bMargin = $margin;
205
-        $this->pageBreakTrigger = $this->h-$margin;
205
+        $this->pageBreakTrigger = $this->h - $margin;
206 206
     }
207 207
     public function setDisplayMode($zoom, $layout = 'continuous')
208 208
     {
209 209
         //Set display mode in viewer
210
-        if ($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) {
210
+        if ($zoom == 'fullpage' || $zoom == 'fullwidth' || $zoom == 'real' || $zoom == 'default' || !is_string($zoom)) {
211 211
             $this->zoomMode = $zoom;
212 212
         } else {
213
-            $this->error('Incorrect zoom display mode: '.$zoom);
213
+            $this->error('Incorrect zoom display mode: ' . $zoom);
214 214
         }
215
-        if ($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') {
215
+        if ($layout == 'single' || $layout == 'continuous' || $layout == 'two' || $layout == 'default') {
216 216
             $this->layoutMode = $layout;
217 217
         } else {
218
-            $this->error('Incorrect layout display mode: '.$layout);
218
+            $this->error('Incorrect layout display mode: ' . $layout);
219 219
         }
220 220
     }
221 221
     public function setCompression($compress)
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         if ($isUTF8) {
250 250
             $author = $this->utf8Toutf16($author);
251 251
         }
252
-        $this->author=$author;
252
+        $this->author = $author;
253 253
     }
254 254
     public function setKeywords($keywords, $isUTF8 = false)
255 255
     {
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     public function aliasNbPages($alias = '{nb}')
271 271
     {
272 272
         //Define an alias for total number of pages
273
-        $this->aliasNbPages=$alias;
273
+        $this->aliasNbPages = $alias;
274 274
     }
275 275
     public function error($msg)
276 276
     {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             $this->open();
307 307
         }
308 308
         $family = $this->fontFamily;
309
-        $style = $this->fontStyle.($this->underline ? 'U' : '');
309
+        $style = $this->fontStyle . ($this->underline ? 'U' : '');
310 310
         $size = $this->fontSizePt;
311 311
         $lw = $this->lineWidth;
312 312
         $dc = $this->drawColor;
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
         $this->out('2 J');
328 328
         //Set line width
329 329
         $this->lineWidth = $lw;
330
-        $this->out(sprintf('%.2F w', $lw*$this->k));
330
+        $this->out(sprintf('%.2F w', $lw * $this->k));
331 331
         //Set font
332 332
         if ($family) {
333 333
             $this->setFont($family, $style, $size);
334 334
         }
335 335
         //Set colors
336 336
         $this->drawColor = $dc;
337
-        if ($dc!='0 G') {
337
+        if ($dc != '0 G') {
338 338
             $this->out($dc);
339 339
         }
340 340
         $this->fillColor = $fc;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         //Restore line width
351 351
         if ($this->lineWidth != $lw) {
352 352
             $this->lineWidth = $lw;
353
-            $this->out(sprintf('%.2F w', $lw*$this->k));
353
+            $this->out(sprintf('%.2F w', $lw * $this->k));
354 354
         }
355 355
         //Restore font
356 356
         if ($family) {
@@ -384,10 +384,10 @@  discard block
 block discarded – undo
384 384
     public function setDrawColor($r, $g = null, $b = null)
385 385
     {
386 386
         //Set color for all stroking operations
387
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
388
-            $this->drawColor = sprintf('%.3F G', $r/255);
387
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
388
+            $this->drawColor = sprintf('%.3F G', $r / 255);
389 389
         } else {
390
-            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r/255, $g/255, $b/255);
390
+            $this->drawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
391 391
         }
392 392
         if ($this->page > 0) {
393 393
             $this->out($this->drawColor);
@@ -396,10 +396,10 @@  discard block
 block discarded – undo
396 396
     public function setFillColor($r, $g = null, $b = null)
397 397
     {
398 398
         //Set color for all filling operations
399
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
400
-            $this->fillColor = sprintf('%.3F g', $r/255);
399
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
400
+            $this->fillColor = sprintf('%.3F g', $r / 255);
401 401
         } else {
402
-            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
402
+            $this->fillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
403 403
         }
404 404
         $this->colorFlag = ($this->fillColor != $this->textColor);
405 405
         if ($this->page > 0) {
@@ -409,31 +409,31 @@  discard block
 block discarded – undo
409 409
     public function settextColor($r, $g = null, $b = null)
410 410
     {
411 411
         //Set color for text
412
-        if (($r==0 && $g==0 && $b==0) || $g===null) {
413
-            $this->textColor = sprintf('%.3F g', $r/255);
412
+        if (($r == 0 && $g == 0 && $b == 0) || $g === null) {
413
+            $this->textColor = sprintf('%.3F g', $r / 255);
414 414
         } else {
415
-            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r/255, $g/255, $b/255);
415
+            $this->textColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
416 416
         }
417 417
         $this->colorFlag = ($this->fillColor != $this->textColor);
418 418
     }
419 419
     public function getStringWidth($s)
420 420
     {
421 421
         //Get width of a string in the current font
422
-        $s = (string)$s;
423
-        $cw =& $this->currentFont['cw'];
422
+        $s = (string) $s;
423
+        $cw = & $this->currentFont['cw'];
424 424
         $w = 0;
425 425
         $l = strlen($s);
426
-        for ($i=0; $i<$l; $i++) {
426
+        for ($i = 0; $i < $l; $i++) {
427 427
             $w += $cw[$s[$i]];
428 428
         }
429
-        return $w*$this->fontSize/1000;
429
+        return $w * $this->fontSize / 1000;
430 430
     }
431 431
     public function setLineWidth($width)
432 432
     {
433 433
         //Set line width
434 434
         $this->lineWidth = $width;
435 435
         if ($this->page > 0) {
436
-            $this->out(sprintf('%.2F w', $width*$this->k));
436
+            $this->out(sprintf('%.2F w', $width * $this->k));
437 437
         }
438 438
     }
439 439
     public function line($x1, $y1, $x2, $y2)
@@ -442,10 +442,10 @@  discard block
 block discarded – undo
442 442
         $this->out(
443 443
             sprintf(
444 444
                 '%.2F %.2F m %.2F %.2F l S',
445
-                $x1*$this->k,
446
-                ($this->h-$y1)*$this->k,
447
-                $x2*$this->k,
448
-                ($this->h-$y2)*$this->k
445
+                $x1 * $this->k,
446
+                ($this->h - $y1) * $this->k,
447
+                $x2 * $this->k,
448
+                ($this->h - $y2) * $this->k
449 449
             )
450 450
         );
451 451
     }
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
         $this->out(
463 463
             sprintf(
464 464
                 '%.2F %.2F %.2F %.2F re %s',
465
-                $x*$this->k,
466
-                ($this->h-$y)*$this->k,
467
-                $w*$this->k,
468
-                -$h*$this->k,
465
+                $x * $this->k,
466
+                ($this->h - $y) * $this->k,
467
+                $w * $this->k,
468
+                -$h * $this->k,
469 469
                 $op
470 470
             )
471 471
         );
@@ -475,24 +475,24 @@  discard block
 block discarded – undo
475 475
         //Add a TrueType or Type1 font
476 476
         $family = strtolower($family);
477 477
         if ($file == '') {
478
-            $file = str_replace(' ', '', $family).strtolower($style).'.php';
478
+            $file = str_replace(' ', '', $family) . strtolower($style) . '.php';
479 479
         }
480
-        if ($family=='arial') {
481
-            $family='helvetica';
480
+        if ($family == 'arial') {
481
+            $family = 'helvetica';
482 482
         }
483 483
         $style = strtoupper($style);
484 484
         if ($style == 'IB') {
485 485
             $style = 'BI';
486 486
         }
487
-        $fontkey = $family.$style;
487
+        $fontkey = $family . $style;
488 488
         if (isset($this->fonts[$fontkey])) {
489 489
             return;
490 490
         }
491
-        include $this->getFontPath().$file;
491
+        include $this->getFontPath() . $file;
492 492
         if (!isset($name)) {
493 493
             $this->error('Could not include font definition file');
494 494
         }
495
-        $i = count($this->fonts)+1;
495
+        $i = count($this->fonts) + 1;
496 496
         $this->fonts[$fontkey] = [
497 497
             'i'=>$i,
498 498
             'type'=>$type,
@@ -508,20 +508,20 @@  discard block
 block discarded – undo
508 508
             //Search existing encodings
509 509
             $d = 0;
510 510
             $nb = count($this->diffs);
511
-            for ($i=1; $i<=$nb; $i++) {
511
+            for ($i = 1; $i <= $nb; $i++) {
512 512
                 if ($this->diffs[$i] == $diff) {
513 513
                     $d = $i;
514 514
                     break;
515 515
                 }
516 516
             }
517 517
             if ($d == 0) {
518
-                $d = $nb+1;
518
+                $d = $nb + 1;
519 519
                 $this->diffs[$d] = $diff;
520 520
             }
521 521
             $this->fonts[$fontkey]['diff'] = $d;
522 522
         }
523 523
         if ($file) {
524
-            if ($type=='TrueType') {
524
+            if ($type == 'TrueType') {
525 525
                 $this->fontFiles[$file] = array('length1'=>$originalsize);
526 526
             } else {
527 527
                 $this->fontFiles[$file] = array('length1'=>$size1, 'length2'=>$size2);
@@ -555,39 +555,39 @@  discard block
 block discarded – undo
555 555
             $size = $this->fontSizePt;
556 556
         }
557 557
         //Test if font is already selected
558
-        if ($this->fontFamily==$family && $this->fontStyle==$style && $this->fontSizePt==$size) {
558
+        if ($this->fontFamily == $family && $this->fontStyle == $style && $this->fontSizePt == $size) {
559 559
             return;
560 560
         }
561 561
         //Test if used for the first time
562
-        $fontkey = $family.$style;
562
+        $fontkey = $family . $style;
563 563
         if (!isset($this->fonts[$fontkey])) {
564 564
             //Check if one of the standard fonts
565 565
             if (isset($this->coreFonts[$fontkey])) {
566 566
                 if (!isset($fpdf_charwidths[$fontkey])) {
567 567
                     //Load metric file
568
-                    $file=$family;
569
-                    if ($family=='times' || $family=='helvetica') {
568
+                    $file = $family;
569
+                    if ($family == 'times' || $family == 'helvetica') {
570 570
                         $file .= strtolower($style);
571 571
                     }
572
-                    include $this->getFontPath().$file.'.php';
572
+                    include $this->getFontPath() . $file . '.php';
573 573
                     if (!isset($fpdf_charwidths[$fontkey])) {
574 574
                         $this->error('Could not include font metric file');
575 575
                     }
576 576
                 }
577
-                $i = count($this->fonts)+1;
577
+                $i = count($this->fonts) + 1;
578 578
                 $name = $this->coreFonts[$fontkey];
579 579
                 $cw = $fpdf_charwidths[$fontkey];
580 580
                 $this->fonts[$fontkey] = ['i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw];
581 581
             } else {
582
-                $this->error('Undefined font: '.$family.' '.$style);
582
+                $this->error('Undefined font: ' . $family . ' ' . $style);
583 583
             }
584 584
         }
585 585
         //Select it
586 586
         $this->fontFamily = $family;
587 587
         $this->fontStyle = $style;
588 588
         $this->fontSizePt = $size;
589
-        $this->fontSize = $size/$this->k;
590
-        $this->currentFont =& $this->fonts[$fontkey];
589
+        $this->fontSize = $size / $this->k;
590
+        $this->currentFont = & $this->fonts[$fontkey];
591 591
         if ($this->page > 0) {
592 592
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
593 593
         }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
             return;
601 601
         }
602 602
         $this->fontSizePt = $size;
603
-        $this->fontSize = $size/$this->k;
603
+        $this->fontSize = $size / $this->k;
604 604
         if ($this->page > 0) {
605 605
             $this->out(sprintf('BT /F%d %.2F Tf ET', $this->currentFont['i'], $this->fontSizePt));
606 606
         }
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
     public function addlink()
610 610
     {
611 611
         //Create a new internal link
612
-        $n = count($this->links)+1;
612
+        $n = count($this->links) + 1;
613 613
         $this->links[$n] = array(0, 0);
614 614
         return $n;
615 615
     }
@@ -630,10 +630,10 @@  discard block
 block discarded – undo
630 630
     {
631 631
         //Put a link on the page
632 632
         $this->PageLinks[$this->page][] = [
633
-            $x*$this->k,
634
-            $this->hPt-$y*$this->k,
635
-            $w*$this->k,
636
-            $h*$this->k,
633
+            $x * $this->k,
634
+            $this->hPt - $y * $this->k,
635
+            $w * $this->k,
636
+            $h * $this->k,
637 637
             $link
638 638
         ];
639 639
     }
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
     public function text($x, $y, $txt)
642 642
     {
643 643
         //Output a string
644
-        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x*$this->k, ($this->h-$y)*$this->k, $this->escape($txt));
645
-        if ($this->underline && $txt!='') {
646
-            $s .= ' '.$this->doUnderLine($x, $y, $txt);
644
+        $s = sprintf('BT %.2F %.2F Td (%s) Tj ET', $x * $this->k, ($this->h - $y) * $this->k, $this->escape($txt));
645
+        if ($this->underline && $txt != '') {
646
+            $s .= ' ' . $this->doUnderLine($x, $y, $txt);
647 647
         }
648 648
         if ($this->colorFlag) {
649
-            $s = 'q '.$this->textColor.' '.$s.' Q';
649
+            $s = 'q ' . $this->textColor . ' ' . $s . ' Q';
650 650
         }
651 651
         $this->out($s);
652 652
     }
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
     {
662 662
         //Output a cell
663 663
         $k = $this->k;
664
-        if ($this->y+$h > $this->PageBreakTrigger
664
+        if ($this->y + $h > $this->PageBreakTrigger
665 665
             && !$this->InHeader
666 666
             && !$this->InFooter
667 667
             && $this->acceptPageBreak()
@@ -677,77 +677,77 @@  discard block
 block discarded – undo
677 677
             $this->x = $x;
678 678
             if ($ws > 0) {
679 679
                 $this->ws = $ws;
680
-                $this->out(sprintf('%.3F Tw', $ws*$k));
680
+                $this->out(sprintf('%.3F Tw', $ws * $k));
681 681
             }
682 682
         }
683 683
         if ($w == 0) {
684
-            $w = $this->w-$this->rMargin-$this->x;
684
+            $w = $this->w - $this->rMargin - $this->x;
685 685
         }
686
-        $s='';
687
-        if ($fill || $border==1) {
686
+        $s = '';
687
+        if ($fill || $border == 1) {
688 688
             if ($fill) {
689
-                $op=($border==1) ? 'B' : 'f';
689
+                $op = ($border == 1) ? 'B' : 'f';
690 690
             } else {
691
-                $op='S';
691
+                $op = 'S';
692 692
             }
693
-            $s=sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x*$k, ($this->h-$this->y)*$k, $w*$k, -$h*$k, $op);
693
+            $s = sprintf('%.2F %.2F %.2F %.2F re %s ', $this->x * $k, ($this->h - $this->y) * $k, $w * $k, -$h * $k, $op);
694 694
         }
695 695
         if (is_string($border)) {
696 696
             $x = $this->x;
697 697
             $y = $this->y;
698 698
             if (strpos($border, 'L') !== false) {
699
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, $x*$k, ($this->h-($y+$h))*$k);
699
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, $x * $k, ($this->h - ($y + $h)) * $k);
700 700
             }
701 701
             if (strpos($border, 'T') !== false) {
702
-                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x*$k, ($this->h-$y)*$k, ($x+$w)*$k, ($this->h-$y)*$k);
702
+                $s .= sprintf('%.2F %.2F m %.2F %.2F l S ', $x * $k, ($this->h - $y) * $k, ($x + $w) * $k, ($this->h - $y) * $k);
703 703
             }
704 704
             if (strpos($border, 'R') !== false) {
705 705
                 $s .= sprintf(
706 706
                     '%.2F %.2F m %.2F %.2F l S ',
707
-                    ($x+$w)*$k,
708
-                    ($this->h-$y)*$k,
709
-                    ($x+$w)*$k,
710
-                    ($this->h-($y+$h))*$k
707
+                    ($x + $w) * $k,
708
+                    ($this->h - $y) * $k,
709
+                    ($x + $w) * $k,
710
+                    ($this->h - ($y + $h)) * $k
711 711
                 );
712 712
             }
713 713
             if (strpos($border, 'B') !== false) {
714 714
                 $s .= sprintf(
715 715
                     '%.2F %.2F m %.2F %.2F l S ',
716
-                    $x*$k,
717
-                    ($this->h-($y+$h))*$k,
718
-                    ($x+$w)*$k,
719
-                    ($this->h-($y+$h))*$k
716
+                    $x * $k,
717
+                    ($this->h - ($y + $h)) * $k,
718
+                    ($x + $w) * $k,
719
+                    ($this->h - ($y + $h)) * $k
720 720
                 );
721 721
             }
722 722
         }
723 723
         if ($txt !== '') {
724 724
             if ($align == 'R') {
725
-                $dx = $w-$this->cMargin-$this->getStringWidth($txt);
725
+                $dx = $w - $this->cMargin - $this->getStringWidth($txt);
726 726
             } elseif ($align == 'C') {
727
-                $dx = ($w-$this->getStringWidth($txt))/2;
727
+                $dx = ($w - $this->getStringWidth($txt)) / 2;
728 728
             } else {
729 729
                 $dx = $this->cMargin;
730 730
             }
731 731
             if ($this->colorFlag) {
732
-                $s .= 'q '.$this->textColor.' ';
732
+                $s .= 'q ' . $this->textColor . ' ';
733 733
             }
734 734
             $txt2 = str_replace(')', '\\)', str_replace('(', '\\(', str_replace('\\', '\\\\', $txt)));
735 735
             $s .= sprintf(
736 736
                 'BT %.2F %.2F Td (%s) Tj ET',
737
-                ($this->x+$dx)*$k,
738
-                ($this->h-($this->y+.5*$h+.3*$this->fontSize))*$k,
737
+                ($this->x + $dx) * $k,
738
+                ($this->h - ($this->y + .5 * $h + .3 * $this->fontSize)) * $k,
739 739
                 $txt2
740 740
             );
741 741
             if ($this->underline) {
742
-                $s .= ' '.$this->doUnderLine($this->x+$dx, $this->y+.5*$h+.3*$this->fontSize, $txt);
742
+                $s .= ' ' . $this->doUnderLine($this->x + $dx, $this->y + .5 * $h + .3 * $this->fontSize, $txt);
743 743
             }
744 744
             if ($this->colorFlag) {
745
-                $s.=' Q';
745
+                $s .= ' Q';
746 746
             }
747 747
             if ($link) {
748 748
                 $this->link(
749
-                    $this->x+$dx,
750
-                    $this->y+.5*$h-.5*$this->fontSize,
749
+                    $this->x + $dx,
750
+                    $this->y + .5 * $h - .5 * $this->fontSize,
751 751
                     $this->getStringWidth($txt),
752 752
                     $this->fontSize,
753 753
                     $link
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
     public function multicell($w, $h, $txt, $border = 0, $align = 'J', $fill = false)
773 773
     {
774 774
         //Output text with automatic or explicit line breaks
775
-        $cw =& $this->currentFont['cw'];
775
+        $cw = & $this->currentFont['cw'];
776 776
         if ($w == 0) {
777
-            $w = $this->w-$this->rMargin-$this->x;
777
+            $w = $this->w - $this->rMargin - $this->x;
778 778
         }
779
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
779
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
780 780
         $s = str_replace("\r", '', $txt);
781 781
         $nb = strlen($s);
782
-        if ($nb>0 && $s[$nb-1] == "\n") {
782
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
783 783
             $nb--;
784 784
         }
785 785
         $b = 0;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
                 if (strpos($border, 'R') !== false) {
797 797
                     $b2 .= 'R';
798 798
                 }
799
-                $b=(strpos($border, 'T') !== false) ? $b2.'T' : $b2;
799
+                $b = (strpos($border, 'T') !== false) ? $b2 . 'T' : $b2;
800 800
             }
801 801
         }
802 802
         $sep = -1;
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         $l = 0;
806 806
         $ns = 0;
807 807
         $nl = 1;
808
-        while ($i<$nb) {
808
+        while ($i < $nb) {
809 809
             //Get next character
810 810
             $c = $s[$i];
811 811
             if ($c == "\n") {
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
                     $this->ws = 0;
815 815
                     $this->out('0 Tw');
816 816
                 }
817
-                $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
817
+                $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
818 818
                 $i++;
819 819
                 $sep = -1;
820 820
                 $j = $i;
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
                 $ns = 0;
823 823
                 $nl++;
824 824
                 if ($border && $nl == 2) {
825
-                    $b=$b2;
825
+                    $b = $b2;
826 826
                 }
827 827
                 continue;
828 828
             }
@@ -842,14 +842,14 @@  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
                 } else {
847
-                    if ($align=='J') {
848
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->fontSize/($ns-1) : 0;
849
-                        $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
847
+                    if ($align == 'J') {
848
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->fontSize / ($ns - 1) : 0;
849
+                        $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
850 850
                     }
851
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
852
-                    $i = $sep+1;
851
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
852
+                    $i = $sep + 1;
853 853
                 }
854 854
                 $sep = -1;
855 855
                 $j = $i;
@@ -868,10 +868,10 @@  discard block
 block discarded – undo
868 868
             $this->ws = 0;
869 869
             $this->out('0 Tw');
870 870
         }
871
-        if ($border && strpos($border, 'B')!==false) {
871
+        if ($border && strpos($border, 'B') !== false) {
872 872
             $b .= 'B';
873 873
         }
874
-        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
874
+        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
875 875
         $this->x = $this->lMargin;
876 876
     }
877 877
     
@@ -879,9 +879,9 @@  discard block
 block discarded – undo
879 879
     public function write($h, $txt, $link = '')
880 880
     {
881 881
         //Output text in flowing mode
882
-        $cw =& $this->currentFont['cw'];
883
-        $w = $this->w-$this->rMargin-$this->x;
884
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
882
+        $cw = & $this->currentFont['cw'];
883
+        $w = $this->w - $this->rMargin - $this->x;
884
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
885 885
         $s = str_replace("\r", '', $txt);
886 886
         $nb = strlen($s);
887 887
         $sep = -1;
@@ -891,18 +891,18 @@  discard block
 block discarded – undo
891 891
         $nl = 1;
892 892
         while ($i < $nb) {
893 893
             //Get next character
894
-            $c=$s[$i];
895
-            if ($c=="\n") {
894
+            $c = $s[$i];
895
+            if ($c == "\n") {
896 896
                 //Explicit line break
897
-                $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
897
+                $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
898 898
                 $i++;
899 899
                 $sep = -1;
900 900
                 $j = $i;
901 901
                 $l = 0;
902 902
                 if ($nl == 1) {
903 903
                     $this->x = $this->lMargin;
904
-                    $w = $this->w-$this->rMargin-$this->x;
905
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
904
+                    $w = $this->w - $this->rMargin - $this->x;
905
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
906 906
                 }
907 907
                 $nl++;
908 908
                 continue;
@@ -918,8 +918,8 @@  discard block
 block discarded – undo
918 918
                         //Move to next line
919 919
                         $this->x = $this->lMargin;
920 920
                         $this->y += $h;
921
-                        $w = $this->w-$this->rMargin-$this->x;
922
-                        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
921
+                        $w = $this->w - $this->rMargin - $this->x;
922
+                        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
923 923
                         $i++;
924 924
                         $nl++;
925 925
                         continue;
@@ -927,18 +927,18 @@  discard block
 block discarded – undo
927 927
                     if ($i == $j) {
928 928
                         $i++;
929 929
                     }
930
-                    $this->cell($w, $h, substr($s, $j, $i-$j), 0, 2, '', 0, $link);
930
+                    $this->cell($w, $h, substr($s, $j, $i - $j), 0, 2, '', 0, $link);
931 931
                 } else {
932
-                    $this->cell($w, $h, substr($s, $j, $sep-$j), 0, 2, '', 0, $link);
933
-                    $i = $sep+1;
932
+                    $this->cell($w, $h, substr($s, $j, $sep - $j), 0, 2, '', 0, $link);
933
+                    $i = $sep + 1;
934 934
                 }
935 935
                 $sep = -1;
936 936
                 $j = $i;
937 937
                 $l = 0;
938 938
                 if ($nl == 1) {
939 939
                     $this->x = $this->lMargin;
940
-                    $w = $this->w-$this->rMargin-$this->x;
941
-                    $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
940
+                    $w = $this->w - $this->rMargin - $this->x;
941
+                    $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
942 942
                 }
943 943
                 $nl++;
944 944
             } else {
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
         }
948 948
         //Last chunk
949 949
         if ($i != $j) {
950
-            $this->cell($l/1000*$this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
950
+            $this->cell($l / 1000 * $this->fontSize, $h, substr($s, $j), 0, 0, '', 0, $link);
951 951
         }
952 952
     }
953 953
     
@@ -970,20 +970,20 @@  discard block
 block discarded – undo
970 970
             if ($type == '') {
971 971
                 $pos = strrpos($file, '.');
972 972
                 if (!$pos) {
973
-                    $this->error('Image file has no extension and no type was specified: '.$file);
973
+                    $this->error('Image file has no extension and no type was specified: ' . $file);
974 974
                 }
975
-                $type = substr($file, $pos+1);
975
+                $type = substr($file, $pos + 1);
976 976
             }
977 977
             $type = strtolower($type);
978 978
             if ($type == 'jpeg') {
979 979
                 $type = 'jpg';
980 980
             }
981
-            $mtd = 'parse'.strtoupper($type);
981
+            $mtd = 'parse' . strtoupper($type);
982 982
             if (!method_exists($this, $mtd)) {
983
-                $this->error('Unsupported image type: '.$type);
983
+                $this->error('Unsupported image type: ' . $type);
984 984
             }
985 985
             $info = $this->$mtd($file);
986
-            $info['i'] = count($this->images)+1;
986
+            $info['i'] = count($this->images) + 1;
987 987
             $this->images[$file] = $info;
988 988
         } else {
989 989
             $info = $this->images[$file];
@@ -991,16 +991,16 @@  discard block
 block discarded – undo
991 991
         //Automatic width and height calculation if needed
992 992
         if ($w == 0 && $h == 0) {
993 993
             //Put image at 72 dpi
994
-            $w = $info['w']/$this->k;
995
-            $h = $info['h']/$this->k;
994
+            $w = $info['w'] / $this->k;
995
+            $h = $info['h'] / $this->k;
996 996
         } elseif ($w == 0) {
997
-            $w = $h*$info['w']/$info['h'];
997
+            $w = $h * $info['w'] / $info['h'];
998 998
         } elseif ($h == 0) {
999
-            $h = $w*$info['h']/$info['w'];
999
+            $h = $w * $info['h'] / $info['w'];
1000 1000
         }
1001 1001
         //Flowing mode
1002 1002
         if ($y === null) {
1003
-            if ($this->y+$h > $this->pageBreakTrigger
1003
+            if ($this->y + $h > $this->pageBreakTrigger
1004 1004
                 && !$this->inHeader
1005 1005
                 && !$this->inFooter
1006 1006
                 && $this->acceptPageBreak()
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
         $this->out(
1020 1020
             sprintf(
1021 1021
                 'q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',
1022
-                $w*$this->k,
1023
-                $h*$this->k,
1024
-                $x*$this->k,
1025
-                ($this->h-($y+$h))*$this->k,
1022
+                $w * $this->k,
1023
+                $h * $this->k,
1024
+                $x * $this->k,
1025
+                ($this->h - ($y + $h)) * $this->k,
1026 1026
                 $info['i']
1027 1027
             )
1028 1028
         );
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
         if ($x >= 0) {
1046 1046
             $this->x = $x;
1047 1047
         } else {
1048
-            $this->x = $this->w+$x;
1048
+            $this->x = $this->w + $x;
1049 1049
         }
1050 1050
     }
1051 1051
     
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
         if ($y >= 0) {
1065 1065
             $this->y = $y;
1066 1066
         } else {
1067
-            $this->y = $this->h+$y;
1067
+            $this->y = $this->h + $y;
1068 1068
         }
1069 1069
     }
1070 1070
     
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
                     if (headers_sent()) {
1112 1112
                         $this->error('Some data has already been output, can\'t send PDF file');
1113 1113
                     }
1114
-                    header('Content-Length: '.strlen($this->buffer));
1115
-                    header('Content-Disposition: inline; filename="'.$name.'"');
1114
+                    header('Content-Length: ' . strlen($this->buffer));
1115
+                    header('Content-Disposition: inline; filename="' . $name . '"');
1116 1116
                     header('Cache-Control: private, max-age=0, must-revalidate');
1117 1117
                     header('Pragma: public');
1118 1118
                     ini_set('zlib.output_compression', '0');
@@ -1128,8 +1128,8 @@  discard block
 block discarded – undo
1128 1128
                 if (headers_sent()) {
1129 1129
                     $this->error('Some data has already been output, can\'t send PDF file');
1130 1130
                 }
1131
-                header('Content-Length: '.strlen($this->buffer));
1132
-                header('Content-Disposition: attachment; filename="'.$name.'"');
1131
+                header('Content-Length: ' . strlen($this->buffer));
1132
+                header('Content-Disposition: attachment; filename="' . $name . '"');
1133 1133
                 header('Cache-Control: private, max-age=0, must-revalidate');
1134 1134
                 header('Pragma: public');
1135 1135
                 ini_set('zlib.output_compression', '0');
@@ -1137,9 +1137,9 @@  discard block
 block discarded – undo
1137 1137
                 break;
1138 1138
             case 'F':
1139 1139
                 //Save to local file
1140
-                $f=fopen($name, 'wb');
1140
+                $f = fopen($name, 'wb');
1141 1141
                 if (!$f) {
1142
-                    $this->error('Unable to create output file: '.$name);
1142
+                    $this->error('Unable to create output file: ' . $name);
1143 1143
                 }
1144 1144
                 fwrite($f, $this->buffer, strlen($this->buffer));
1145 1145
                 fclose($f);
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
                 //Return as a string
1149 1149
                 return $this->buffer;
1150 1150
             default:
1151
-                $this->error('Incorrect output destination: '.$dest);
1151
+                $this->error('Incorrect output destination: ' . $dest);
1152 1152
         }
1153 1153
         return '';
1154 1154
     }
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
     protected function dochecks()
1158 1158
     {
1159 1159
         //Check availability of %F
1160
-        if (sprintf('%.1F', 1.0)!='1.0') {
1160
+        if (sprintf('%.1F', 1.0) != '1.0') {
1161 1161
             $this->error('This version of PHP is not supported');
1162 1162
         }
1163 1163
         //Check mbstring overloading
@@ -1169,19 +1169,19 @@  discard block
 block discarded – undo
1169 1169
     
1170 1170
     protected function getpageformat($format)
1171 1171
     {
1172
-        $format=strtolower($format);
1172
+        $format = strtolower($format);
1173 1173
         if (!isset($this->pageFormats[$format])) {
1174
-            $this->error('Unknown page format: '.$format);
1174
+            $this->error('Unknown page format: ' . $format);
1175 1175
         }
1176
-        $a=$this->pageFormats[$format];
1177
-        return array($a[0]/$this->k, $a[1]/$this->k);
1176
+        $a = $this->pageFormats[$format];
1177
+        return array($a[0] / $this->k, $a[1] / $this->k);
1178 1178
     }
1179 1179
     
1180 1180
     
1181 1181
     protected function getFontPath()
1182 1182
     {
1183
-        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) {
1184
-            define('FPDF_FONTPATH', dirname(__FILE__).'/font/');
1183
+        if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font')) {
1184
+            define('FPDF_FONTPATH', dirname(__FILE__) . '/font/');
1185 1185
         }
1186 1186
         return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
1187 1187
     }
@@ -1205,12 +1205,12 @@  discard block
 block discarded – undo
1205 1205
             $format = $this->defPageFormat;
1206 1206
         } else {
1207 1207
             if (is_string($format)) {
1208
-                $format=$this->getpageformat($format);
1208
+                $format = $this->getpageformat($format);
1209 1209
             }
1210 1210
         }
1211 1211
         if ($orientation != $this->curOrientation
1212
-            || $format[0]!=$this->curPageFormat[0]
1213
-            || $format[1]!=$this->curPageFormat[1]
1212
+            || $format[0] != $this->curPageFormat[0]
1213
+            || $format[1] != $this->curPageFormat[1]
1214 1214
         ) {
1215 1215
             //New size
1216 1216
             if ($orientation == 'P') {
@@ -1220,9 +1220,9 @@  discard block
 block discarded – undo
1220 1220
                 $this->w = $format[1];
1221 1221
                 $this->h = $format[0];
1222 1222
             }
1223
-            $this->wPt = $this->w*$this->k;
1224
-            $this->hPt = $this->h*$this->k;
1225
-            $this->pageBreakTrigger = $this->h-$this->bMargin;
1223
+            $this->wPt = $this->w * $this->k;
1224
+            $this->hPt = $this->h * $this->k;
1225
+            $this->pageBreakTrigger = $this->h - $this->bMargin;
1226 1226
             $this->curOrientation = $orientation;
1227 1227
             $this->curPageFormat = $format;
1228 1228
         }
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
     protected function textString($s)
1256 1256
     {
1257 1257
         //Format a text string
1258
-        return '('.$this->escape($s).')';
1258
+        return '(' . $this->escape($s) . ')';
1259 1259
     }
1260 1260
     
1261 1261
     
@@ -1271,16 +1271,16 @@  discard block
 block discarded – undo
1271 1271
                 //3-byte character
1272 1272
                 $c2 = ord($s[$i++]);
1273 1273
                 $c3 = ord($s[$i++]);
1274
-                $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
1275
-                $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
1274
+                $res .= chr((($c1 & 0x0F) << 4) + (($c2 & 0x3C) >> 2));
1275
+                $res .= chr((($c2 & 0x03) << 6) + ($c3 & 0x3F));
1276 1276
             } elseif ($c1 >= 192) {
1277 1277
                 //2-byte character
1278 1278
                 $c2 = ord($s[$i++]);
1279
-                $res .= chr(($c1 & 0x1C)>>2);
1280
-                $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
1279
+                $res .= chr(($c1 & 0x1C) >> 2);
1280
+                $res .= chr((($c1 & 0x03) << 6) + ($c2 & 0x3F));
1281 1281
             } else {
1282 1282
                 //Single-byte character
1283
-                $res .= "\0".chr($c1);
1283
+                $res .= "\0" . chr($c1);
1284 1284
             }
1285 1285
         }
1286 1286
         return $res;
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
         //Underline text
1293 1293
         $up = $this->currentFont['up'];
1294 1294
         $ut = $this->currentFont['ut'];
1295
-        $w = $this->getStringWidth($txt)+$this->ws*substr_count($txt, ' ');
1295
+        $w = $this->getStringWidth($txt) + $this->ws * substr_count($txt, ' ');
1296 1296
         return sprintf(
1297 1297
             '%.2F %.2F %.2F %.2F re f',
1298
-            $x*$this->k,
1299
-            ($this->h-($y-$up/1000*$this->fontSize))*$this->k,
1300
-            $w*$this->k,
1301
-            -$ut/1000*$this->fontSizePt
1298
+            $x * $this->k,
1299
+            ($this->h - ($y - $up / 1000 * $this->fontSize)) * $this->k,
1300
+            $w * $this->k,
1301
+            -$ut / 1000 * $this->fontSizePt
1302 1302
         );
1303 1303
     }
1304 1304
     
@@ -1308,17 +1308,17 @@  discard block
 block discarded – undo
1308 1308
         //Extract info from a JPEG file
1309 1309
         $a = getImageSize($file);
1310 1310
         if (!$a) {
1311
-            $this->error('Missing or incorrect image file: '.$file);
1311
+            $this->error('Missing or incorrect image file: ' . $file);
1312 1312
         }
1313
-        if ($a[2]!=2) {
1314
-            $this->error('Not a JPEG file: '.$file);
1313
+        if ($a[2] != 2) {
1314
+            $this->error('Not a JPEG file: ' . $file);
1315 1315
         }
1316 1316
         if (!isset($a['channels']) || $a['channels'] == 3) {
1317 1317
             $colspace = 'DeviceRGB';
1318 1318
         } elseif ($a['channels'] == 4) {
1319 1319
             $colspace = 'DeviceCMYK';
1320 1320
         } else {
1321
-            $colspace='DeviceGray';
1321
+            $colspace = 'DeviceGray';
1322 1322
         }
1323 1323
         $bpc = isset($a['bits']) ? $a['bits'] : 8;
1324 1324
         //Read whole file
@@ -1337,22 +1337,22 @@  discard block
 block discarded – undo
1337 1337
         //Extract info from a PNG file
1338 1338
         $f = fopen($file, 'rb');
1339 1339
         if (!$f) {
1340
-            $this->error('Can\'t open image file: '.$file);
1340
+            $this->error('Can\'t open image file: ' . $file);
1341 1341
         }
1342 1342
         //Check signature
1343
-        if ($this->readstream($f, 8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) {
1344
-            $this->error('Not a PNG file: '.$file);
1343
+        if ($this->readstream($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
1344
+            $this->error('Not a PNG file: ' . $file);
1345 1345
         }
1346 1346
         //Read header chunk
1347 1347
         $this->readstream($f, 4);
1348
-        if ($this->readstream($f, 4)!='IHDR') {
1349
-            $this->error('Incorrect PNG file: '.$file);
1348
+        if ($this->readstream($f, 4) != 'IHDR') {
1349
+            $this->error('Incorrect PNG file: ' . $file);
1350 1350
         }
1351 1351
         $w = $this->readint($f);
1352 1352
         $h = $this->readint($f);
1353 1353
         $bpc = ord($this->readstream($f, 1));
1354
-        if ($bpc>8) {
1355
-            $this->error('16-bit depth not supported: '.$file);
1354
+        if ($bpc > 8) {
1355
+            $this->error('16-bit depth not supported: ' . $file);
1356 1356
         }
1357 1357
         $ct = ord($this->readstream($f, 1));
1358 1358
         if ($ct == 0) {
@@ -1362,20 +1362,20 @@  discard block
 block discarded – undo
1362 1362
         } elseif ($ct == 3) {
1363 1363
             $colspace = 'Indexed';
1364 1364
         } else {
1365
-            $this->error('Alpha channel not supported: '.$file);
1365
+            $this->error('Alpha channel not supported: ' . $file);
1366 1366
         }
1367 1367
         if (ord($this->readstream($f, 1)) != 0) {
1368
-            $this->error('Unknown compression method: '.$file);
1368
+            $this->error('Unknown compression method: ' . $file);
1369 1369
         }
1370 1370
         if (ord($this->readstream($f, 1)) != 0) {
1371
-            $this->error('Unknown filter method: '.$file);
1371
+            $this->error('Unknown filter method: ' . $file);
1372 1372
         }
1373 1373
         if (ord($this->readstream($f, 1)) != 0) {
1374
-            $this->error('Interlacing not supported: '.$file);
1374
+            $this->error('Interlacing not supported: ' . $file);
1375 1375
         }
1376 1376
         $this->readstream($f, 4);
1377 1377
         $parms = '/DecodeParms <</Predictor 15 /Colors '
1378
-            . ($ct==2 ? 3 : 1)
1378
+            . ($ct == 2 ? 3 : 1)
1379 1379
             . ' /BitsPerComponent '
1380 1380
             . $bpc
1381 1381
             . ' /Columns '
@@ -1413,11 +1413,11 @@  discard block
 block discarded – undo
1413 1413
             } elseif ($type == 'IEND') {
1414 1414
                 break;
1415 1415
             } else {
1416
-                $this->readstream($f, $n+4);
1416
+                $this->readstream($f, $n + 4);
1417 1417
             }
1418 1418
         } while ($n);
1419 1419
         if ($colspace == 'Indexed' && empty($pal)) {
1420
-            $this->error('Missing palette in '.$file);
1420
+            $this->error('Missing palette in ' . $file);
1421 1421
         }
1422 1422
         fclose($f);
1423 1423
         return [
@@ -1437,9 +1437,9 @@  discard block
 block discarded – undo
1437 1437
     protected function readstream($f, $n)
1438 1438
     {
1439 1439
         //Read n bytes from stream
1440
-        $res='';
1440
+        $res = '';
1441 1441
         while ($n > 0 && !feof($f)) {
1442
-            $s=fread($f, $n);
1442
+            $s = fread($f, $n);
1443 1443
             if ($s === false) {
1444 1444
                 $this->error('Error while reading stream');
1445 1445
             }
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
         }
1473 1473
         $im = imagecreatefromgif($file);
1474 1474
         if (!$im) {
1475
-            $this->error('Missing or incorrect image file: '.$file);
1475
+            $this->error('Missing or incorrect image file: ' . $file);
1476 1476
         }
1477 1477
         imageinterlace($im, 0);
1478 1478
         $tmp = tempnam('.', 'gif');
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
             $this->error('Error while saving to temporary file');
1484 1484
         }
1485 1485
         imagedestroy($im);
1486
-        $info=$this->parsePNG($tmp);
1486
+        $info = $this->parsePNG($tmp);
1487 1487
         unlink($tmp);
1488 1488
         return $info;
1489 1489
     }
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
         //Begin a new object
1495 1495
         $this->n++;
1496 1496
         $this->offsets[$this->n] = strlen($this->buffer);
1497
-        $this->out($this->n.' 0 obj');
1497
+        $this->out($this->n . ' 0 obj');
1498 1498
     }
1499 1499
     
1500 1500
     
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
     {
1511 1511
         //Add a line to the document
1512 1512
         if ($this->state == 2) {
1513
-            $this->pages[$this->page].=$s."\n";
1513
+            $this->pages[$this->page] .= $s . "\n";
1514 1514
         } else {
1515
-            $this->buffer .= $s."\n";
1515
+            $this->buffer .= $s . "\n";
1516 1516
         }
1517 1517
     }
1518 1518
     
@@ -1522,19 +1522,19 @@  discard block
 block discarded – undo
1522 1522
         $nb = $this->page;
1523 1523
         if (!empty($this->aliasNbPages)) {
1524 1524
             //Replace number of pages
1525
-            for ($n=1; $n<=$nb; $n++) {
1525
+            for ($n = 1; $n <= $nb; $n++) {
1526 1526
                 $this->pages[$n] = str_replace($this->aliasNbPages, $nb, $this->pages[$n]);
1527 1527
             }
1528 1528
         }
1529 1529
         if ($this->defOrientation == 'P') {
1530
-            $wPt = $this->defPageFormat[0]*$this->k;
1531
-            $hPt = $this->defPageFormat[1]*$this->k;
1530
+            $wPt = $this->defPageFormat[0] * $this->k;
1531
+            $hPt = $this->defPageFormat[1] * $this->k;
1532 1532
         } else {
1533
-            $wPt = $this->defPageFormat[1]*$this->k;
1534
-            $hPt = $this->defPageFormat[0]*$this->k;
1533
+            $wPt = $this->defPageFormat[1] * $this->k;
1534
+            $hPt = $this->defPageFormat[0] * $this->k;
1535 1535
         }
1536 1536
         $filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
1537
-        for ($n=1; $n<=$nb; $n++) {
1537
+        for ($n = 1; $n <= $nb; $n++) {
1538 1538
             //Page
1539 1539
             $this->newObj();
1540 1540
             $this->out('<</Type /Page');
@@ -1547,37 +1547,37 @@  discard block
 block discarded – undo
1547 1547
                 //Links
1548 1548
                 $annots = '/Annots [';
1549 1549
                 foreach ($this->PageLinks[$n] as $pl) {
1550
-                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0]+$pl[2], $pl[1]-$pl[3]);
1551
-                    $annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
1550
+                    $rect = sprintf('%.2F %.2F %.2F %.2F', $pl[0], $pl[1], $pl[0] + $pl[2], $pl[1] - $pl[3]);
1551
+                    $annots .= '<</Type /Annot /Subtype /Link /Rect [' . $rect . '] /Border [0 0 0] ';
1552 1552
                     if (is_string($pl[4])) {
1553
-                        $annots .= '/A <</S /URI /URI '.$this->textString($pl[4]).'>>>>';
1553
+                        $annots .= '/A <</S /URI /URI ' . $this->textString($pl[4]) . '>>>>';
1554 1554
                     } else {
1555 1555
                         $l = $this->links[$pl[4]];
1556 1556
                         $h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
1557
-                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1+2*$l[0], $h-$l[1]*$this->k);
1557
+                        $annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>', 1 + 2 * $l[0], $h - $l[1] * $this->k);
1558 1558
                     }
1559 1559
                 }
1560
-                $this->out($annots.']');
1560
+                $this->out($annots . ']');
1561 1561
             }
1562
-            $this->out('/Contents '.($this->n+1).' 0 R>>');
1562
+            $this->out('/Contents ' . ($this->n + 1) . ' 0 R>>');
1563 1563
             $this->out('endobj');
1564 1564
             //Page content
1565
-            $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1565
+            $p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
1566 1566
             $this->newObj();
1567
-            $this->out('<<'.$filter.'/Length '.strlen($p).'>>');
1567
+            $this->out('<<' . $filter . '/Length ' . strlen($p) . '>>');
1568 1568
             $this->putStream($p);
1569 1569
             $this->out('endobj');
1570 1570
         }
1571 1571
         //Pages root
1572
-        $this->offsets[1]=strlen($this->buffer);
1572
+        $this->offsets[1] = strlen($this->buffer);
1573 1573
         $this->out('1 0 obj');
1574 1574
         $this->out('<</Type /Pages');
1575 1575
         $kids = '/Kids [';
1576
-        for ($i=0; $i<$nb; $i++) {
1577
-            $kids .= (3+2*$i).' 0 R ';
1576
+        for ($i = 0; $i < $nb; $i++) {
1577
+            $kids .= (3 + 2 * $i) . ' 0 R ';
1578 1578
         }
1579
-        $this->out($kids.']');
1580
-        $this->out('/Count '.$nb);
1579
+        $this->out($kids . ']');
1580
+        $this->out('/Count ' . $nb);
1581 1581
         $this->out(sprintf('/MediaBox [0 0 %.2F %.2F]', $wPt, $hPt));
1582 1582
         $this->out('>>');
1583 1583
         $this->out('endobj');
@@ -1590,41 +1590,41 @@  discard block
 block discarded – undo
1590 1590
         foreach ($this->diffs as $diff) {
1591 1591
             //Encodings
1592 1592
             $this->newObj();
1593
-            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
1593
+            $this->out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences [' . $diff . ']>>');
1594 1594
             $this->out('endobj');
1595 1595
         }
1596 1596
         foreach ($this->fontFiles as $file => $info) {
1597 1597
             //Font file embedding
1598 1598
             $this->newObj();
1599
-            $this->fontFiles[$file]['n']=$this->n;
1600
-            $font='';
1601
-            $f = fopen($this->getFontPath().$file, 'rb', 1);
1599
+            $this->fontFiles[$file]['n'] = $this->n;
1600
+            $font = '';
1601
+            $f = fopen($this->getFontPath() . $file, 'rb', 1);
1602 1602
             if (!$f) {
1603 1603
                 $this->error('Font file not found');
1604 1604
             }
1605 1605
             while (!feof($f)) {
1606
-                $font.=fread($f, 8192);
1606
+                $font .= fread($f, 8192);
1607 1607
             }
1608 1608
             fclose($f);
1609
-            $compressed = (substr($file, -2)=='.z');
1609
+            $compressed = (substr($file, -2) == '.z');
1610 1610
             if (!$compressed && isset($info['length2'])) {
1611
-                $header = (ord($font[0])==128);
1611
+                $header = (ord($font[0]) == 128);
1612 1612
                 if ($header) {
1613 1613
                     //Strip first binary header
1614 1614
                     $font = substr($font, 6);
1615 1615
                 }
1616 1616
                 if ($header && ord($font[$info['length1']]) == 128) {
1617 1617
                     //Strip second binary header
1618
-                    $font = substr($font, 0, $info['length1']).substr($font, $info['length1']+6);
1618
+                    $font = substr($font, 0, $info['length1']) . substr($font, $info['length1'] + 6);
1619 1619
                 }
1620 1620
             }
1621
-            $this->out('<</Length '.strlen($font));
1621
+            $this->out('<</Length ' . strlen($font));
1622 1622
             if ($compressed) {
1623 1623
                 $this->out('/Filter /FlateDecode');
1624 1624
             }
1625
-            $this->out('/Length1 '.$info['length1']);
1625
+            $this->out('/Length1 ' . $info['length1']);
1626 1626
             if (isset($info['length2'])) {
1627
-                $this->out('/Length2 '.$info['length2'].' /Length3 0');
1627
+                $this->out('/Length2 ' . $info['length2'] . ' /Length3 0');
1628 1628
             }
1629 1629
             $this->out('>>');
1630 1630
             $this->putStream($font);
@@ -1632,32 +1632,32 @@  discard block
 block discarded – undo
1632 1632
         }
1633 1633
         foreach ($this->fonts as $k => $font) {
1634 1634
             //Font objects
1635
-            $this->fonts[$k]['n']=$this->n+1;
1635
+            $this->fonts[$k]['n'] = $this->n + 1;
1636 1636
             $type = $font['type'];
1637 1637
             $name = $font['name'];
1638 1638
             if ($type == 'core') {
1639 1639
                 //Standard font
1640 1640
                 $this->newObj();
1641 1641
                 $this->out('<</Type /Font');
1642
-                $this->out('/BaseFont /'.$name);
1642
+                $this->out('/BaseFont /' . $name);
1643 1643
                 $this->out('/Subtype /Type1');
1644 1644
                 if ($name != 'Symbol' && $name != 'ZapfDingbats') {
1645 1645
                     $this->out('/Encoding /WinAnsiEncoding');
1646 1646
                 }
1647 1647
                 $this->out('>>');
1648 1648
                 $this->out('endobj');
1649
-            } elseif ($type=='Type1' || $type=='TrueType') {
1649
+            } elseif ($type == 'Type1' || $type == 'TrueType') {
1650 1650
                 //Additional Type1 or TrueType font
1651 1651
                 $this->newObj();
1652 1652
                 $this->out('<</Type /Font');
1653
-                $this->out('/BaseFont /'.$name);
1654
-                $this->out('/Subtype /'.$type);
1653
+                $this->out('/BaseFont /' . $name);
1654
+                $this->out('/Subtype /' . $type);
1655 1655
                 $this->out('/FirstChar 32 /LastChar 255');
1656
-                $this->out('/Widths '.($this->n+1).' 0 R');
1657
-                $this->out('/FontDescriptor '.($this->n+2).' 0 R');
1656
+                $this->out('/Widths ' . ($this->n + 1) . ' 0 R');
1657
+                $this->out('/FontDescriptor ' . ($this->n + 2) . ' 0 R');
1658 1658
                 if ($font['enc']) {
1659 1659
                     if (isset($font['diff'])) {
1660
-                        $this->out('/Encoding '.($nf+$font['diff']).' 0 R');
1660
+                        $this->out('/Encoding ' . ($nf + $font['diff']) . ' 0 R');
1661 1661
                     } else {
1662 1662
                         $this->out('/Encoding /WinAnsiEncoding');
1663 1663
                     }
@@ -1666,30 +1666,30 @@  discard block
 block discarded – undo
1666 1666
                 $this->out('endobj');
1667 1667
                 //Widths
1668 1668
                 $this->newObj();
1669
-                $cw =& $font['cw'];
1669
+                $cw = & $font['cw'];
1670 1670
                 $s = '[';
1671
-                for ($i=32; $i<=255; $i++) {
1672
-                    $s .= $cw[chr($i)].' ';
1671
+                for ($i = 32; $i <= 255; $i++) {
1672
+                    $s .= $cw[chr($i)] . ' ';
1673 1673
                 }
1674
-                $this->out($s.']');
1674
+                $this->out($s . ']');
1675 1675
                 $this->out('endobj');
1676 1676
                 //Descriptor
1677 1677
                 $this->newObj();
1678
-                $s='<</Type /FontDescriptor /FontName /'.$name;
1678
+                $s = '<</Type /FontDescriptor /FontName /' . $name;
1679 1679
                 foreach ($font['desc'] as $k => $v) {
1680
-                    $s .= ' /'.$k.' '.$v;
1680
+                    $s .= ' /' . $k . ' ' . $v;
1681 1681
                 }
1682
-                $file=$font['file'];
1682
+                $file = $font['file'];
1683 1683
                 if ($file) {
1684
-                    $s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->fontFiles[$file]['n'].' 0 R';
1684
+                    $s .= ' /FontFile' . ($type == 'Type1' ? '' : '2') . ' ' . $this->fontFiles[$file]['n'] . ' 0 R';
1685 1685
                 }
1686
-                $this->out($s.'>>');
1686
+                $this->out($s . '>>');
1687 1687
                 $this->out('endobj');
1688 1688
             } else {
1689 1689
                 //Allow for additional types
1690
-                $mtd='_put'.strtolower($type);
1690
+                $mtd = '_put' . strtolower($type);
1691 1691
                 if (!method_exists($this, $mtd)) {
1692
-                    $this->error('Unsupported font type: '.$type);
1692
+                    $this->error('Unsupported font type: ' . $type);
1693 1693
                 }
1694 1694
                 $this->$mtd($font);
1695 1695
             }
@@ -1707,39 +1707,39 @@  discard block
 block discarded – undo
1707 1707
             $this->images[$file]['n'] = $this->n;
1708 1708
             $this->out('<</Type /XObject');
1709 1709
             $this->out('/Subtype /Image');
1710
-            $this->out('/Width '.$info['w']);
1711
-            $this->out('/Height '.$info['h']);
1712
-            if ($info['cs']=='Indexed') {
1713
-                $this->out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
1710
+            $this->out('/Width ' . $info['w']);
1711
+            $this->out('/Height ' . $info['h']);
1712
+            if ($info['cs'] == 'Indexed') {
1713
+                $this->out('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->n + 1) . ' 0 R]');
1714 1714
             } else {
1715
-                $this->out('/ColorSpace /'.$info['cs']);
1716
-                if ($info['cs']=='DeviceCMYK') {
1715
+                $this->out('/ColorSpace /' . $info['cs']);
1716
+                if ($info['cs'] == 'DeviceCMYK') {
1717 1717
                     $this->out('/Decode [1 0 1 0 1 0 1 0]');
1718 1718
                 }
1719 1719
             }
1720
-            $this->out('/BitsPerComponent '.$info['bpc']);
1720
+            $this->out('/BitsPerComponent ' . $info['bpc']);
1721 1721
             if (isset($info['f'])) {
1722
-                $this->out('/Filter /'.$info['f']);
1722
+                $this->out('/Filter /' . $info['f']);
1723 1723
             }
1724 1724
             if (isset($info['parms'])) {
1725 1725
                 $this->out($info['parms']);
1726 1726
             }
1727 1727
             if (isset($info['trns']) && is_array($info['trns'])) {
1728 1728
                 $trns = '';
1729
-                for ($i=0; $i<count($info['trns']); $i++) {
1730
-                    $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
1729
+                for ($i = 0; $i < count($info['trns']); $i++) {
1730
+                    $trns .= $info['trns'][$i] . ' ' . $info['trns'][$i] . ' ';
1731 1731
                 }
1732
-                $this->out('/Mask ['.$trns.']');
1732
+                $this->out('/Mask [' . $trns . ']');
1733 1733
             }
1734
-            $this->out('/Length '.strlen($info['data']).'>>');
1734
+            $this->out('/Length ' . strlen($info['data']) . '>>');
1735 1735
             $this->putStream($info['data']);
1736 1736
             unset($this->images[$file]['data']);
1737 1737
             $this->out('endobj');
1738 1738
             //Palette
1739 1739
             if ($info['cs'] == 'Indexed') {
1740 1740
                 $this->newObj();
1741
-                $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1742
-                $this->out('<<'.$filter.'/Length '.strlen($pal).'>>');
1741
+                $pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
1742
+                $this->out('<<' . $filter . '/Length ' . strlen($pal) . '>>');
1743 1743
                 $this->putStream($pal);
1744 1744
                 $this->out('endobj');
1745 1745
             }
@@ -1749,7 +1749,7 @@  discard block
 block discarded – undo
1749 1749
     protected function putXobjectDict()
1750 1750
     {
1751 1751
         foreach ($this->images as $image) {
1752
-            $this->out('/I'.$image['i'].' '.$image['n'].' 0 R');
1752
+            $this->out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
1753 1753
         }
1754 1754
     }
1755 1755
     
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
         $this->out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
1759 1759
         $this->out('/Font <<');
1760 1760
         foreach ($this->fonts as $font) {
1761
-            $this->out('/F'.$font['i'].' '.$font['n'].' 0 R');
1761
+            $this->out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
1762 1762
         }
1763 1763
         $this->out('>>');
1764 1764
         $this->out('/XObject <<');
@@ -1781,57 +1781,57 @@  discard block
 block discarded – undo
1781 1781
     
1782 1782
     protected function putInfo()
1783 1783
     {
1784
-        $this->out('/Producer '.$this->textString('FPDF '. self::FPDF_VERSION));
1784
+        $this->out('/Producer ' . $this->textString('FPDF ' . self::FPDF_VERSION));
1785 1785
         if (!empty($this->title)) {
1786
-            $this->out('/Title '.$this->textString($this->title));
1786
+            $this->out('/Title ' . $this->textString($this->title));
1787 1787
         }
1788 1788
         if (!empty($this->subject)) {
1789
-            $this->out('/Subject '.$this->textString($this->subject));
1789
+            $this->out('/Subject ' . $this->textString($this->subject));
1790 1790
         }
1791 1791
         if (!empty($this->author)) {
1792
-            $this->out('/Author '.$this->textString($this->author));
1792
+            $this->out('/Author ' . $this->textString($this->author));
1793 1793
         }
1794 1794
         if (!empty($this->keywords)) {
1795
-            $this->out('/Keywords '.$this->textString($this->keywords));
1795
+            $this->out('/Keywords ' . $this->textString($this->keywords));
1796 1796
         }
1797 1797
         if (!empty($this->creator)) {
1798
-            $this->out('/Creator '.$this->textString($this->creator));
1798
+            $this->out('/Creator ' . $this->textString($this->creator));
1799 1799
         }
1800
-        $this->out('/CreationDate '.$this->textString('D:'.@date('YmdHis')));
1800
+        $this->out('/CreationDate ' . $this->textString('D:' . @date('YmdHis')));
1801 1801
     }
1802 1802
     
1803 1803
     protected function putCatalog()
1804 1804
     {
1805 1805
         $this->out('/Type /Catalog');
1806 1806
         $this->out('/Pages 1 0 R');
1807
-        if ($this->zoomMode=='fullpage') {
1807
+        if ($this->zoomMode == 'fullpage') {
1808 1808
             $this->out('/OpenAction [3 0 R /Fit]');
1809
-        } elseif ($this->zoomMode=='fullwidth') {
1809
+        } elseif ($this->zoomMode == 'fullwidth') {
1810 1810
             $this->out('/OpenAction [3 0 R /FitH null]');
1811
-        } elseif ($this->zoomMode=='real') {
1811
+        } elseif ($this->zoomMode == 'real') {
1812 1812
             $this->out('/OpenAction [3 0 R /XYZ null null 1]');
1813 1813
         } elseif (!is_string($this->zoomMode)) {
1814
-            $this->out('/OpenAction [3 0 R /XYZ null null '.($this->zoomMode/100).']');
1814
+            $this->out('/OpenAction [3 0 R /XYZ null null ' . ($this->zoomMode / 100) . ']');
1815 1815
         }
1816
-        if ($this->layoutMode=='single') {
1816
+        if ($this->layoutMode == 'single') {
1817 1817
             $this->out('/PageLayout /SinglePage');
1818
-        } elseif ($this->layoutMode=='continuous') {
1818
+        } elseif ($this->layoutMode == 'continuous') {
1819 1819
             $this->out('/PageLayout /OneColumn');
1820
-        } elseif ($this->layoutMode=='two') {
1820
+        } elseif ($this->layoutMode == 'two') {
1821 1821
             $this->out('/PageLayout /TwoColumnLeft');
1822 1822
         }
1823 1823
     }
1824 1824
     
1825 1825
     protected function putHeader()
1826 1826
     {
1827
-        $this->out('%PDF-'.$this->pdfVersion);
1827
+        $this->out('%PDF-' . $this->pdfVersion);
1828 1828
     }
1829 1829
     
1830 1830
     protected function putTrailer()
1831 1831
     {
1832
-        $this->out('/Size '.($this->n+1));
1833
-        $this->out('/Root '.$this->n.' 0 R');
1834
-        $this->out('/Info '.($this->n-1).' 0 R');
1832
+        $this->out('/Size ' . ($this->n + 1));
1833
+        $this->out('/Root ' . $this->n . ' 0 R');
1834
+        $this->out('/Info ' . ($this->n - 1) . ' 0 R');
1835 1835
     }
1836 1836
     
1837 1837
     protected function endDoc()
@@ -1852,11 +1852,11 @@  discard block
 block discarded – undo
1852 1852
         $this->out('>>');
1853 1853
         $this->out('endobj');
1854 1854
         //Cross-ref
1855
-        $o=strlen($this->buffer);
1855
+        $o = strlen($this->buffer);
1856 1856
         $this->out('xref');
1857
-        $this->out('0 '.($this->n+1));
1857
+        $this->out('0 ' . ($this->n + 1));
1858 1858
         $this->out('0000000000 65535 f ');
1859
-        for ($i=1; $i<=$this->n; $i++) {
1859
+        for ($i = 1; $i <= $this->n; $i++) {
1860 1860
             $this->out(sprintf('%010d 00000 n ', $this->offsets[$i]));
1861 1861
         }
1862 1862
         //Trailer
@@ -1867,6 +1867,6 @@  discard block
 block discarded – undo
1867 1867
         $this->out('startxref');
1868 1868
         $this->out($o);
1869 1869
         $this->out('%%EOF');
1870
-        $this->state=3;
1870
+        $this->state = 3;
1871 1871
     }
1872 1872
 }
Please login to merge, or discard this patch.
src/Legacy/FPDF/Fpdf1.php 1 patch
Doc Comments   +33 added lines patch added patch discarded remove patch
@@ -174,6 +174,10 @@  discard block
 block discarded – undo
174 174
         $this->pdfVersion='1.3';
175 175
     }
176 176
 
177
+    /**
178
+     * @param double $left
179
+     * @param double $top
180
+     */
177 181
     public function setMargins($left, $top, $right = null)
178 182
     {
179 183
         //Set left, top and right margins
@@ -206,6 +210,9 @@  discard block
 block discarded – undo
206 210
         $this->rMargin = $margin;
207 211
     }
208 212
 
213
+    /**
214
+     * @param boolean $auto
215
+     */
209 216
     public function setAutoPageBreak($auto, $margin = 0)
210 217
     {
211 218
         //Set auto page break mode and triggering margin
@@ -214,6 +221,9 @@  discard block
 block discarded – undo
214 221
         $this->pageBreakTrigger = $this->h-$margin;
215 222
     }
216 223
 
224
+    /**
225
+     * @param string $zoom
226
+     */
217 227
     public function setDisplayMode($zoom, $layout = 'continuous')
218 228
     {
219 229
         //Set display mode in viewer
@@ -229,6 +239,9 @@  discard block
 block discarded – undo
229 239
         }
230 240
     }
231 241
 
242
+    /**
243
+     * @param boolean $compress
244
+     */
232 245
     public function setCompression($compress)
233 246
     {
234 247
         //Set page compression
@@ -290,6 +303,9 @@  discard block
 block discarded – undo
290 303
         $this->aliasNbPages=$alias;
291 304
     }
292 305
 
306
+    /**
307
+     * @param string $msg
308
+     */
293 309
     public function error($msg)
294 310
     {
295 311
         throw new \Exception($msg);
@@ -561,6 +577,9 @@  discard block
 block discarded – undo
561 577
         }
562 578
     }
563 579
 
580
+    /**
581
+     * @param string $family
582
+     */
564 583
     public function setFont($family, $style = '', $size = 0)
565 584
     {
566 585
         //Select a font; size given in points
@@ -659,6 +678,10 @@  discard block
 block discarded – undo
659 678
         $this->links[$link] = array($page, $y);
660 679
     }
661 680
 
681
+    /**
682
+     * @param double $y
683
+     * @param string $link
684
+     */
662 685
     public function link($x, $y, $w, $h, $link)
663 686
     {
664 687
         //Put a link on the page
@@ -1192,6 +1215,9 @@  discard block
 block discarded – undo
1192 1215
         }
1193 1216
     }
1194 1217
 
1218
+    /**
1219
+     * @param string $format
1220
+     */
1195 1221
     protected function getpageformat($format)
1196 1222
     {
1197 1223
         $format=strtolower($format);
@@ -1210,6 +1236,10 @@  discard block
 block discarded – undo
1210 1236
         return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
1211 1237
     }
1212 1238
 
1239
+    /**
1240
+     * @param string $orientation
1241
+     * @param string $format
1242
+     */
1213 1243
     protected function beginPage($orientation, $format)
1214 1244
     {
1215 1245
         $this->page++;
@@ -1348,6 +1378,9 @@  discard block
 block discarded – undo
1348 1378
         return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
1349 1379
     }
1350 1380
 
1381
+    /**
1382
+     * @param string $file
1383
+     */
1351 1384
     protected function parsePNG($file)
1352 1385
     {
1353 1386
         //Extract info from a PNG file
Please login to merge, or discard this patch.
src/Legacy/Pdf.php 3 patches
Doc Comments   +32 added lines, -29 removed lines patch added patch discarded remove patch
@@ -162,6 +162,9 @@  discard block
 block discarded – undo
162 162
 
163 163
     /**
164 164
      * Imprime barcode 128
165
+     * @param double $x
166
+     * @param double $y
167
+     * @param integer $h
165 168
      */
166 169
     public function code128($x, $y, $code, $w, $h)
167 170
     {
@@ -237,8 +240,8 @@  discard block
 block discarded – undo
237 240
     /**
238 241
      * Rotaciona para impressão paisagem (landscape)
239 242
      * @param   number $angle
240
-     * @param   number $x
241
-     * @param   number $y
243
+     * @param   integer $x
244
+     * @param   integer $y
242 245
      */
243 246
     public function rotate($angle, $x = -1, $y = -1)
244 247
     {
@@ -335,12 +338,12 @@  discard block
 block discarded – undo
335 338
     
336 339
     /**
337 340
      * Desenha o arco para arredondar o canto do retangulo
338
-     * @param   number $x1
339
-     * @param   number $y1
340
-     * @param   number $x2
341
-     * @param   number $y2
342
-     * @param   number $x3
343
-     * @param   number $y3
341
+     * @param   double $x1
342
+     * @param   double $y1
343
+     * @param   double $x2
344
+     * @param   double $y2
345
+     * @param   double $x3
346
+     * @param   double $y3
344 347
      */
345 348
     private function arc($x1, $y1, $x2, $y2, $x3, $y3)
346 349
     {
@@ -364,8 +367,8 @@  discard block
 block discarded – undo
364 367
      * @param   number $y1
365 368
      * @param   number $x2
366 369
      * @param   number $y2
367
-     * @param   number $width
368
-     * @param   number $nb
370
+     * @param   integer $width
371
+     * @param   integer $nb
369 372
      */
370 373
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
371 374
     {
@@ -432,11 +435,11 @@  discard block
 block discarded – undo
432 435
      * @param   number  $w
433 436
      * @param   number  $h
434 437
      * @param   string  $txt
435
-     * @param   string  $border
438
+     * @param   integer  $border
436 439
      * @param   string  $align
437 440
      * @param   boolean $fill
438
-     * @param   number  $maxline
439
-     * @param   number  $prn
441
+     * @param   integer  $maxline
442
+     * @param   integer  $prn
440 443
      * @return  int
441 444
      */
442 445
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
@@ -565,7 +568,7 @@  discard block
 block discarded – undo
565 568
     
566 569
     /**
567 570
      * Quebra o texto para caber na caixa
568
-     * @param   type $text
571
+     * @param   string $text
569 572
      * @param   type $maxwidth
570 573
      * @return  int
571 574
      */
@@ -616,10 +619,10 @@  discard block
 block discarded – undo
616 619
     /**
617 620
      * Celula com escala horizontal caso o texto seja muito largo
618 621
      * @param   number  $w
619
-     * @param   number  $h
622
+     * @param   integer  $h
620 623
      * @param   string  $txt
621
-     * @param   number  $border
622
-     * @param   number  $ln
624
+     * @param   integer  $border
625
+     * @param   integer  $ln
623 626
      * @param   string  $align
624 627
      * @param   boolean $fill
625 628
      * @param   string  $link
@@ -670,10 +673,10 @@  discard block
 block discarded – undo
670 673
     /**
671 674
      * Celula com escalamento horizontal somente se necessário
672 675
      * @param   number  $w
673
-     * @param   number  $h
676
+     * @param   integer  $h
674 677
      * @param   string  $txt
675
-     * @param   number  $border
676
-     * @param   number  $ln
678
+     * @param   integer  $border
679
+     * @param   integer  $ln
677 680
      * @param   string  $align
678 681
      * @param   boolean $fill
679 682
      * @param   string  $link
@@ -686,10 +689,10 @@  discard block
 block discarded – undo
686 689
     /**
687 690
      * Celula com escalamento forçado
688 691
      * @param   number  $w
689
-     * @param   number  $h
692
+     * @param   integer  $h
690 693
      * @param   string  $txt
691
-     * @param   number  $border
692
-     * @param   number  $ln
694
+     * @param   integer  $border
695
+     * @param   integer  $ln
693 696
      * @param   string  $align
694 697
      * @param   boolean $fill
695 698
      * @param   string  $link
@@ -710,10 +713,10 @@  discard block
 block discarded – undo
710 713
     /**
711 714
      * Celula com espaçamento de caracteres somente se necessário
712 715
      * @param   number  $w
713
-     * @param   number  $h
716
+     * @param   integer  $h
714 717
      * @param   string  $txt
715
-     * @param   number  $border
716
-     * @param   number  $ln
718
+     * @param   integer  $border
719
+     * @param   integer  $ln
717 720
      * @param   string  $align
718 721
      * @param   boolean $fill
719 722
      * @param   string  $link
@@ -726,10 +729,10 @@  discard block
 block discarded – undo
726 729
     /**
727 730
      * Celula com espaçamento de caracteres forçado
728 731
      * @param   number  $w
729
-     * @param   number  $h
732
+     * @param   integer  $h
730 733
      * @param   string  $txt
731
-     * @param   number  $border
732
-     * @param   number  $ln
734
+     * @param   integer  $border
735
+     * @param   integer  $ln
733 736
      * @param   string  $align
734 737
      * @param   boolean $fill
735 738
      * @param   string  $link
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -795,15 +795,15 @@
 block discarded – undo
795 795
         $this->setDrawColor(0);
796 796
     }
797 797
 
798
-   /**
799
-    * Desenha uma linha vertical tracejada com o FPDF
800
-    * @param   number $x      Posição horizontal inicial, em mm
801
-    * @param   number $y      Posição vertical inicial, em mm
802
-    * @param   number $w      Comprimento da linha, em mm
803
-    * @param   number $yfinal Espessura da linha, em mm
804
-    * @param   number $n      Numero de traços na seção da linha com o comprimento $w
805
-    * @return  none
806
-    */
798
+    /**
799
+     * Desenha uma linha vertical tracejada com o FPDF
800
+     * @param   number $x      Posição horizontal inicial, em mm
801
+     * @param   number $y      Posição vertical inicial, em mm
802
+     * @param   number $w      Comprimento da linha, em mm
803
+     * @param   number $yfinal Espessura da linha, em mm
804
+     * @param   number $n      Numero de traços na seção da linha com o comprimento $w
805
+     * @return  none
806
+     */
807 807
     public function dashedVLine($x, $y, $w, $yfinal, $n)
808 808
     {
809 809
         $this->setLineWidth($w);
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -6,129 +6,129 @@  discard block
 block discarded – undo
6 6
 
7 7
 class Pdf extends Fpdf
8 8
 {
9
-    private $t128;                                             // tabela de codigos 128
10
-    private $abcSet="";                                        // conjunto de caracteres legiveis em 128
11
-    private $aSet="";                                          // grupo A do conjunto de de caracteres legiveis
12
-    private $bSet="";                                          // grupo B do conjunto de caracteres legiveis
13
-    private $cSet="";                                          // grupo C do conjunto de caracteres legiveis
14
-    private $setFrom;                                          // converter de
15
-    private $setTo;                                            // converter para
16
-    private $jStart = array("A"=>103, "B"=>104, "C"=>105);     // Caracteres de seleção do grupo 128
17
-    private $jSwap = array("A"=>101, "B"=>100, "C"=>99);       // Caracteres de troca de grupo
9
+    private $t128; // tabela de codigos 128
10
+    private $abcSet = ""; // conjunto de caracteres legiveis em 128
11
+    private $aSet = ""; // grupo A do conjunto de de caracteres legiveis
12
+    private $bSet = ""; // grupo B do conjunto de caracteres legiveis
13
+    private $cSet = ""; // grupo C do conjunto de caracteres legiveis
14
+    private $setFrom; // converter de
15
+    private $setTo; // converter para
16
+    private $jStart = array("A"=>103, "B"=>104, "C"=>105); // Caracteres de seleção do grupo 128
17
+    private $jSwap = array("A"=>101, "B"=>100, "C"=>99); // Caracteres de troca de grupo
18 18
 
19 19
     public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4')
20 20
     {
21 21
         //passar parametros para a classe principal
22 22
         parent::__construct($orientation, $unit, $format);
23 23
         // composição dos caracteres do barcode 128
24
-        $this->t128[] = array(2, 1, 2, 2, 2, 2);           //0 : [ ]
25
-        $this->t128[] = array(2, 2, 2, 1, 2, 2);           //1 : [!]
26
-        $this->t128[] = array(2, 2, 2, 2, 2, 1);           //2 : ["]
27
-        $this->t128[] = array(1, 2, 1, 2, 2, 3);           //3 : [#]
28
-        $this->t128[] = array(1, 2, 1, 3, 2, 2);           //4 : [$]
29
-        $this->t128[] = array(1, 3, 1, 2, 2, 2);           //5 : [%]
30
-        $this->t128[] = array(1, 2, 2, 2, 1, 3);           //6 : [&]
31
-        $this->t128[] = array(1, 2, 2, 3, 1, 2);           //7 : [']
32
-        $this->t128[] = array(1, 3, 2, 2, 1, 2);           //8 : [(]
33
-        $this->t128[] = array(2, 2, 1, 2, 1, 3);           //9 : [)]
34
-        $this->t128[] = array(2, 2, 1, 3, 1, 2);           //10 : [*]
35
-        $this->t128[] = array(2, 3, 1, 2, 1, 2);           //11 : [+]
36
-        $this->t128[] = array(1, 1, 2, 2, 3, 2);           //12 : [,]
37
-        $this->t128[] = array(1, 2, 2, 1, 3, 2);           //13 : [-]
38
-        $this->t128[] = array(1, 2, 2, 2, 3, 1);           //14 : [.]
39
-        $this->t128[] = array(1, 1, 3, 2, 2, 2);           //15 : [/]
40
-        $this->t128[] = array(1, 2, 3, 1, 2, 2);           //16 : [0]
41
-        $this->t128[] = array(1, 2, 3, 2, 2, 1);           //17 : [1]
42
-        $this->t128[] = array(2, 2, 3, 2, 1, 1);           //18 : [2]
43
-        $this->t128[] = array(2, 2, 1, 1, 3, 2);           //19 : [3]
44
-        $this->t128[] = array(2, 2, 1, 2, 3, 1);           //20 : [4]
45
-        $this->t128[] = array(2, 1, 3, 2, 1, 2);           //21 : [5]
46
-        $this->t128[] = array(2, 2, 3, 1, 1, 2);           //22 : [6]
47
-        $this->t128[] = array(3, 1, 2, 1, 3, 1);           //23 : [7]
48
-        $this->t128[] = array(3, 1, 1, 2, 2, 2);           //24 : [8]
49
-        $this->t128[] = array(3, 2, 1, 1, 2, 2);           //25 : [9]
50
-        $this->t128[] = array(3, 2, 1, 2, 2, 1);           //26 : [:]
51
-        $this->t128[] = array(3, 1, 2, 2, 1, 2);           //27 : [;]
52
-        $this->t128[] = array(3, 2, 2, 1, 1, 2);           //28 : [<]
53
-        $this->t128[] = array(3, 2, 2, 2, 1, 1);           //29 : [=]
54
-        $this->t128[] = array(2, 1, 2, 1, 2, 3);           //30 : [>]
55
-        $this->t128[] = array(2, 1, 2, 3, 2, 1);           //31 : [?]
56
-        $this->t128[] = array(2, 3, 2, 1, 2, 1);           //32 : [@]
57
-        $this->t128[] = array(1, 1, 1, 3, 2, 3);           //33 : [A]
58
-        $this->t128[] = array(1, 3, 1, 1, 2, 3);           //34 : [B]
59
-        $this->t128[] = array(1, 3, 1, 3, 2, 1);           //35 : [C]
60
-        $this->t128[] = array(1, 1, 2, 3, 1, 3);           //36 : [D]
61
-        $this->t128[] = array(1, 3, 2, 1, 1, 3);           //37 : [E]
62
-        $this->t128[] = array(1, 3, 2, 3, 1, 1);           //38 : [F]
63
-        $this->t128[] = array(2, 1, 1, 3, 1, 3);           //39 : [G]
64
-        $this->t128[] = array(2, 3, 1, 1, 1, 3);           //40 : [H]
65
-        $this->t128[] = array(2, 3, 1, 3, 1, 1);           //41 : [I]
66
-        $this->t128[] = array(1, 1, 2, 1, 3, 3);           //42 : [J]
67
-        $this->t128[] = array(1, 1, 2, 3, 3, 1);           //43 : [K]
68
-        $this->t128[] = array(1, 3, 2, 1, 3, 1);           //44 : [L]
69
-        $this->t128[] = array(1, 1, 3, 1, 2, 3);           //45 : [M]
70
-        $this->t128[] = array(1, 1, 3, 3, 2, 1);           //46 : [N]
71
-        $this->t128[] = array(1, 3, 3, 1, 2, 1);           //47 : [O]
72
-        $this->t128[] = array(3, 1, 3, 1, 2, 1);           //48 : [P]
73
-        $this->t128[] = array(2, 1, 1, 3, 3, 1);           //49 : [Q]
74
-        $this->t128[] = array(2, 3, 1, 1, 3, 1);           //50 : [R]
75
-        $this->t128[] = array(2, 1, 3, 1, 1, 3);           //51 : [S]
76
-        $this->t128[] = array(2, 1, 3, 3, 1, 1);           //52 : [T]
77
-        $this->t128[] = array(2, 1, 3, 1, 3, 1);           //53 : [U]
78
-        $this->t128[] = array(3, 1, 1, 1, 2, 3);           //54 : [V]
79
-        $this->t128[] = array(3, 1, 1, 3, 2, 1);           //55 : [W]
80
-        $this->t128[] = array(3, 3, 1, 1, 2, 1);           //56 : [X]
81
-        $this->t128[] = array(3, 1, 2, 1, 1, 3);           //57 : [Y]
82
-        $this->t128[] = array(3, 1, 2, 3, 1, 1);           //58 : [Z]
83
-        $this->t128[] = array(3, 3, 2, 1, 1, 1);           //59 : [[]
84
-        $this->t128[] = array(3, 1, 4, 1, 1, 1);           //60 : [\]
85
-        $this->t128[] = array(2, 2, 1, 4, 1, 1);           //61 : []]
86
-        $this->t128[] = array(4, 3, 1, 1, 1, 1);           //62 : [^]
87
-        $this->t128[] = array(1, 1, 1, 2, 2, 4);           //63 : [_]
88
-        $this->t128[] = array(1, 1, 1, 4, 2, 2);           //64 : [`]
89
-        $this->t128[] = array(1, 2, 1, 1, 2, 4);           //65 : [a]
90
-        $this->t128[] = array(1, 2, 1, 4, 2, 1);           //66 : [b]
91
-        $this->t128[] = array(1, 4, 1, 1, 2, 2);           //67 : [c]
92
-        $this->t128[] = array(1, 4, 1, 2, 2, 1);           //68 : [d]
93
-        $this->t128[] = array(1, 1, 2, 2, 1, 4);           //69 : [e]
94
-        $this->t128[] = array(1, 1, 2, 4, 1, 2);           //70 : [f]
95
-        $this->t128[] = array(1, 2, 2, 1, 1, 4);           //71 : [g]
96
-        $this->t128[] = array(1, 2, 2, 4, 1, 1);           //72 : [h]
97
-        $this->t128[] = array(1, 4, 2, 1, 1, 2);           //73 : [i]
98
-        $this->t128[] = array(1, 4, 2, 2, 1, 1);           //74 : [j]
99
-        $this->t128[] = array(2, 4, 1, 2, 1, 1);           //75 : [k]
100
-        $this->t128[] = array(2, 2, 1, 1, 1, 4);           //76 : [l]
101
-        $this->t128[] = array(4, 1, 3, 1, 1, 1);           //77 : [m]
102
-        $this->t128[] = array(2, 4, 1, 1, 1, 2);           //78 : [n]
103
-        $this->t128[] = array(1, 3, 4, 1, 1, 1);           //79 : [o]
104
-        $this->t128[] = array(1, 1, 1, 2, 4, 2);           //80 : [p]
105
-        $this->t128[] = array(1, 2, 1, 1, 4, 2);           //81 : [q]
106
-        $this->t128[] = array(1, 2, 1, 2, 4, 1);           //82 : [r]
107
-        $this->t128[] = array(1, 1, 4, 2, 1, 2);           //83 : [s]
108
-        $this->t128[] = array(1, 2, 4, 1, 1, 2);           //84 : [t]
109
-        $this->t128[] = array(1, 2, 4, 2, 1, 1);           //85 : [u]
110
-        $this->t128[] = array(4, 1, 1, 2, 1, 2);           //86 : [v]
111
-        $this->t128[] = array(4, 2, 1, 1, 1, 2);           //87 : [w]
112
-        $this->t128[] = array(4, 2, 1, 2, 1, 1);           //88 : [x]
113
-        $this->t128[] = array(2, 1, 2, 1, 4, 1);           //89 : [y]
114
-        $this->t128[] = array(2, 1, 4, 1, 2, 1);           //90 : [z]
115
-        $this->t128[] = array(4, 1, 2, 1, 2, 1);           //91 : [{]
116
-        $this->t128[] = array(1, 1, 1, 1, 4, 3);           //92 : [|]
117
-        $this->t128[] = array(1, 1, 1, 3, 4, 1);           //93 : [}]
118
-        $this->t128[] = array(1, 3, 1, 1, 4, 1);           //94 : [~]
119
-        $this->t128[] = array(1, 1, 4, 1, 1, 3);           //95 : [DEL]
120
-        $this->t128[] = array(1, 1, 4, 3, 1, 1);           //96 : [FNC3]
121
-        $this->t128[] = array(4, 1, 1, 1, 1, 3);           //97 : [FNC2]
122
-        $this->t128[] = array(4, 1, 1, 3, 1, 1);           //98 : [SHIFT]
123
-        $this->t128[] = array(1, 1, 3, 1, 4, 1);           //99 : [Cswap]
124
-        $this->t128[] = array(1, 1, 4, 1, 3, 1);           //100 : [Bswap]
125
-        $this->t128[] = array(3, 1, 1, 1, 4, 1);           //101 : [Aswap]
126
-        $this->t128[] = array(4, 1, 1, 1, 3, 1);           //102 : [FNC1]
127
-        $this->t128[] = array(2, 1, 1, 4, 1, 2);           //103 : [Astart]
128
-        $this->t128[] = array(2, 1, 1, 2, 1, 4);           //104 : [Bstart]
129
-        $this->t128[] = array(2, 1, 1, 2, 3, 2);           //105 : [Cstart]
130
-        $this->t128[] = array(2, 3, 3, 1, 1, 1);           //106 : [STOP]
131
-        $this->t128[] = array(2, 1);                       //107 : [END BAR]
24
+        $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ]
25
+        $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!]
26
+        $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["]
27
+        $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#]
28
+        $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$]
29
+        $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%]
30
+        $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&]
31
+        $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : [']
32
+        $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(]
33
+        $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)]
34
+        $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*]
35
+        $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+]
36
+        $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,]
37
+        $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-]
38
+        $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.]
39
+        $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/]
40
+        $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0]
41
+        $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1]
42
+        $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2]
43
+        $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3]
44
+        $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4]
45
+        $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5]
46
+        $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6]
47
+        $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7]
48
+        $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8]
49
+        $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9]
50
+        $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:]
51
+        $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;]
52
+        $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<]
53
+        $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=]
54
+        $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>]
55
+        $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?]
56
+        $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@]
57
+        $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A]
58
+        $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B]
59
+        $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C]
60
+        $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D]
61
+        $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E]
62
+        $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F]
63
+        $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G]
64
+        $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H]
65
+        $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I]
66
+        $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J]
67
+        $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K]
68
+        $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L]
69
+        $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M]
70
+        $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N]
71
+        $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O]
72
+        $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P]
73
+        $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q]
74
+        $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R]
75
+        $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S]
76
+        $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T]
77
+        $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U]
78
+        $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V]
79
+        $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W]
80
+        $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X]
81
+        $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y]
82
+        $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z]
83
+        $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[]
84
+        $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\]
85
+        $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []]
86
+        $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^]
87
+        $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_]
88
+        $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`]
89
+        $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a]
90
+        $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b]
91
+        $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c]
92
+        $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d]
93
+        $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e]
94
+        $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f]
95
+        $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g]
96
+        $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h]
97
+        $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i]
98
+        $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j]
99
+        $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k]
100
+        $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l]
101
+        $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m]
102
+        $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n]
103
+        $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o]
104
+        $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p]
105
+        $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q]
106
+        $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r]
107
+        $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s]
108
+        $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t]
109
+        $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u]
110
+        $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v]
111
+        $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w]
112
+        $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x]
113
+        $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y]
114
+        $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z]
115
+        $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{]
116
+        $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|]
117
+        $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}]
118
+        $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~]
119
+        $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL]
120
+        $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3]
121
+        $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2]
122
+        $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT]
123
+        $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap]
124
+        $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap]
125
+        $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap]
126
+        $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1]
127
+        $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart]
128
+        $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart]
129
+        $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart]
130
+        $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP]
131
+        $this->t128[] = array(2, 1); //107 : [END BAR]
132 132
         for ($i = 32; $i <= 95; $i++) {   // conjunto de caracteres
133 133
             $this->abcSet .= chr($i);
134 134
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $this->abcSet .= chr($i);
143 143
             $this->bSet .= chr($i);
144 144
         }
145
-        $this->cSet="0123456789";
145
+        $this->cSet = "0123456789";
146 146
         for ($i = 0; $i < 96; $i++) {
147 147
             // convertendo grupos A & B
148 148
             if (isset($this->setFrom["A"])) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $this->setFrom["B"] .= chr($i + 32);
153 153
             }
154 154
             if (isset($this->setTo["A"])) {
155
-                $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32);
155
+                $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32);
156 156
             }
157 157
             if (isset($this->setTo["A"])) {
158 158
                 $this->setTo["B"] .= chr($i);
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function code128($x, $y, $code, $w, $h)
167 167
     {
168
-        $Aguid="";
169
-        $Bguid="";
170
-        $Cguid="";
171
-        for ($i=0; $i < strlen($code); $i++) {
172
-            $needle=substr($code, $i, 1);
173
-            $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O");
174
-            $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O");
175
-            $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O");
168
+        $Aguid = "";
169
+        $Bguid = "";
170
+        $Cguid = "";
171
+        for ($i = 0; $i < strlen($code); $i++) {
172
+            $needle = substr($code, $i, 1);
173
+            $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O");
174
+            $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O");
175
+            $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O");
176 176
         }
177 177
         $SminiC = "OOOO";
178 178
         $IminiC = 4;
179 179
         $crypt = "";
180 180
         while ($code > "") {
181 181
             $i = strpos($Cguid, $SminiC);
182
-            if ($i!==false) {
182
+            if ($i !== false) {
183 183
                 $Aguid [$i] = "N";
184 184
                 $Bguid [$i] = "N";
185 185
             }
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
                 if ($made === false) {
190 190
                     $made = strlen($Cguid);
191 191
                 }
192
-                if (fmod($made, 2)==1) {
192
+                if (fmod($made, 2) == 1) {
193 193
                     $made--;
194 194
                 }
195
-                for ($i=0; $i < $made;
195
+                for ($i = 0; $i < $made;
196 196
                 $i += 2) {
197 197
                     $crypt .= chr(strval(substr($code, $i, 2)));
198 198
                 }
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
                 if ($madeB === false) {
207 207
                     $madeB = strlen($Bguid);
208 208
                 }
209
-                $made = (($madeA < $madeB) ? $madeB : $madeA );
210
-                $jeu = (($madeA < $madeB) ? "B" : "A" );
209
+                $made = (($madeA < $madeB) ? $madeB : $madeA);
210
+                $jeu = (($madeA < $madeB) ? "B" : "A");
211 211
                 $jeuguid = $jeu . "guid";
212 212
                 $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]);
213 213
                 $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]);
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
             $Cguid = substr($Cguid, $made);
219 219
         }
220 220
         $check = ord($crypt[0]);
221
-        for ($i=0; $i<strlen($crypt); $i++) {
221
+        for ($i = 0; $i < strlen($crypt); $i++) {
222 222
             $check += (ord($crypt[$i]) * $i);
223 223
         }
224 224
         $check %= 103;
225 225
         $crypt .= chr($check) . chr(106) . chr(107);
226 226
         $i = (strlen($crypt) * 11) - 8;
227
-        $modul = $w/$i;
228
-        for ($i=0; $i<strlen($crypt); $i++) {
227
+        $modul = $w / $i;
228
+        for ($i = 0; $i < strlen($crypt); $i++) {
229 229
             $c = $this->t128[ord($crypt[$i])];
230
-            for ($j=0; $j<count($c); $j++) {
231
-                $this->Rect($x, $y, $c[$j]*$modul, $h, "F");
232
-                $x += ($c[$j++]+$c[$j])*$modul;
230
+            for ($j = 0; $j < count($c); $j++) {
231
+                $this->Rect($x, $y, $c[$j] * $modul, $h, "F");
232
+                $x += ($c[$j++] + $c[$j]) * $modul;
233 233
             }
234 234
         }
235 235
     }
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
         }
254 254
         $this->angle = $angle;
255 255
         if ($angle != 0) {
256
-            $angle *= M_PI/180;
256
+            $angle *= M_PI / 180;
257 257
             $c = cos($angle);
258 258
             $s = sin($angle);
259
-            $cx =$x*$this->k;
260
-            $cy = ($this->h-$y)*$this->k;
259
+            $cx = $x * $this->k;
260
+            $cy = ($this->h - $y) * $this->k;
261 261
             $this->out(
262 262
                 sprintf(
263 263
                     'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',
@@ -295,40 +295,40 @@  discard block
 block discarded – undo
295 295
         } else {
296 296
             $op = 'S';
297 297
         }
298
-        $MyArc = 4/3 * (sqrt(2) - 1);
299
-        $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k));
300
-        $xc = $x+$w-$r;
301
-        $yc = $y+$r;
302
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k));
303
-        if (strpos($corners, '2')===false) {
304
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k));
298
+        $MyArc = 4 / 3 * (sqrt(2) - 1);
299
+        $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k));
300
+        $xc = $x + $w - $r;
301
+        $yc = $y + $r;
302
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k));
303
+        if (strpos($corners, '2') === false) {
304
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k));
305 305
         } else {
306
-            $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
306
+            $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc);
307 307
         }
308
-        $xc = $x+$w-$r;
309
-        $yc = $y+$h-$r;
310
-        $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k));
311
-        if (strpos($corners, '3')===false) {
312
-            $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k));
308
+        $xc = $x + $w - $r;
309
+        $yc = $y + $h - $r;
310
+        $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k));
311
+        if (strpos($corners, '3') === false) {
312
+            $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k));
313 313
         } else {
314
-            $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
314
+            $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r);
315 315
         }
316
-        $xc = $x+$r;
317
-        $yc = $y+$h-$r;
318
-        $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k));
319
-        if (strpos($corners, '4')===false) {
320
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k));
316
+        $xc = $x + $r;
317
+        $yc = $y + $h - $r;
318
+        $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k));
319
+        if (strpos($corners, '4') === false) {
320
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k));
321 321
         } else {
322
-            $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
323
-        }
324
-        $xc = $x+$r ;
325
-        $yc = $y+$r;
326
-        $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k));
327
-        if (strpos($corners, '1')===false) {
328
-            $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k));
329
-            $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k));
322
+            $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc);
323
+        }
324
+        $xc = $x + $r;
325
+        $yc = $y + $r;
326
+        $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k));
327
+        if (strpos($corners, '1') === false) {
328
+            $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k));
329
+            $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k));
330 330
         } else {
331
-            $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
331
+            $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r);
332 332
         }
333 333
         $this->out($op);
334 334
     }
@@ -348,12 +348,12 @@  discard block
 block discarded – undo
348 348
         $this->out(
349 349
             sprintf(
350 350
                 '%.2F %.2F %.2F %.2F %.2F %.2F c ',
351
-                $x1*$this->k,
352
-                ($h-$y1)*$this->k,
353
-                $x2*$this->k,
354
-                ($h-$y2)*$this->k,
355
-                $x3*$this->k,
356
-                ($h-$y3)*$this->k
351
+                $x1 * $this->k,
352
+                ($h - $y1) * $this->k,
353
+                $x2 * $this->k,
354
+                ($h - $y2) * $this->k,
355
+                $x3 * $this->k,
356
+                ($h - $y3) * $this->k
357 357
             )
358 358
         );
359 359
     }
@@ -370,26 +370,26 @@  discard block
 block discarded – undo
370 370
     public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15)
371 371
     {
372 372
         $this->setLineWidth($width);
373
-        $longueur = abs($x1-$x2);
374
-        $hauteur = abs($y1-$y2);
373
+        $longueur = abs($x1 - $x2);
374
+        $hauteur = abs($y1 - $y2);
375 375
         if ($longueur > $hauteur) {
376
-            $Pointilles = ($longueur/$nb)/2;
376
+            $Pointilles = ($longueur / $nb) / 2;
377 377
         } else {
378
-            $Pointilles = ($hauteur/$nb)/2;
378
+            $Pointilles = ($hauteur / $nb) / 2;
379 379
         }
380
-        for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) {
381
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
382
-                if ($j<=($x2-1)) {
383
-                    $this->line($j, $y1, $j+1, $y1);
384
-                    $this->line($j, $y2, $j+1, $y2);
380
+        for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
381
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
382
+                if ($j <= ($x2 - 1)) {
383
+                    $this->line($j, $y1, $j + 1, $y1);
384
+                    $this->line($j, $y2, $j + 1, $y2);
385 385
                 }
386 386
             }
387 387
         }
388
-        for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) {
389
-            for ($j=$i; $j<=($i+$Pointilles); $j++) {
390
-                if ($j<=($y2-1)) {
391
-                    $this->line($x1, $j, $x1, $j+1);
392
-                    $this->line($x2, $j, $x2, $j+1);
388
+        for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
389
+            for ($j = $i; $j <= ($i + $Pointilles); $j++) {
390
+                if ($j <= ($y2 - 1)) {
391
+                    $this->line($x1, $j, $x1, $j + 1);
392
+                    $this->line($x2, $j, $x2, $j + 1);
393 393
                 }
394 394
             }
395 395
         }
@@ -410,16 +410,16 @@  discard block
 block discarded – undo
410 410
         $yi = $this->getY();
411 411
         $hrow = $this->fontSize;
412 412
         $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0);
413
-        $maxrows = floor($h/$this->fontSize);
413
+        $maxrows = floor($h / $this->fontSize);
414 414
         $rows = min($textrows, $maxrows);
415 415
         $dy = 0;
416 416
         if (strtoupper($valign) == 'M') {
417
-            $dy = ($h-$rows*$this->fontSize)/2;
417
+            $dy = ($h - $rows * $this->fontSize) / 2;
418 418
         }
419 419
         if (strtoupper($valign) == 'B') {
420
-            $dy = $h-$rows*$this->fontSize;
420
+            $dy = $h - $rows * $this->fontSize;
421 421
         }
422
-        $this->setY($yi+$dy);
422
+        $this->setY($yi + $dy);
423 423
         $this->setX($xi);
424 424
         $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1);
425 425
         if ($border) {
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
      */
442 442
     private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0)
443 443
     {
444
-        $cw =& $this->currentFont['cw'];
444
+        $cw = & $this->currentFont['cw'];
445 445
         if ($w == 0) {
446
-            $w = $this->w-$this->rMargin-$this->x;
446
+            $w = $this->w - $this->rMargin - $this->x;
447 447
         }
448
-        $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize;
448
+        $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize;
449 449
         $s = str_replace("\r", '', $txt);
450 450
         $nb = strlen($s);
451
-        if ($nb > 0 && $s[$nb-1] == "\n") {
451
+        if ($nb > 0 && $s[$nb - 1] == "\n") {
452 452
             $nb--;
453 453
         }
454
-        $b=0;
454
+        $b = 0;
455 455
         if ($border) {
456 456
             if ($border == 1) {
457 457
                 $border = 'LTRB';
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
                 if (is_int(strpos($border, 'R'))) {
466 466
                     $b2 .= 'R';
467 467
                 }
468
-                $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2;
468
+                $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2;
469 469
             }
470 470
         }
471 471
         $sep = -1;
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
                     }
485 485
                 }
486 486
                 if ($prn == 1) {
487
-                    $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
487
+                    $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
488 488
                 }
489 489
                 $i++;
490 490
                 $sep = -1;
@@ -518,19 +518,19 @@  discard block
 block discarded – undo
518 518
                         }
519 519
                     }
520 520
                     if ($prn == 1) {
521
-                        $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
521
+                        $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
522 522
                     }
523 523
                 } else {
524 524
                     if ($align == 'J') {
525
-                        $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
525
+                        $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0;
526 526
                         if ($prn == 1) {
527
-                            $this->out(sprintf('%.3F Tw', $this->ws*$this->k));
527
+                            $this->out(sprintf('%.3F Tw', $this->ws * $this->k));
528 528
                         }
529 529
                     }
530 530
                     if ($prn == 1) {
531
-                        $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill);
531
+                        $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill);
532 532
                     }
533
-                    $i = $sep+1;
533
+                    $i = $sep + 1;
534 534
                 }
535 535
                 $sep = -1;
536 536
                 $j = $i;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
             $b .= 'B';
558 558
         }
559 559
         if ($prn == 1) {
560
-            $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill);
560
+            $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill);
561 561
         }
562 562
         $this->x = $this->lMargin;
563 563
         return $nl;
@@ -586,27 +586,27 @@  discard block
 block discarded – undo
586 586
                 $wordwidth = $this->getStringWidth($word);
587 587
                 if ($wordwidth > $maxwidth) {
588 588
                     // Word is too long, we cut it
589
-                    for ($i=0; $i<strlen($word); $i++) {
589
+                    for ($i = 0; $i < strlen($word); $i++) {
590 590
                         $wordwidth = $this->getStringWidth(substr($word, $i, 1));
591 591
                         if ($width + $wordwidth <= $maxwidth) {
592 592
                             $width += $wordwidth;
593 593
                             $text .= substr($word, $i, 1);
594 594
                         } else {
595 595
                             $width = $wordwidth;
596
-                            $text = rtrim($text)."\n".substr($word, $i, 1);
596
+                            $text = rtrim($text) . "\n" . substr($word, $i, 1);
597 597
                             $count++;
598 598
                         }
599 599
                     }
600 600
                 } elseif ($width + $wordwidth <= $maxwidth) {
601 601
                     $width += $wordwidth + $space;
602
-                    $text .= $word.' ';
602
+                    $text .= $word . ' ';
603 603
                 } else {
604 604
                     $width = $wordwidth + $space;
605
-                    $text = rtrim($text)."\n".$word.' ';
605
+                    $text = rtrim($text) . "\n" . $word . ' ';
606 606
                     $count++;
607 607
                 }
608 608
             }
609
-            $text = rtrim($text)."\n";
609
+            $text = rtrim($text) . "\n";
610 610
             $count++;
611 611
         }
612 612
         $text = rtrim($text);
@@ -638,21 +638,21 @@  discard block
 block discarded – undo
638 638
         $scale = false,
639 639
         $force = true
640 640
     ) {
641
-        $str_width=$this->getStringWidth($txt);
641
+        $str_width = $this->getStringWidth($txt);
642 642
         if ($w == 0) {
643
-            $w = $this->w-$this->rMargin-$this->x;
643
+            $w = $this->w - $this->rMargin - $this->x;
644 644
         }
645
-        $ratio = ($w-$this->cMargin*2)/$str_width;
645
+        $ratio = ($w - $this->cMargin * 2) / $str_width;
646 646
         $fit = ($ratio < 1 || ($ratio > 1 && $force));
647 647
         if ($fit) {
648 648
             if ($scale) {
649 649
                 //Calcula a escala horizontal
650
-                $horiz_scale = $ratio*100.0;
650
+                $horiz_scale = $ratio * 100.0;
651 651
                 //Ajusta a escala horizontal
652 652
                 $this->out(sprintf('BT %.2F Tz ET', $horiz_scale));
653 653
             } else {
654 654
                 //Calcula o espaçamento de caracteres em pontos
655
-                $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k;
655
+                $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k;
656 656
                 //Ajusta o espaçamento de caracteres
657 657
                 $this->out(sprintf('BT %.2F Tc ET', $char_space));
658 658
             }
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
         $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link);
664 664
         //Reseta o espaçamento de caracteres e a escala horizontal
665 665
         if ($fit) {
666
-            $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET');
666
+            $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET');
667 667
         }
668 668
     }
669 669
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
             $len = 0;
759 759
             $nbbytes = strlen($s);
760 760
             for ($i = 0; $i < $nbbytes; $i++) {
761
-                if (ord($s[$i])<128) {
761
+                if (ord($s[$i]) < 128) {
762 762
                     $len++;
763 763
                 } else {
764 764
                     $len++;
@@ -784,11 +784,11 @@  discard block
 block discarded – undo
784 784
     {
785 785
         $this->setDrawColor(110);
786 786
         $this->setLineWidth($h);
787
-        $wDash = ($w/$n)/2;
788
-        for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) {
789
-            for ($j=$i; $j<= ($i+$wDash); $j++) {
790
-                if ($j <= ($x+$w-1)) {
791
-                    $this->line($j, $y, $j+1, $y);
787
+        $wDash = ($w / $n) / 2;
788
+        for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) {
789
+            for ($j = $i; $j <= ($i + $wDash); $j++) {
790
+                if ($j <= ($x + $w - 1)) {
791
+                    $this->line($j, $y, $j + 1, $y);
792 792
                 }
793 793
             }
794 794
         }
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
             $y = $aux;
814 814
         }
815 815
         while ($y < $yfinal && $n > 0) {
816
-            $this->line($x, $y, $x, $y+1);
816
+            $this->line($x, $y, $x, $y + 1);
817 817
             $y += 3;
818 818
             $n--;
819 819
         }
Please login to merge, or discard this patch.
src/NFe/Danfce.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,6 @@
 block discarded – undo
13 13
  * @link      http://github.com/nfephp-org/sped-da for the canonical source repository
14 14
  * @author    Roberto Spadim <roberto at spadim dot com dot br>
15 15
  */
16
-use Exception;
17 16
 use NFePHP\DA\Legacy\Dom;
18 17
 use NFePHP\DA\Legacy\Pdf;
19 18
 use NFePHP\DA\Legacy\Common;
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 {
25 25
     protected $papel;
26 26
     protected $xml; // string XML NFe
27
-    protected $logomarca=''; // path para logomarca em jpg
28
-    protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####";
29
-    protected $debugMode=0; //ativa ou desativa o modo de debug
27
+    protected $logomarca = ''; // path para logomarca em jpg
28
+    protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####";
29
+    protected $debugMode = 0; //ativa ou desativa o modo de debug
30 30
     protected $tpImp; //ambiente
31
-    protected $fontePadrao='Times';
31
+    protected $fontePadrao = 'Times';
32 32
     protected $nfeProc;
33 33
     protected $nfe;
34 34
     protected $infNFe;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $this->textoAdic = '';
254 254
         if (isset($this->infAdic)) {
255 255
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
256
-            'Inf. Contribuinte: '.
256
+            'Inf. Contribuinte: ' .
257 257
             trim($this->pAnfavea($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
258 258
             if (!empty($this->textoAdic)) {
259 259
                 $tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
             $orientacao = 'P';
270 270
         }
271 271
         $this->orientacao = $orientacao;
272
-        $this->papel = array(80,$tamPapelVert);
272
+        $this->papel = array(80, $tamPapelVert);
273 273
         $this->logoAlign = $logoAlign;
274 274
         //$this->situacao_externa = $situacaoExterna;
275 275
         $this->numero_registro_dpec = $depecNumReg;
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
         //total inicial de paginas
294 294
         $totPag = 1;
295 295
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
296
-        $this->wPrint = $maxW-($margEsq*2);
296
+        $this->wPrint = $maxW - ($margEsq * 2);
297 297
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
298 298
         //superior e inferior
299
-        $this->hPrint = $maxH-$margSup-$margInf;
299
+        $this->hPrint = $maxH - $margSup - $margInf;
300 300
         // estabelece contagem de paginas
301 301
         $this->pdf->aliasNbPages();
302 302
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -307,22 +307,22 @@  discard block
 block discarded – undo
307 307
         $this->pdf->setLineWidth(0.1); // define a largura da linha
308 308
         $this->pdf->setTextColor(0, 0, 0);
309 309
         $this->pTextBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
310
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
311
-        $hcabecalhoSecundario = 10;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
312
-        $hprodutos = $hLinha + ($qtdItens*$hMaxLinha) ;//box poduto
310
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
311
+        $hcabecalhoSecundario = 10; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
312
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
313 313
         $hTotal = 12; //box total (FIXO)
314
-        $hpagamentos = $hLinha + ($qtdPgto*$hLinha);//para pagamentos
315
-        $hmsgfiscal = 21;// para imposto (FIXO)
314
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha); //para pagamentos
315
+        $hmsgfiscal = 21; // para imposto (FIXO)
316 316
         if (!isset($this->dest)) {
317
-            $hcliente = 6;// para cliente (FIXO)
317
+            $hcliente = 6; // para cliente (FIXO)
318 318
         } else {
319 319
             $hcliente = 12;
320 320
         }// para cliente (FIXO)};
321
-        $hQRCode = 50;// para qrcode (FIXO)
322
-        $hCabecItens = 4;//cabeçalho dos itens
321
+        $hQRCode = 50; // para qrcode (FIXO)
322
+        $hCabecItens = 4; //cabeçalho dos itens
323 323
         
324 324
         $hUsado = $hCabecItens;
325
-        $w2 = round($this->wPrint*0.31, 0);
325
+        $w2 = round($this->wPrint * 0.31, 0);
326 326
         $totPag = 1;
327 327
         $pag = 1;
328 328
         $x = $xInic;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
343 343
         $y = $this->pPagamentosDANFE($x, $y, $hpagamentos);
344 344
         //COLOCA MENSAGEM FISCAL
345
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
345
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
346 346
         $y = $this->pFiscalDANFE($x, $y, $hmsgfiscal);
347 347
         //COLOCA CONSUMIDOR
348 348
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         }
361 361
         
362 362
         //retorna o ID na NFe
363
-        if ($classPdf!==false) {
363
+        if ($classPdf !== false) {
364 364
             $aR = [
365 365
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
366 366
              'classe_PDF'=>$this->pdf
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
         $emitIM     = $this->pSimpleGetValue($this->emit, "IM");
381 381
         $emitFone = $this->pSimpleGetValue($this->enderEmit, "fone");
382 382
         $foneLen = strlen($emitFone);
383
-        if ($foneLen>0) {
383
+        if ($foneLen > 0) {
384 384
             $ddd = substr($emitFone, 0, 2);
385 385
             $fone1 = substr($emitFone, -8);
386 386
             $digito9 = ' ';
387 387
             if ($foneLen == 11) {
388 388
                 $digito9 = substr($emitFone, 2, 1);
389 389
             }
390
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
390
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
391 391
         } else {
392 392
             $emitFone = '';
393 393
         }
@@ -401,18 +401,18 @@  discard block
 block discarded – undo
401 401
         // CONFIGURAÇÃO DE POSIÇÃO
402 402
         $margemInterna = $this->margemInterna;
403 403
         $maxW = $this->wPrint;
404
-        $h = $h-($margemInterna);
404
+        $h = $h - ($margemInterna);
405 405
         //COLOCA LOGOMARCA
406 406
         if (is_file($this->logomarca)) {
407 407
             $xImg = $margemInterna;
408 408
             $yImg = $margemInterna + 1;
409 409
             $this->pdf->Image($this->logomarca, $xImg, $yImg, 30, 22.5);
410
-            $xRs = ($maxW*0.4) + $margemInterna;
411
-            $wRs = ($maxW*0.6);
410
+            $xRs = ($maxW * 0.4) + $margemInterna;
411
+            $wRs = ($maxW * 0.6);
412 412
             $alignEmit = 'L';
413 413
         } else {
414 414
             $xRs = $margemInterna;
415
-            $wRs = ($maxW*1);
415
+            $wRs = ($maxW * 1);
416 416
             $alignEmit = 'L';
417 417
         }
418 418
         //COLOCA RAZÃO SOCIAL
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     {
433 433
         $margemInterna = $this->margemInterna;
434 434
         $maxW = $this->wPrint;
435
-        $w = ($maxW*1);
435
+        $w = ($maxW * 1);
436 436
         $hBox1 = 7;
437 437
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
438 438
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
         $margemInterna = $this->margemInterna;
450 450
         $maxW = $this->wPrint;
451 451
         $qtdItens = $this->det->length;
452
-        $w = ($maxW*1);
452
+        $w = ($maxW * 1);
453 453
         $hLinha = $this->hLinha;
454 454
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
455
-        $wBoxCod = $w*0.17;
455
+        $wBoxCod = $w * 0.17;
456 456
         $texto = "CÓDIGO";
457 457
         $this->pTextBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
458
-        $wBoxDescricao = $w*0.43;
458
+        $wBoxDescricao = $w * 0.43;
459 459
         $xBoxDescricao = $wBoxCod + $x;
460 460
         $texto = "DESCRICÃO";
461 461
         $this->pTextBox(
@@ -471,19 +471,19 @@  discard block
 block discarded – undo
471 471
             '',
472 472
             false
473 473
         );
474
-        $wBoxQt = $w*0.08;
474
+        $wBoxQt = $w * 0.08;
475 475
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
476 476
         $texto = "QT";
477 477
         $this->pTextBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
478
-        $wBoxUn = $w*0.06;
478
+        $wBoxUn = $w * 0.06;
479 479
         $xBoxUn = $wBoxQt + $xBoxQt;
480 480
         $texto = "UN";
481 481
         $this->pTextBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
482
-        $wBoxVl = $w*0.13;
482
+        $wBoxVl = $w * 0.13;
483 483
         $xBoxVl = $wBoxUn + $xBoxUn;
484 484
         $texto = "VALOR";
485 485
         $this->pTextBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
486
-        $wBoxTotal = $w*0.13;
486
+        $wBoxTotal = $w * 0.13;
487 487
         $xBoxTotal = $wBoxVl + $xBoxVl;
488 488
         $texto = "TOTAL";
489 489
         $this->pTextBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
                 $vUnCom     = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", ".");
504 504
                 $vProd      = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", ".");
505 505
                 //COLOCA PRODUTO
506
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
506
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
507 507
                 //COLOCA PRODUTO CÓDIGO
508
-                $wBoxCod = $w*0.17;
508
+                $wBoxCod = $w * 0.17;
509 509
                 $texto = $cProd;
510 510
                 $this->pTextBox($x, $yBoxProd, $wBoxCod, $hMaxLinha, $texto, $aFontProdutos, 'C', 'C', 0, '', false);
511 511
                 //COLOCA PRODUTO DESCRIÇÃO
512
-                $wBoxDescricao = $w*0.43;
512
+                $wBoxDescricao = $w * 0.43;
513 513
                 $xBoxDescricao = $wBoxCod + $x;
514 514
                 $texto = $xProd;
515 515
                 $this->pTextBox(
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                     false
527 527
                 );
528 528
                 //COLOCA PRODUTO QUANTIDADE
529
-                $wBoxQt = $w*0.08;
529
+                $wBoxQt = $w * 0.08;
530 530
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
531 531
                 $texto = $qCom;
532 532
                 $this->pTextBox(
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     false
544 544
                 );
545 545
                 //COLOCA PRODUTO UNIDADE
546
-                $wBoxUn = $w*0.06;
546
+                $wBoxUn = $w * 0.06;
547 547
                 $xBoxUn = $wBoxQt + $xBoxQt;
548 548
                 $texto = $uCom;
549 549
                 $this->pTextBox(
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                     false
561 561
                 );
562 562
                 //COLOCA PRODUTO VL UNITÁRIO
563
-                $wBoxVl = $w*0.13;
563
+                $wBoxVl = $w * 0.13;
564 564
                 $xBoxVl = $wBoxUn + $xBoxUn;
565 565
                 $texto = $vUnCom;
566 566
                 $this->pTextBox(
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
                     false
578 578
                 );
579 579
                 //COLOCA PRODUTO VL TOTAL
580
-                $wBoxTotal = $w*0.13;
580
+                $wBoxTotal = $w * 0.13;
581 581
                 $xBoxTotal = $wBoxVl + $xBoxVl;
582 582
                 $texto = $vProd;
583 583
                 $this->pTextBox(
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
         $margemInterna = $this->margemInterna;
605 605
         $maxW = $this->wPrint;
606 606
         $hLinha = 3;
607
-        $wColEsq = ($maxW*0.7);
608
-        $wColDir = ($maxW*0.3);
607
+        $wColEsq = ($maxW * 0.7);
608
+        $wColDir = ($maxW * 0.3);
609 609
         $xValor = $x + $wColEsq;
610 610
         $qtdItens = $this->det->length;
611 611
         $vProd = $this->pSimpleGetValue($this->ICMSTot, "vProd");
@@ -626,28 +626,28 @@  discard block
 block discarded – undo
626 626
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
627 627
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
628 628
         $this->pTextBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
629
-        $yDesconto = $y + ($hLinha*2);
629
+        $yDesconto = $y + ($hLinha * 2);
630 630
         $texto = "Descontos";
631 631
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
632 632
         $this->pTextBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
633 633
         $texto = "R$ " . $vDesc;
634 634
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
635 635
         $this->pTextBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
636
-        $yFrete= $y + ($hLinha*3);
636
+        $yFrete = $y + ($hLinha * 3);
637 637
         $texto = "Frete";
638 638
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
639 639
         $this->pTextBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
640 640
         $texto = "R$ " . $vFrete;
641 641
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
642 642
         $this->pTextBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
643
-        $yTotalFinal = $y + ($hLinha*4);
643
+        $yTotalFinal = $y + ($hLinha * 4);
644 644
         $texto = "Total";
645 645
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
646 646
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
647 647
         $texto = "R$ " . $vNF;
648 648
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
649 649
         $this->pTextBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
650
-        $yTotalFinal = $y + ($hLinha*5);
650
+        $yTotalFinal = $y + ($hLinha * 5);
651 651
         $texto = "Informação dos Tributos Totais Incidentes";
652 652
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
653 653
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -662,16 +662,16 @@  discard block
 block discarded – undo
662 662
         $margemInterna = $this->margemInterna;
663 663
         $maxW = $this->wPrint;
664 664
         $qtdPgto = $this->pag->length;
665
-        $w = ($maxW*1);
665
+        $w = ($maxW * 1);
666 666
         $hLinha = $this->hLinha;
667
-        $wColEsq = ($maxW*0.7);
668
-        $wColDir = ($maxW*0.3);
667
+        $wColEsq = ($maxW * 0.7);
668
+        $wColDir = ($maxW * 0.3);
669 669
         $xValor = $x + $wColEsq;
670 670
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
671
-        $wBoxEsq = $w*0.7;
671
+        $wBoxEsq = $w * 0.7;
672 672
         $texto = "FORMA DE PAGAMENTO";
673 673
         $this->pTextBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
674
-        $wBoxDir = $w*0.3;
674
+        $wBoxDir = $w * 0.3;
675 675
         $xBoxDescricao = $x + $wBoxEsq;
676 676
         $texto = "VALOR PAGO";
677 677
         $this->pTextBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                     $tBandNome = self::getCardName($tBand);
694 694
                 }
695 695
                 //COLOCA PRODUTO
696
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
696
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
697 697
                 //COLOCA PRODUTO CÓDIGO
698 698
                 $texto = $tPagNome;
699 699
                 $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
         $y += 6;
724 724
         $margemInterna = $this->margemInterna;
725 725
         $maxW = $this->wPrint;
726
-        $w = ($maxW*1);
726
+        $w = ($maxW * 1);
727 727
         $hLinha = $this->hLinha;
728 728
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
729 729
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
         $urlChave = $this->urlConsulta[$tpAmb][$this->UFSigla[$cUF]];
738 738
         $texto = "ÁREA DE MENSAGEM FISCAL";
739 739
         $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
740
-        $yTex1 = $y + ($hLinha*1);
741
-        $hTex1 = $hLinha*2;
742
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmi . " - Via Consumidor";
740
+        $yTex1 = $y + ($hLinha * 1);
741
+        $hTex1 = $hLinha * 2;
742
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmi . " - Via Consumidor";
743 743
         $this->pTextBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
744
-        $yTex2 = $y + ($hLinha*3);
745
-        $hTex2 = $hLinha*2;
744
+        $yTex2 = $y + ($hLinha * 3);
745
+        $hTex2 = $hLinha * 2;
746 746
         $texto = "Consulte pela Chave de Acesso em " . $urlChave;
747 747
         $this->pTextBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
748 748
         $texto = "CHAVE DE ACESSO";
749
-        $yTit2 = $y + ($hLinha*5);
749
+        $yTit2 = $y + ($hLinha * 5);
750 750
         $this->pTextBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
751
-        $yTex3 = $y + ($hLinha*6);
751
+        $yTex3 = $y + ($hLinha * 6);
752 752
         $texto = $chNFe;
753 753
         $this->pTextBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
754 754
     }
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
         $y += 6;
759 759
         $margemInterna = $this->margemInterna;
760 760
         $maxW = $this->wPrint;
761
-        $w = ($maxW*1);
761
+        $w = ($maxW * 1);
762 762
         $hLinha = $this->hLinha;
763 763
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
764 764
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
775 775
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
776 776
                     : '';
777
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
777
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
778 778
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
779 779
             $consNome = $this->pSimpleGetValue($this->dest, "xNome");
780 780
             $consLgr = $this->pSimpleGetValue($enderDest, "xLgr");
@@ -814,8 +814,8 @@  discard block
 block discarded – undo
814 814
             $yTex1 = $y + $hLinha;
815 815
             $texto = $consNome;
816 816
             if (!empty($consDoc)) {
817
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
818
-                $this->pTextBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
817
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
818
+                $this->pTextBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
819 819
             }
820 820
         } else {
821 821
             $yTex1 = $y + $hLinha;
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
         $y += 6;
830 830
         $margemInterna = $this->margemInterna;
831 831
         $maxW = $this->wPrint;
832
-        $w = ($maxW*1);
832
+        $w = ($maxW * 1);
833 833
         $hLinha = $this->hLinha;
834 834
         $hBoxLinha = $this->hBoxLinha;
835 835
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
         $nProt = '';
839 839
         if (isset($this->nfeProc)) {
840 840
             $nProt = $this->pSimpleGetValue($this->nfeProc, "nProt");
841
-            $dhRecbto  = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
841
+            $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
842 842
         }
843 843
         $barcode = new Barcode();
844 844
         $bobj = $barcode->getBarcodeObj(
@@ -852,14 +852,14 @@  discard block
 block discarded – undo
852 852
         $qrcode = $bobj->getPngData();
853 853
         $wQr = 50;
854 854
         $hQr = 50;
855
-        $yQr = ($y+$margemInterna);
856
-        $xQr = ($w/2) - ($wQr/2);
855
+        $yQr = ($y + $margemInterna);
856
+        $xQr = ($w / 2) - ($wQr / 2);
857 857
         // prepare a base64 encoded "data url"
858 858
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode);
859 859
         $info = getimagesize($pic);
860 860
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
861 861
         $dt = new DateTime($dhRecbto);
862
-        $yQr = ($yQr+$hQr+$margemInterna);
862
+        $yQr = ($yQr + $hQr + $margemInterna);
863 863
         $this->pTextBox($x, $yQr, $w, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
864 864
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
865 865
     }
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
         if ($startPos === false) {
944 944
             return $cdata;
945 945
         }
946
-        for ($x=$len; $x>0; $x--) {
946
+        for ($x = $len; $x > 0; $x--) {
947 947
             if (substr($cdata, $x, 1) == '>') {
948 948
                 $endPos = $x;
949 949
                 break;
@@ -954,15 +954,15 @@  discard block
 block discarded – undo
954 954
         } else {
955 955
             $parte1 = '';
956 956
         }
957
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
957
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
958 958
         if ($endPos < $len) {
959 959
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
960 960
         } else {
961 961
             $parte3 = '';
962 962
         }
963
-        $texto = trim($parte1).' '.trim($parte3);
963
+        $texto = trim($parte1) . ' ' . trim($parte3);
964 964
         if (strpos($parte2, '<CDATA>') === false) {
965
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
965
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
966 966
         } else {
967 967
             $cdata = $parte2;
968 968
         }
@@ -1034,15 +1034,15 @@  discard block
 block discarded – undo
1034 1034
         //grupo CADATA infCpl
1035 1035
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1036 1036
         $r = $dom->getElementsByTagName('receptor')->item(0);
1037
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1038
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1039
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1040
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1041
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1042
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1043
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1044
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1045
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1037
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1038
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1039
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1040
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1041
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1042
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1043
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1044
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1045
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1046 1046
         if (isset($t)) {
1047 1047
             if ($t->hasAttributes()) {
1048 1048
                 $texto .= " Transmissor ";
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
         $bin = "";
1160 1160
         $iCount = 0;
1161 1161
         do {
1162
-            $bin .= chr(hexdec($str{$iCount}.$str{($iCount + 1)}));
1162
+            $bin .= chr(hexdec($str{$iCount} . $str{($iCount + 1)}));
1163 1163
             $iCount += 2;
1164 1164
         } while ($iCount < strlen($str));
1165 1165
         return $bin;
@@ -1193,12 +1193,12 @@  discard block
 block discarded – undo
1193 1193
         $seq .= '&digVal=' . strtolower($digHex);
1194 1194
         $seq .= '&cIdToken=' . $idToken;
1195 1195
         //o hash code é calculado com o Token incluso
1196
-        $hash = sha1($seq.$token);
1197
-        $seq .= '&cHashQRCode='. strtoupper($hash);
1196
+        $hash = sha1($seq . $token);
1197
+        $seq .= '&cHashQRCode=' . strtoupper($hash);
1198 1198
         if (strpos($url, '?') === false) {
1199
-            $seq = $url.'?'.$seq;
1199
+            $seq = $url . '?' . $seq;
1200 1200
         } else {
1201
-            $seq = $url.''.$seq;
1201
+            $seq = $url . '' . $seq;
1202 1202
         }
1203 1203
         return $seq;
1204 1204
     }
Please login to merge, or discard this patch.