Pdfunite::unite()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Ottosmops\Pdfunite;
4
5
use Symfony\Component\Process\Process;
6
7
/*
8
 * Usage
9
 * Pdfunite::unite(['path_to_file1', 'path_to_file2'], $path_to_united_pdf);
10
 */
11
12
class Pdfunite
13
{
14 1
    public static function unite(array $srcfiles, string $resultfile)
15
    {
16 1
        $command = 'pdfunite ' . join(' ', $srcfiles) . ' '. $resultfile;
17 1
        $process = Process::fromShellCommandline($command);
18 1
        $process->run();
19
20 1
        return $process->getExitCode();
21
    }
22
23
}
24