\Cake\ConsoleConsoleInputArgument

An object to represent a single argument used in the command line.

ConsoleOptionParser creates these when you use addArgument()

Summary

Methods
Properties
Constants
__construct()
name()
isEqualTo()
help()
usage()
isRequired()
validChoice()
xml()
No public properties found
No constants found
No protected methods found
$_name
$_help
$_required
$_choices
N/A
No private methods found
No private properties found
N/A

Properties

$_name

$_name : string

Name of the argument.

Type

string

$_help

$_help : string

Help string

Type

string

$_required

$_required : boolean

Is this option required?

Type

boolean

$_choices

$_choices : array

An array of valid choices for this argument.

Type

array

Methods

__construct()

__construct(string|array  $name, string  $help = '', boolean  $required = false, array  $choices = array()) 

Make a new Input Argument

Parameters

string|array $name

The long name of the option, or an array with all the properties.

string $help

The help text for this option

boolean $required

Whether this argument is required. Missing required args will trigger exceptions

array $choices

Valid choices for this option.

name()

name() : string

Get the value of the name attribute.

Returns

string —

Value of this->_name.

isEqualTo()

isEqualTo(\Cake\Console\ConsoleInputArgument  $argument) : boolean

Checks if this argument is equal to another argument.

Parameters

\Cake\Console\ConsoleInputArgument $argument

ConsoleInputArgument to compare to.

Returns

boolean

help()

help(integer  $width) : string

Generate the help for this argument.

Parameters

integer $width

The width to make the name of the option.

Returns

string

usage()

usage() : string

Get the usage value for this argument

Returns

string

isRequired()

isRequired() : boolean

Check if this argument is a required argument

Returns

boolean

validChoice()

validChoice(string  $value) : boolean

Check that $value is a valid choice for this argument.

Parameters

string $value

The choice to validate.

Throws

\Cake\Console\Exception\ConsoleException

Returns

boolean

xml()

xml(\SimpleXMLElement  $parent) : \SimpleXMLElement

Append this arguments XML representation to the passed in SimpleXml object.

Parameters

\SimpleXMLElement $parent

The parent element.

Returns

\SimpleXMLElement —

The parent with this argument appended.