-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathSymfonyProcessLauncherFactory.php
More file actions
58 lines (52 loc) · 2.03 KB
/
SymfonyProcessLauncherFactory.php
File metadata and controls
58 lines (52 loc) · 2.03 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
* This file is part of the Webmozarts Console Parallelization package.
*
* (c) Webmozarts GmbH <office@webmozarts.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Webmozarts\Console\Parallelization\Process;
use Webmozarts\Console\Parallelization\Logger\Logger;
final readonly class SymfonyProcessLauncherFactory implements ProcessLauncherFactory
{
public function __construct(private SymfonyProcessFactory $processFactory)
{
}
/**
* @param list<string> $command
* @param array<string, string>|null $extraEnvironmentVariables
* @param positive-int $numberOfProcesses
* @param positive-int $segmentSize
* @param callable(positive-int|0, int|null, string, string): void $processOutput A PHP callback which is run whenever
* there is some output available on
* STDOUT or STDERR.
* @param callable(): void $tick
*/
public function create(
array $phpExecutable,
array $command,
string $workingDirectory,
?array $extraEnvironmentVariables,
int $numberOfProcesses,
int $segmentSize,
Logger $logger,
callable $processOutput,
callable $tick
): ProcessLauncher {
return new SymfonyProcessLauncher(
$phpExecutable,
$command,
$workingDirectory,
$extraEnvironmentVariables,
$numberOfProcesses,
$segmentSize,
$logger,
$processOutput,
$tick,
$this->processFactory,
);
}
}