\app\framework\Component\Console\InputInputDefinition

A InputDefinition represents a set of valid command line arguments and options.

Usage:

$definition = new InputDefinition(array(
  new InputArgument('name', InputArgument::REQUIRED),
  new InputOption('foo', 'f', InputOption::VALUE_REQUIRED),
));

Summary

Methods
Properties
Constants
__construct()
setDefinition()
setArguments()
addArguments()
addArgument()
getArgument()
hasArgument()
getArguments()
getArgumentCount()
getArgumentRequiredCount()
getArgumentDefaults()
setOptions()
getOption()
addOptions()
addOption()
hasOption()
getOptions()
getOptionDefaults()
hasShortcut()
getOptionForShortcut()
getSynopsis()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
shortcutToName()
$arguments
$hasAnArrayArgument
$hasOptional
$requiredCount
$options
$shortcuts
N/A

Properties

$arguments

$arguments : 

Type

$hasAnArrayArgument

$hasAnArrayArgument : 

Type

$hasOptional

$hasOptional : 

Type

$requiredCount

$requiredCount : 

Type

$options

$options : 

Type

$shortcuts

$shortcuts : 

Type

Methods

__construct()

__construct(array  $definition = array()) 

Parameters

array $definition

An array of InputArgument and InputOption instance

setDefinition()

setDefinition(array  $definition) 

Parameters

array $definition

setArguments()

setArguments(  $arguments = array()) 

Parameters

$arguments

addArguments()

addArguments(array<mixed,\app\framework\Component\Console\Input\InputArgument>  $arguments = array()) 

Adds an array of InputArguments object.

Parameters

array<mixed,\app\framework\Component\Console\Input\InputArgument> $arguments

An array of InputArguments objects

getArgument()

getArgument(string|integer  $name) : \app\framework\Component\Console\Input\InputArgument

Returns an InputArgument by name or by position.

Parameters

string|integer $name

The InputArgument name or position

Throws

\InvalidArgumentException

Returns

\app\framework\Component\Console\Input\InputArgument

hasArgument()

hasArgument(string|integer  $name) : boolean

Return true if an InputArgument exist by name or position.

Parameters

string|integer $name

The InputArgument name or position

Returns

boolean

getArgumentCount()

getArgumentCount() 

getArgumentRequiredCount()

getArgumentRequiredCount() : integer

Returns the number of InputArguments.

Returns

integer

getArgumentDefaults()

getArgumentDefaults() : array

Gets the default values.

Returns

array —

An array of default values

getOption()

getOption(  $name) 

Parameters

$name

hasOption()

hasOption(string  $name) : boolean

Returns true if an InputOption exists by name

This method can't be used to check if the user included the option when executing the command (use getOption() instead).

Parameters

string $name

The InputOption name

Returns

boolean —

true if the InputOption exists, false otherwise

getOptions()

getOptions() : mixed

Returns

mixed

getOptionDefaults()

getOptionDefaults() : array

Returns

array —

An array of all default values

hasShortcut()

hasShortcut(string  $name) : boolean

Returns true if an InputOption object exists by shortcut.

Parameters

string $name

The InputOption shortcut

Returns

boolean —

true if the InputOption object exists, false otherwise

getOptionForShortcut()

getOptionForShortcut(string  $shortcut) : \app\framework\Component\Console\Input\InputOption

Gets an InputOption by shortcut.

Parameters

string $shortcut

The Shortcut name

Returns

\app\framework\Component\Console\Input\InputOption

An InputOption object

getSynopsis()

getSynopsis(boolean  $short = false) : string

Gets the synopsis.

Parameters

boolean $short

Whether to return the short version (with options folded) or not

Returns

string —

The synopsis

shortcutToName()

shortcutToName(string  $shortcut) : string

Returns the InputOption name given a shortcut.

Parameters

string $shortcut

The shortcut

Throws

\InvalidArgumentException

When option given does not exist

Returns

string —

The InputOption name