Pdf   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 18
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A convert() 0 5 3
1
<?php
2
namespace MrPrompt\BoletoCaixaEconomicaFederal\Converter;
3
4
use Knp\Snappy\Pdf as Converter;
5
6
/**
7
 * PDF Converter
8
 *
9
 * @author Thiago Paes <[email protected]>
10
 *
11
 * @codeCoverageIgnore
12
 */
13
class Pdf
14
{
15
    /**
16
     * Wkhtmltopdf executable
17
     *
18
     * @const string
19
     */
20
    const PDF_TOOL = '/usr/local/bin/wkhtmltopdf';
21
22
    /**
23
     * @param string $content
24
     * @param string $outputFile
25
     */
26
    public static function convert($content, $outputFile)
27
    {
28
        if (is_file(static::PDF_TOOL) && is_executable(static::PDF_TOOL)) {
29
            $snappy = new Converter(static::PDF_TOOL);
30
            $snappy->generateFromHtml($content, str_replace('.HTML', '.PDF', $outputFile), [], true);
31
        }
32
    }
33
}