ProcessHelper
extends Helper
in package
The ProcessHelper class provides helpers to run external processes.
Tags
Table of Contents
Properties
- $helperSet : mixed
Methods
- formatMemory() : string
- formatTime() : string
- getHelperSet() : HelperSet|null
- Gets the helper set associated with this helper.
- getName() : string
- Returns the canonical name of this helper.
- length() : int
- Returns the length of a string, using mb_strlen if it is available.
- mustRun() : Process
- Runs the process.
- removeDecoration() : string
- run() : Process
- Runs an external process.
- setHelperSet() : void
- Sets the helper set associated with this helper.
- substr() : string
- Returns the subset of a string, using mb_substr if it is available.
- width() : int
- Returns the width of a string, using mb_strwidth if it is available.
- wrapCallback() : callable
- Wraps a Process callback to add debugging output.
- escapeString() : string
Properties
$helperSet
protected
mixed
$helperSet
Methods
formatMemory()
public
static formatMemory(int $memory) : string
Parameters
- $memory : int
Return values
stringformatTime()
public
static formatTime(int|float $secs[, int $precision = 1 ]) : string
Parameters
- $secs : int|float
- $precision : int = 1
Return values
stringgetHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet|null
Return values
HelperSet|nullgetName()
Returns the canonical name of this helper.
public
getName() : string
Return values
stringlength()
Returns the length of a string, using mb_strlen if it is available.
public
static length(string|null $string) : int
The length is related to how many bytes the string will use.
Parameters
- $string : string|null
Return values
intmustRun()
Runs the process.
public
mustRun(OutputInterface $output, array<string|int, mixed>|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
- $cmd : array<string|int, mixed>|Process
-
An instance of Process or a command to run
- $error : string|null = null
- $callback : callable|null = null
-
A PHP callback to run whenever there is some output available on STDOUT or STDERR
Tags
Return values
ProcessremoveDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, string|null $string) : string
Parameters
- $formatter : OutputFormatterInterface
- $string : string|null
Return values
stringrun()
Runs an external process.
public
run(OutputInterface $output, array<string|int, mixed>|Process $cmd[, string|null $error = null ][, callable|null $callback = null ][, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE ]) : Process
Parameters
- $output : OutputInterface
- $cmd : array<string|int, mixed>|Process
-
An instance of Process or an array of the command and arguments
- $error : string|null = null
- $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
Return values
ProcesssetHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet|null $helperSet = null ]) : void
Parameters
- $helperSet : HelperSet|null = null
substr()
Returns the subset of a string, using mb_substr if it is available.
public
static substr(string|null $string, int $from[, int|null $length = null ]) : string
Parameters
- $string : string|null
- $from : int
- $length : int|null = null
Return values
stringwidth()
Returns the width of a string, using mb_strwidth if it is available.
public
static width(string|null $string) : int
The width is how many characters positions the string will use.
Parameters
- $string : string|null
Return values
intwrapCallback()
Wraps a Process callback to add debugging output.
public
wrapCallback(OutputInterface $output, Process $process[, callable|null $callback = null ]) : callable
Parameters
- $output : OutputInterface
- $process : Process
- $callback : callable|null = null
Return values
callableescapeString()
private
escapeString(string $str) : string
Parameters
- $str : string