PHP Class Jyxo\Shell\Client

Author: Ondřej Procházka
Author: Matěj Humpál
Afficher le fichier Open project: jyxo/php

Protected Properties

Свойство Type Description
$cwd string Actual working directory.
$env array Environment properties.
$error string Stderr output.
$out string Stdout output.
$processList array List of running processes.

Méthodes publiques

Méthode Description
__construct ( string $cwd = '', array $env = [] ) Constructor.
clearEnv ( ) : Client Removes environment properties.
exec ( string $cmd, integer &$status = null ) : Client Executes an external command.
getError ( ) : string Returns stderr contents.
getOut ( ) : string Returns stdout contents.
killProcess ( string $name ) : self Kills all processes of the given name.
loadProcessList ( ) : self Returns a list of processes.
processExists ( string $name ) : boolean Checks if there is a process of the given name.
setCwd ( string $cwd = '' ) : Client Sets working directory.
setEnv ( array $env ) : Client Adds one or more environment properties.

Method Details

__construct() public méthode

Constructor.
public __construct ( string $cwd = '', array $env = [] )
$cwd string Working directory
$env array Array of environment properties

clearEnv() public méthode

Removes environment properties.
public clearEnv ( ) : Client
Résultat Client

exec() public méthode

Captures stdout and stderr. Throws an exception on status code != 0.
public exec ( string $cmd, integer &$status = null ) : Client
$cmd string Command to execute
$status integer Status code
Résultat Client

getError() public méthode

Returns stderr contents.
public getError ( ) : string
Résultat string

getOut() public méthode

Returns stdout contents.
public getOut ( ) : string
Résultat string

killProcess() public méthode

Works only on Linux.
public killProcess ( string $name ) : self
$name string Process name
Résultat self

loadProcessList() public méthode

Works only on Linux.
public loadProcessList ( ) : self
Résultat self

processExists() public méthode

Works only on Linux.
public processExists ( string $name ) : boolean
$name string Process name
Résultat boolean

setCwd() public méthode

Defaults to null.
public setCwd ( string $cwd = '' ) : Client
$cwd string Working directory
Résultat Client

setEnv() public méthode

Adds one or more environment properties.
public setEnv ( array $env ) : Client
$env array Array of properties
Résultat Client

Property Details

$cwd protected_oe property

Actual working directory.
protected string $cwd
Résultat string

$env protected_oe property

Environment properties.
protected array $env
Résultat array

$error protected_oe property

Stderr output.
protected string $error
Résultat string

$out protected_oe property

Stdout output.
protected string $out
Résultat string

$processList protected_oe property

List of running processes.
protected array $processList
Résultat array