Conditions | 3 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3.7085 |
Changes | 0 |
1 | <?php |
||
16 | public static function run(Process $process, $timeout = null, callable $callback = null, array $env = []): Process |
||
17 | 14 | { |
|
18 | if (method_exists($process, 'inheritEnvironmentVariables')) { |
||
19 | // Symfony 3.2+ |
||
20 | $process->inheritEnvironmentVariables(true); |
||
21 | } else { |
||
22 | 14 | // Symfony < 3.2 |
|
23 | $process->setEnv(['LANG' => getenv('LANG')]); |
||
24 | } |
||
25 | 14 | $process->setTimeout($timeout); |
|
26 | |||
27 | try { |
||
28 | $process->mustRun($callback, $env); |
||
29 | } catch (ExceptionInterface $e) { |
||
30 | 14 | throw new ProcessFailedException($process, $e); |
|
31 | } |
||
32 | |||
33 | return $process; |
||
34 | } |
||
36 |