-
-
Notifications
You must be signed in to change notification settings - Fork 0
ProcessBuilder
Builds immutable process definitions from a command and a collection of arguments.
This builder SHALL preserve previously supplied arguments by returning a new instance on each mutation-like operation. Implementations of this concrete builder MUST keep argument ordering stable so that the generated process reflects the exact sequence in which arguments were provided.
- Full name:
\FastForward\DevTools\Process\ProcessBuilder - This class is marked as final and can't be subclassed
- This class implements:
\FastForward\DevTools\Process\ProcessBuilderInterface - This class is a Final class
Creates a new immutable process builder instance.
public __construct(list<string> $arguments = []): mixedThe provided arguments SHALL be stored in the same order in which they are received and MUST be used when building the final process instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$arguments |
list | the arguments already collected by the builder |
Returns a new builder instance with an additional argument appended.
public withArgument(string $argument, string|null $value = null): \FastForward\DevTools\Process\ProcessBuilderInterfaceWhen a value is provided, the argument SHALL be normalized to the "{argument}={value}" format before being appended. When no value is provided, the raw argument token MUST be appended as-is.
This method MUST NOT mutate the current builder instance and SHALL return a new instance containing the accumulated arguments.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$argument |
string | the argument name or token to append |
$value |
string|null | the optional value associated with the argument |
Return Value:
a new builder instance containing the appended argument
Returns the arguments currently collected by the builder.
public getArguments(): list<string>The returned list SHALL preserve insertion order and MAY be used for inspection, debugging, or testing purposes.
Return Value:
the collected process arguments
Builds a process instance for the specified command.
public build(string $command): \Symfony\Component\Process\ProcessThe command string SHALL be split into tokens using a space separator and combined with all previously collected builder arguments. The resulting process MUST preserve the final token order exactly as assembled by this method.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$command |
string | the base command used to initialize the process |
Return Value:
the configured process instance ready for execution