-
Notifications
You must be signed in to change notification settings - Fork 7
/
ConfigHelper.php
34 lines (29 loc) · 921 Bytes
/
ConfigHelper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Padam87\RasterizeBundle;
use Symfony\Component\Process\InputStream;
use Symfony\Component\Process\Process;
class ConfigHelper
{
private array $config;
private string $projectDir;
public function __construct(string $projectDir, array $config)
{
$this->config = $config;
$this->projectDir = $projectDir;
}
public function buildProcess(InputStream $input, array $arguments = [], array $env = []): Process
{
return new Process(
array_merge(
[
$this->config['script']['callable'],
$this->projectDir . DIRECTORY_SEPARATOR . $this->config['script']['path']
],
array_values(array_merge($this->config['arguments'], $arguments))
),
null,
array_merge($this->config['env_vars'], $env),
$input
);
}
}