Completed
Push — master ( bdc37e...5a8dc8 )
by Daniel
10s
created

PdfInfo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createProcess() 0 8 1
1
<?php
2
/**
3
 * This file is part of the Ghostscript package
4
 *
5
 * @author Simon Schrape <[email protected]>
6
 */
7
8
namespace GravityMedia\Ghostscript\Device;
9
10
use GravityMedia\Ghostscript\Process\Arguments as ProcessArguments;
11
use Symfony\Component\Process\ProcessBuilder;
12
13
/**
14
 * The PDF info device class
15
 *
16
 * This class supports the pdf_info.ps script that is contained in Ghostscript toolbin
17
 * (http://svn.ghostscript.com/ghostscript/trunk/gs/toolbin/).
18
 *
19
 * @package GravityMedia\Ghostscript\Devices
20
 */
21
class PdfInfo extends NoDisplay
22
{
23
    private $pdfInfoPath;
24
25
    /**
26
     * Create null device object
27
     *
28
     * @param ProcessBuilder $builder
29
     * @param ProcessArguments $arguments
30
     * @param string $pdfInfoPath Path to toolbin/pdf_info.ps
31
     */
32
    public function __construct(ProcessBuilder $builder, ProcessArguments $arguments, $pdfInfoPath)
33
    {
34
        parent::__construct($builder, $arguments);
35
        $this->pdfInfoPath = $pdfInfoPath;
36
    }
37
38
    /**
39
     * @param string $inputFile Path to PDF file to be examined
40
     * @return \Symfony\Component\Process\Process
41
     */
42
    public function createProcess($inputFile = null)
43
    {
44
        // the PDF file to be examined must be provided as parameter -sFile=...
45
        $this->setStringParameter('File', $inputFile);
46
47
        // the pdf_info.ps script will be read as input to gs
48
        return parent::createProcess($this->pdfInfoPath);
49
    }
50
}
51