PHP Class Assetic\Util\Process

Author: Fabien Potencier ([email protected])
Show file Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
__construct ( string $commandline, string $cwd = null, array $env = null, string $stdin = null, integer $timeout = 60, array $options = [] ) Constructor.
addErrorOutput ( $line )
addOutput ( $line )
getCommandLine ( )
getEnv ( )
getErrorOutput ( ) : string Returns the error output of the process (STDERR).
getExitCode ( ) : integer Returns the exit code returned by the process.
getOptions ( )
getOutput ( ) : string Returns the output of the process (STDOUT).
getStdin ( )
getStopSignal ( ) : integer Returns the number of the signal that caused the child process to stop its execution
getTermSignal ( ) : integer Returns the number of the signal that caused the child process to terminate its execution.
getTimeout ( )
getWorkingDirectory ( )
hasBeenSignaled ( ) : boolean Returns true if the child process has been terminated by an uncaught signal.
hasBeenStopped ( ) : boolean Returns true if the child process has been stopped by a signal.
isSuccessful ( ) : boolean Checks if the process ended successfully.
run ( Closure | string | array $callback = null ) : integer Runs the process.
setCommandLine ( $commandline )
setEnv ( array $env )
setOptions ( array $options )
setStdin ( $stdin )
setTimeout ( $timeout )
setWorkingDirectory ( $cwd )

Method Details

__construct() public method

Constructor.
public __construct ( string $commandline, string $cwd = null, array $env = null, string $stdin = null, integer $timeout = 60, array $options = [] )
$commandline string The command line to run
$cwd string The working directory
$env array The environment variables
$stdin string The STDIN content
$timeout integer The timeout in seconds
$options array An array of options for proc_open

addErrorOutput() public method

public addErrorOutput ( $line )

addOutput() public method

public addOutput ( $line )

getCommandLine() public method

public getCommandLine ( )

getEnv() public method

public getEnv ( )

getErrorOutput() public method

This only returns the error output if you have not supplied a callback to the run() method.
public getErrorOutput ( ) : string
return string The process error output

getExitCode() public method

Returns the exit code returned by the process.
public getExitCode ( ) : integer
return integer The exit status code

getOptions() public method

public getOptions ( )

getOutput() public method

This only returns the output if you have not supplied a callback to the run() method.
public getOutput ( ) : string
return string The process output

getStdin() public method

public getStdin ( )

getStopSignal() public method

It is only meaningful if hasBeenStopped() returns true.
public getStopSignal ( ) : integer
return integer

getTermSignal() public method

It is only meaningful if hasBeenSignaled() returns true.
public getTermSignal ( ) : integer
return integer

getTimeout() public method

public getTimeout ( )

getWorkingDirectory() public method

public getWorkingDirectory ( )

hasBeenSignaled() public method

It always returns false on Windows.
public hasBeenSignaled ( ) : boolean
return boolean

hasBeenStopped() public method

It always returns false on Windows.
public hasBeenStopped ( ) : boolean
return boolean

isSuccessful() public method

Checks if the process ended successfully.
public isSuccessful ( ) : boolean
return boolean true if the process ended successfully, false otherwise

run() public method

The callback receives the type of output (out or err) and some bytes from the output in real-time. It allows to have feedback from the independent process during execution. The STDOUT and STDERR are also available after the process is finished via the getOutput() and getErrorOutput() methods.
public run ( Closure | string | array $callback = null ) : integer
$callback Closure | string | array A PHP callback to run whenever there is some output available on STDOUT or STDERR
return integer The exit status code

setCommandLine() public method

public setCommandLine ( $commandline )

setEnv() public method

public setEnv ( array $env )
$env array

setOptions() public method

public setOptions ( array $options )
$options array

setStdin() public method

public setStdin ( $stdin )

setTimeout() public method

public setTimeout ( $timeout )

setWorkingDirectory() public method

public setWorkingDirectory ( $cwd )