Code Duplication    Length = 18-18 lines in 2 locations

lib/PDF.php 2 locations

@@ 359-376 (lines=18) @@
356
            $this->SetX($x);
357
            $y_0 = $this->GetY();
358
            $y_s = [];
359
            foreach($headers as $i => $header) {
360
                $x_0 = $this->GetX();
361
                $this->SetXY($x_0, $y_0);
362
                $aux = explode("\n", $row[$i]);
363
                $value1 = $aux[0];
364
                $value2 = isset($aux[1]) ? $aux[1] : null;
365
                $y_1 = $this->MultiCell($options['width'][$i], $options['height'], $value1, $options['tdborder'], $options['align'][$i], false, 0);
366
                if ($value2) {
367
                    $this->Ln();
368
                    $this->SetX($x_0);
369
                    $this->SetFont($this->defaultOptions['font']['family'], '',  $options['fontsize']-2);
370
                    $y_2 = $this->MultiCell($options['width'][$i], $options['height'], $value2, $options['tdborder'], $options['align'][$i], false, 0);
371
                    $this->SetFont($this->defaultOptions['font']['family'], '',  $options['fontsize']);
372
                    $y_s[] = $y_1 + $y_2*0.9;
373
                } else {
374
                    $y_s[] = $y_1;
375
                }
376
            }
377
            $this->Ln(max($y_s)*5);
378
            // si se pasó a página siguiente se hace rollback y se crea nueva página con cabecera nuevamente en la tabla
379
            if($num_pages < $this->getNumPages()) {
@@ 390-407 (lines=18) @@
387
                $this->SetX($x);
388
                $y_0 = $this->GetY();
389
                $y_s = [];
390
                foreach($headers as $i => $header) {
391
                    $x_0 = $this->GetX();
392
                    $this->SetXY($x_0, $y_0);
393
                    $aux = explode("\n", $row[$i]);
394
                    $value1 = $aux[0];
395
                    $value2 = isset($aux[1]) ? $aux[1] : null;
396
                    $y_1 = $this->MultiCell($options['width'][$i], $options['height'], $value1, $options['tdborder'], $options['align'][$i], false, 0);
397
                    if ($value2) {
398
                        $this->Ln();
399
                        $this->SetX($x_0);
400
                        $this->SetFont($this->defaultOptions['font']['family'], '',  $options['fontsize']-2);
401
                        $y_2 = $this->MultiCell($options['width'][$i], $options['height'], $value2, $options['tdborder'], $options['align'][$i], false, 0);
402
                        $this->SetFont($this->defaultOptions['font']['family'], '',  $options['fontsize']);
403
                        $y_s[] = $y_1 + $y_2*0.9;
404
                    } else {
405
                        $y_s[] = $y_1;
406
                    }
407
                }
408
                $this->Ln(max($y_s)*5);
409
            } else {
410
                $this->commitTransaction();