PHP Class TQ\Vcs\Cli\CallResult

Mostra file Open project: teqneers/php-stream-wrapper-for-git Class Usage Examples

Protected Properties

Property Type Description
$cliCall Call Reference to the call that resulted in this result
$hasStdErr boolean True if there is a stderr
$hasStdOut boolean True if there is a stdout
$returnCode integer The return code
$stdErr resource The stderr stream
$stdOut resource The stdout stream

Public Methods

Method Description
__construct ( Call $cliCall, resource $stdOut, resource $stdErr, integer $returnCode ) Creates a new result container for a CLI call
__destruct ( ) Destructor closes the result and the internal stream resources
assertSuccess ( string $message ) Checks if the CLI call has succeeded and throws an Exception otherwise
close ( ) Closes the call result and the internal stream resources
getCliCall ( ) : Call Returns the reference to the call that resulted in this result
getReturnCode ( ) : integer Returns the return code
getStdErr ( ) : string Returns the contents of stderr
getStdErrStream ( ) : resource Returns the stderr stream
getStdOut ( ) : string Returns the contents of stdout
getStdOutStream ( ) : resource Returns the stdout stream
hasStdErr ( ) : boolean Returns true if the call resulted in stderr to be populated
hasStdOut ( ) : boolean Returns true if the call resulted in stdout to be populated
throwIfError ( CallResult $result, string $message ) Checks if the CLI call has succeeded and throws an Exception otherwise

Method Details

__construct() public method

Creates a new result container for a CLI call
public __construct ( Call $cliCall, resource $stdOut, resource $stdErr, integer $returnCode )
$cliCall Call Reference to the call that resulted in this result
$stdOut resource The stdout stream
$stdErr resource The stderr stream
$returnCode integer The return code

__destruct() public method

Destructor closes the result and the internal stream resources
public __destruct ( )

assertSuccess() public method

Checks if the CLI call has succeeded and throws an Exception otherwise
public assertSuccess ( string $message )
$message string The exception message

close() public method

Prevents further usage
public close ( )

getCliCall() public method

Returns the reference to the call that resulted in this result
public getCliCall ( ) : Call
return Call

getReturnCode() public method

Returns the return code
public getReturnCode ( ) : integer
return integer

getStdErr() public method

Returns the contents of stderr
public getStdErr ( ) : string
return string

getStdErrStream() public method

Returns the stderr stream
public getStdErrStream ( ) : resource
return resource

getStdOut() public method

Returns the contents of stdout
public getStdOut ( ) : string
return string

getStdOutStream() public method

Returns the stdout stream
public getStdOutStream ( ) : resource
return resource

hasStdErr() public method

Returns true if the call resulted in stderr to be populated
public hasStdErr ( ) : boolean
return boolean

hasStdOut() public method

Returns true if the call resulted in stdout to be populated
public hasStdOut ( ) : boolean
return boolean

throwIfError() public static method

Checks if the CLI call has succeeded and throws an Exception otherwise
public static throwIfError ( CallResult $result, string $message )
$result CallResult The CLI result
$message string The exception message

Property Details

$cliCall protected_oe property

Reference to the call that resulted in this result
protected Call,TQ\Vcs\Cli $cliCall
return Call

$hasStdErr protected_oe property

True if there is a stderr
protected bool $hasStdErr
return boolean

$hasStdOut protected_oe property

True if there is a stdout
protected bool $hasStdOut
return boolean

$returnCode protected_oe property

The return code
protected int $returnCode
return integer

$stdErr protected_oe property

The stderr stream
protected resource $stdErr
return resource

$stdOut protected_oe property

The stdout stream
protected resource $stdOut
return resource