CommandArguments
trait CommandArguments (View source)
Use this to add arguments and options to the $arguments property.
Properties
protected string | $arguments |
Methods
Pass argument to executable. Its value will be automatically escaped.
Pass methods parameters as arguments to executable. Argument values are automatically escaped.
Pass the provided string in its raw (as provided) form as an argument to executable.
Escape the provided value, unless it contains only alphanumeric plus a few other basic characters.
Pass option to executable. Options are prefixed with --
, value can be provided in second parameter.
Pass multiple options to executable. The associative array contains
the key:value pairs that become --key value
, for each item in the array.
Pass an option with multiple values to executable. Value can be a string or array.
Details
$this
arg(string $arg)
Pass argument to executable. Its value will be automatically escaped.
$this
args(string|string[] $args)
Pass methods parameters as arguments to executable. Argument values are automatically escaped.
$this
rawArg(string $arg)
Pass the provided string in its raw (as provided) form as an argument to executable.
static string
escape(string $value)
Escape the provided value, unless it contains only alphanumeric plus a few other basic characters.
$this
option(string $option, string $value = null, string $separator = ' ')
Pass option to executable. Options are prefixed with --
, value can be provided in second parameter.
Option values are automatically escaped.
$this
options(array $options, string $separator = ' ')
Pass multiple options to executable. The associative array contains
the key:value pairs that become --key value
, for each item in the array.
Values are automatically escaped.
$this
optionList(string $option, string|array $value = array(), string $separator = ' ')
Pass an option with multiple values to executable. Value can be a string or array.
Option values are automatically escaped.