Conditions | 4 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 4 | public function generate(): Fpdi |
|
15 | { |
||
16 | 4 | $templatePath = $this->sourceFileTemplatePath(); |
|
17 | |||
18 | 4 | $pdf = new Fpdi(); |
|
19 | |||
20 | 4 | $pagesCount = $templatePath ? $pdf->setSourceFile($templatePath) : 1; |
|
21 | |||
22 | 4 | for ($page = 1; $page <= $pagesCount; $page++) { |
|
23 | 4 | $pdf->AddPage('', [$this->templatePageWidth, $this->templatePageHeight]); |
|
24 | 4 | if ($templatePath) { |
|
25 | 4 | $tplId = $pdf->importPage($page); |
|
26 | 4 | $pdf->useTemplate($tplId, 0, 0, $this->templatePageWidth); |
|
27 | } |
||
28 | |||
29 | 4 | $pdf = $this->applyContent($pdf, $page); |
|
30 | } |
||
31 | |||
32 | 4 | return $pdf; |
|
33 | } |
||
42 |