Completed
Push — master ( 7a3cb1...e42624 )
by Harry
9s
created

ProcessFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 32
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createProcess() 0 17 1
1
<?php
2
/**
3
 * This file is part of graze/data-file
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/data-file/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/data-file
12
 */
13
14
namespace Graze\DataFile\Helper\Process;
15
16
use Symfony\Component\Process\Exception\RuntimeException;
17
use Symfony\Component\Process\Process;
18
19
class ProcessFactory
20
{
21
    /**
22
     * @param string         $commandline The command line to run
23
     * @param string|null    $cwd         The working directory or null to use the working dir of the current PHP
24
     *                                    process
25
     * @param array|null     $env         The environment variables or null to inherit
26
     * @param string|null    $input       The input
27
     * @param int|float|null $timeout     The timeout in seconds or null to disable
28
     * @param array          $options     An array of options for proc_open
29
     *
30
     * @return Process
31
     * @throws RuntimeException When proc_open is not installed
32
     */
33 53
    public function createProcess(
34
        $commandline,
35
        $cwd = null,
36
        array $env = null,
37
        $input = null,
38
        $timeout = 60,
39
        array $options = []
40
    ) {
41 53
        return new Process(
42 53
            $commandline,
43 53
            $cwd,
44 53
            $env,
45 53
            $input,
46 53
            $timeout,
47
            $options
48 53
        );
49
    }
50
}
51