Completed
Push — master ( 2b4b54...68f327 )
by Daniel
04:56
created

PdfInfo   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 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\Ghostscript;
11
use GravityMedia\Ghostscript\Process\Arguments;
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
 *
18
 * @link    http://svn.ghostscript.com/ghostscript/trunk/gs/toolbin/
19
 *
20
 * @package GravityMedia\Ghostscript\Devices
21
 */
22
class PdfInfo extends NoDisplay
23
{
24
    /**
25
     * The PDF info path
26
     *
27
     * @var string
28
     */
29
    private $pdfInfoPath;
30
31
    /**
32
     * Create PDF info device object
33
     *
34
     * @param Ghostscript $ghostscript
35
     * @param Arguments   $arguments
36
     * @param string      $pdfInfoPath Path to toolbin/pdf_info.ps
37
     */
38 4
    public function __construct(Ghostscript $ghostscript, Arguments $arguments, $pdfInfoPath)
39
    {
40 4
        parent::__construct($ghostscript, $arguments);
41
42 4
        $this->pdfInfoPath = $pdfInfoPath;
43 4
    }
44
45
    /**
46
     * @param string $inputFile Path to PDF file to be examined
47
     *
48
     * @return \Symfony\Component\Process\Process
49
     */
50 2
    public function createProcess($inputFile = null)
51
    {
52
        // the PDF file to be examined must be provided as parameter -sFile=...
53 2
        $this->setArgument(sprintf('-sFile=%s', $inputFile));
54
55
        // the pdf_info.ps script will be read as input to gs
56 2
        return parent::createProcess($this->pdfInfoPath);
57
    }
58
}
59