PHP Class Yosymfony\Spress\Plugin\CommandDefinition

Author: Victor Puertas ([email protected])
显示文件 Open project: spress/spress Class Usage Examples

Public Methods

Method Description
__construct ( string $name ) Constructor.
addArgument ( string $name, integer $mode = null, string $description = '', mixed $default = null ) Adds a new command argument.
addOption ( string $name, string | array $shortcut = null, integer $mode = null, string $description = '', mixed $default = null ) Adds a new command option.
getArguments ( ) : array Gets the arguments registered.
getDescription ( ) : string Returns the description for the command.
getHelp ( ) : string Returns the help for the command.
getName ( ) : string Gets the name of the command.
getOptions ( ) : array Gets the options registered.
setDescription ( string $description ) : Command Sets the description for the command.
setHelp ( string $help ) : Command Sets the help for the command.

Method Details

__construct() public method

Constructor.
public __construct ( string $name )
$name string The name of the command. e.g: "update" or with namespace "theme:update"

addArgument() public method

Adds a new command argument.
public addArgument ( string $name, integer $mode = null, string $description = '', mixed $default = null )
$name string The argument name
$mode integer The argument mode: self::REQUIRED or self::OPTIONAL
$description string A description text
$default mixed The default value (for self::OPTIONAL mode only)

addOption() public method

Adds a new command option.
public addOption ( string $name, string | array $shortcut = null, integer $mode = null, string $description = '', mixed $default = null )
$name string The option name
$shortcut string | array The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
$mode integer The option mode: One of the VALUE_* constants
$description string A description text
$default mixed The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE)

getArguments() public method

Gets the arguments registered.
public getArguments ( ) : array
return array Each element is an array with the following signature: name, mode, description, default

getDescription() public method

Returns the description for the command.
public getDescription ( ) : string
return string The description for the command

getHelp() public method

Returns the help for the command.
public getHelp ( ) : string
return string The help for the command

getName() public method

Gets the name of the command.
public getName ( ) : string
return string

getOptions() public method

Gets the options registered.
public getOptions ( ) : array
return array Each element is an array with the following signature: name, shortcut, mode, description, default

setDescription() public method

Sets the description for the command.
public setDescription ( string $description ) : Command
$description string The description for the command
return Command The current instance

setHelp() public method

Sets the help for the command.
public setHelp ( string $help ) : Command
$help string The help for the command
return Command The current instance