class ProcessHelper extends Helper

The ProcessHelper class provides helpers to run external processes.

Properties

protected $helperSet from Helper

Methods

setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

from Helper
getHelperSet()

Gets the helper set associated with this helper.

from Helper
static int
strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

from Helper
static 
formatTime($secs)

No description

from Helper
static 
formatMemory($memory)

No description

from Helper
static 
strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

No description

from Helper
static 
removeDecoration(OutputFormatterInterface $formatter, $string)

No description

from Helper
run(OutputInterface $output, string|array|Process $cmd, string|null $error = null, callable|null $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)

Runs an external process.

mustRun(OutputInterface $output, string|Process $cmd, string|null $error = null, callable|null $callback = null)

Runs the process.

callable
wrapCallback(OutputInterface $output, Process $process, callable|null $callback = null)

Wraps a Process callback to add debugging output.

escapeString($str)

This method is public for PHP 5.3 compatibility, it should be private.

string
getName()

Returns the canonical name of this helper.

Details

in Helper at line 28
setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

Parameters

HelperSet $helperSet

in Helper at line 36
HelperSet getHelperSet()

Gets the helper set associated with this helper.

Return Value

HelperSet A HelperSet instance

in Helper at line 48
static int strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

Parameters

string $string The string to check its length

Return Value

int The length of the string

in Helper at line 57
static formatTime($secs)

Parameters

$secs

in Helper at line 86
static formatMemory($memory)

Parameters

$memory

in Helper at line 103
static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

in Helper at line 108
static removeDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

at line 39
Process run(OutputInterface $output, string|array|Process $cmd, string|null $error = null, callable|null $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)

Runs an external process.

Parameters

OutputInterface $output An OutputInterface instance
string|array|Process $cmd An instance of Process or an array of arguments to escape and run or a command to run
string|null $error An error message that must be displayed if something went wrong
callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR
int $verbosity The threshold for verbosity

Return Value

Process The process that ran

at line 95
Process mustRun(OutputInterface $output, string|Process $cmd, string|null $error = null, callable|null $callback = null)

Runs the process.

This is identical to run() except that an exception is thrown if the process exits with a non-zero exit code.

Parameters

OutputInterface $output An OutputInterface instance
string|Process $cmd An instance of Process or a command to run
string|null $error An error message that must be displayed if something went wrong
callable|null $callback A PHP callback to run whenever there is some output available on STDOUT or STDERR

Return Value

Process The process that ran

Exceptions

ProcessFailedException

See also

run()

at line 115
callable wrapCallback(OutputInterface $output, Process $process, callable|null $callback = null)

Wraps a Process callback to add debugging output.

Parameters

OutputInterface $output An OutputInterface interface
Process $process The Process
callable|null $callback A PHP callable

Return Value

callable

at line 139
escapeString($str)

This method is public for PHP 5.3 compatibility, it should be private.

Parameters

$str

at line 147
string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name