Passed
Push — master ( a1e4cd...aeaa07 )
by Thiago
32s
created

Pdf   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 18
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
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
class Pdf
12
{
13
    /**
14
     * Wkhtmltopdf executable
15
     *
16
     * @const string
17
     */
18
    const PDF_TOOL = '/usr/local/bin/wkhtmltopdf';
19
20
    /**
21
     * @param string $content
22
     * @param string $outputFile
23
     */
24
    public static function convert($content, $outputFile)
25
    {
26
        if (is_file(static::PDF_TOOL) && is_executable(static::PDF_TOOL)) {
27
            $snappy = new Converter(static::PDF_TOOL);
28
            $snappy->generateFromHtml($content, str_replace('.HTML', '.PDF', $outputFile), [], true);
29
        }
30
    }
31
}