ConsoleInputSubcommand
in package
An object to represent a single subcommand used in the command line.
Created when you call ConsoleOptionParser::addSubcommand()
Tags
Table of Contents
Properties
- $_help : string
- Help string for the subcommand
- $_name : string
- Name of the subcommand
- $_parser : ConsoleOptionParser|null
- The ConsoleOptionParser for this subcommand.
Methods
- __construct() : mixed
- Make a new Subcommand
- getRawHelp() : string
- Get the raw help string for this command
- help() : string
- Generate the help for this this subcommand.
- name() : string
- Get the value of the name attribute.
- parser() : ConsoleOptionParser|null
- Get the usage value for this option
- xml() : SimpleXMLElement
- Append this subcommand to the Parent element
Properties
$_help
Help string for the subcommand
protected
string
$_help
= ''
$_name
Name of the subcommand
protected
string
$_name
= ''
$_parser
The ConsoleOptionParser for this subcommand.
protected
ConsoleOptionParser|null
$_parser
Methods
__construct()
Make a new Subcommand
public
__construct(array<string, mixed>|string $name[, string $help = '' ][, ConsoleOptionParser|array<string, mixed>|null $parser = null ]) : mixed
Parameters
- $name : array<string, mixed>|string
-
The long name of the subcommand, or an array with all the properties.
- $help : string = ''
-
The help text for this option.
- $parser : ConsoleOptionParser|array<string, mixed>|null = null
-
A parser for this subcommand. Either a ConsoleOptionParser, or an array that can be used with ConsoleOptionParser::buildFromArray().
getRawHelp()
Get the raw help string for this command
public
getRawHelp() : string
Return values
stringhelp()
Generate the help for this this subcommand.
public
help([int $width = 0 ]) : string
Parameters
- $width : int = 0
-
The width to make the name of the subcommand.
Return values
stringname()
Get the value of the name attribute.
public
name() : string
Return values
string —Value of this->_name.
parser()
Get the usage value for this option
public
parser() : ConsoleOptionParser|null
Return values
ConsoleOptionParser|nullxml()
Append this subcommand to the Parent element
public
xml(SimpleXMLElement $parent) : SimpleXMLElement
Parameters
- $parent : SimpleXMLElement
-
The parent element.
Return values
SimpleXMLElement —The parent with this subcommand appended.