PDFRenderer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 45
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B render() 0 42 1
1
<?php
2
3
namespace raphiz\passwordcards;
4
5
class PDFRenderer
6
{
7
    public static function render($front, $back)
8
    {
9
        // create new PDF document
10
        $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);
11
12
        // set document information
13
        $pdf->SetAuthor('Raphael Zimmermann');
14
        $pdf->SetTitle('Password Card');
15
        $pdf->SetSubject('Password Card');
16
17
        $pdf->SetPrintHeader(false);
18
        $pdf->SetPrintFooter(false);
19
20
        // add a page
21
        $pdf->AddPage();
22
23
        // Mark the position to fold...
24
        $pdf->Line(95, 10, 95, 13);
25
        $pdf->Line(95, 72, 95, 75);
26
27
        // Add the front svg
28
        $pdf->ImageSVG(
29
            $front, // filename
30
            10, // x
31
            15, // y
32
            '85', // width
33
            '55' // height
34
        );
35
36
        // Add the back svg
37
        $pdf->ImageSVG(
38
            $back, // filename
39
            95, // x
40
            15, // y
41
            '85', // width
42
            '55' // height
43
        );
44
45
46
        //Close and output PDF document
47
        return $pdf->Output('generated.pdf', 'S');
48
    }
49
}
50