\Symfony\Component\Console\HelperProcessHelper

The ProcessHelper class provides helpers to run external processes.

Summary

Methods
Properties
Constants
setHelperSet()
getHelperSet()
strlen()
substr()
formatTime()
formatMemory()
strlenWithoutDecoration()
removeDecoration()
run()
mustRun()
wrapCallback()
getName()
No public properties found
No constants found
No protected methods found
$helperSet
N/A
escapeString()
No private properties found
N/A

Properties

$helperSet

$helperSet : 

Type

Methods

strlen()

strlen(string  $string) : integer

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

Parameters

string $string

The string to check its length

Returns

integer —

The length of the string

substr()

substr(string  $string, integer  $from, integer|null  $length = null) : string

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

Parameters

string $string

String to subset

integer $from

Start offset

integer|null $length

Length to read

Returns

string —

The string subset

formatTime()

formatTime(  $secs) 

Parameters

$secs

formatMemory()

formatMemory(  $memory) 

Parameters

$memory

run()

run(\Symfony\Component\Console\Output\OutputInterface  $output, string|array|\Symfony\Component\Process\Process  $cmd, string|null  $error = null, callable|null  $callback = null, integer  $verbosity = \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERY_VERBOSE) : \Symfony\Component\Process\Process

Runs an external process.

Parameters

\Symfony\Component\Console\Output\OutputInterface $output

An OutputInterface instance

string|array|\Symfony\Component\Process\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

integer $verbosity

The threshold for verbosity

Returns

\Symfony\Component\Process\Process —

The process that ran

mustRun()

mustRun(\Symfony\Component\Console\Output\OutputInterface  $output, string|\Symfony\Component\Process\Process  $cmd, string|null  $error = null, callable|null  $callback = null) : \Symfony\Component\Process\Process

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

\Symfony\Component\Console\Output\OutputInterface $output

An OutputInterface instance

string|\Symfony\Component\Process\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

Throws

\Symfony\Component\Process\Exception\ProcessFailedException

Returns

\Symfony\Component\Process\Process —

The process that ran

wrapCallback()

wrapCallback(\Symfony\Component\Console\Output\OutputInterface  $output, \Symfony\Component\Process\Process  $process, callable|null  $callback = null) : callable

Wraps a Process callback to add debugging output.

Parameters

\Symfony\Component\Console\Output\OutputInterface $output

An OutputInterface interface

\Symfony\Component\Process\Process $process

The Process

callable|null $callback

A PHP callable

Returns

callable

getName()

getName() 

{@inheritdoc}

escapeString()

escapeString(  $str) 

Parameters

$str