PHP Class yii2tech\selfupdate\Shell

See also: ShellResult
Since: 1.0
Author: Paul Klimov ([email protected])
ファイルを表示 Open project: yii2tech/selfupdate Class Usage Examples

Public Methods

Method Description
buildOptions ( array $options ) : string Builds shell command options string from array.
execute ( string $command, array $placeholders = [] ) : ShellResult Executes shell command.

Private Methods

Method Description
normalizeOptionName ( string $name ) : string Normalizes shell command option name, adding leading - if necessary.

Method Details

buildOptions() public static method

Option, which does not use any value should be specified as an array value, option with value should be specified as key-value pair, where key is an option name and value - option value. Option name will be automatically prefixed with -- in case it has not already. For example: php [ 'verbose', 'username' => 'root' ]
Since: 1.0.2
public static buildOptions ( array $options ) : string
$options array options specification.
return string options string.

execute() public static method

Executes shell command.
public static execute ( string $command, array $placeholders = [] ) : ShellResult
$command string command to be executed.
$placeholders array placeholders to be replaced using `escapeshellarg()` in format: placeholder => value.
return ShellResult execution result.