Builds immutable process definitions from a command and a collection of arguments.
Description
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.
Interfaces
Constants
Properties
Methods
Creates a new immutable process builder instance.
Builds a process instance for the specified command.
Returns the arguments currently collected by the builder.
Returns a new builder instance with an additional argument appended.
Creates a new immutable process builder instance.
public
__construct([
array<int, string>
$arguments = []]) : mixed
Description
The 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
$arguments
:
array<int, string>
=
[]
Description
the arguments already collected by the builder
Builds a process instance for the specified command.
public
build(
string|array<string|int, mixed>
$command) : Process
Description
The 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
$command
:
string|array<string|int, mixed>
Description
the base command used to initialize the process
Return values
Description
the configured process instance ready for execution
Returns the arguments currently collected by the builder.
public
getArguments() : array<int, string>
Description
The returned list SHALL preserve insertion order and MAY be used for inspection, debugging, or testing purposes.
Return values
Description
the collected process arguments
Returns a new builder instance with an additional argument appended.
public
withArgument(
string
$argument[,
string|null
$value = null]) : ProcessBuilderInterface
Description
When 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
$argument
:
string
Description
the argument name or token to append
$value
:
string|null
=
null
Description
the optional value associated with the argument
Return values
Description
a new builder instance containing the appended argument
private
prependLogoSuppressionArgument(
array<int, string>
$command) : array<int, string>
Parameters
$command
:
array<int, string>
Return values
private
shouldAddLogoSuppressionArgument(
array<int, string>
$command) : bool
Parameters
$command
:
array<int, string>