ProcessBuilderInterface

Interface

Defines a fluent builder responsible for constructing process instances.

Description

Implementations MUST preserve the builder state consistently across chained calls and SHALL return a process configured according to all previously supplied arguments when build() is invoked.

Table of Contents

Methods

build()

Builds a process instance for the specified command.

 : Process
withArgument()

Adds an argument to the process being built.

 : self
Methods

build()

Public

Builds a process instance for the specified command.

public build( string|array<string|int, mixed>  $command) : Process

Description

Implementations MUST return a Process configured with the provided command and all arguments previously collected by the builder. The returned process SHOULD be ready for execution by the caller.

Parameters
$command : string|array<string|int, mixed>

Description

the base command that SHALL be used to create the process

Return values
Process

Description

the configured process instance

withArgument()

Public

Adds an argument to the process being built.

public withArgument( string  $argument[, string|null  $value = null]) : self

Description

Implementations MUST append or register the provided argument for later use when build() is called. When a non-empty value is provided, the implementation SHALL associate that value with the argument according to its command-building strategy.

Parameters
$argument : string

Description

the argument name or token that SHALL be added to the process definition

$value : string|null = null

Description

an optional value associated with the argument

Return values
self

Description

the current builder instance for fluent chaining