Documentation

ProcessHelper extends Helper
in package

The ProcessHelper class provides helpers to run external processes.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$helperSet  : mixed

Methods

formatMemory()  : mixed
formatTime()  : mixed
getHelperSet()  : HelperSet|null
Gets the helper set associated with this helper.
getName()  : string
Returns the canonical name of this helper.
mustRun()  : Process
Runs the process.
removeDecoration()  : mixed
run()  : Process
Runs an external process.
setHelperSet()  : mixed
Sets the helper set associated with this helper.
strlen()  : int
Returns the length of a string, using mb_strwidth if it is available.
strlenWithoutDecoration()  : mixed
substr()  : string
Returns the subset of a string, using mb_substr if it is available.
wrapCallback()  : callable
Wraps a Process callback to add debugging output.
escapeString()  : mixed

Properties

$helperSet

protected mixed $helperSet = null

Methods

formatMemory()

public static formatMemory(mixed $memory) : mixed
Parameters
$memory : mixed

formatTime()

public static formatTime(mixed $secs) : mixed
Parameters
$secs : mixed

getHelperSet()

Gets the helper set associated with this helper.

public getHelperSet() : HelperSet|null
Return values
HelperSet|null

getName()

Returns the canonical name of this helper.

public getName() : string
Return values
string

The canonical name

mustRun()

Runs the process.

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

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

Parameters
$output : OutputInterface

An OutputInterface instance

$cmd : string|Process

An instance of Process or a command to run

$error : string|null = null

An error message that must be displayed if something went wrong

$callback : callable|null = null

A PHP callback to run whenever there is some output available on STDOUT or STDERR

Tags
throws
ProcessFailedException
see
run()
Return values
Process

The process that ran

run()

Runs an external process.

public run(OutputInterface $output, string|array<string|int, mixed>|Process $cmd[, string|null $error = null ][, callable|null $callback = null ][, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE ]) : Process
Parameters
$output : OutputInterface

An OutputInterface instance

$cmd : string|array<string|int, mixed>|Process

An instance of Process or an array of arguments to escape and run or a command to run

$error : string|null = null

An error message that must be displayed if something went wrong

$callback : callable|null = null

A PHP callback to run whenever there is some output available on STDOUT or STDERR

$verbosity : int = OutputInterface::VERBOSITY_VERY_VERBOSE

The threshold for verbosity

Return values
Process

The process that ran

setHelperSet()

Sets the helper set associated with this helper.

public setHelperSet([HelperSet $helperSet = null ]) : mixed
Parameters
$helperSet : HelperSet = null

A HelperSet instance

strlen()

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

public static strlen(string $string) : int
Parameters
$string : string

The string to check its length

Return values
int

The length of the string

substr()

Returns the subset of a string, using mb_substr if it is available.

public static substr(string $string, int $from[, int|null $length = null ]) : string
Parameters
$string : string

String to subset

$from : int

Start offset

$length : int|null = null

Length to read

Return values
string

The string subset

wrapCallback()

Wraps a Process callback to add debugging output.

public wrapCallback(OutputInterface $output, Process $process[, callable|null $callback = null ]) : callable
Parameters
$output : OutputInterface

An OutputInterface interface

$process : Process

The Process

$callback : callable|null = null

A PHP callable

Return values
callable

escapeString()

private escapeString(mixed $str) : mixed
Parameters
$str : mixed

        
On this page

Search results