AbstractCommand
class AbstractCommand implements ArrayAccess (View source)
Abstract Console class.
Methods
Console constructor.
Execute this command.
Method to get property Io
Get Parent Command.
Add an argument(sub command) setting.
Get argument by offset or return default.
Alias of addCommand if someone think child is more semantic.
Get a argument(command) by name path.
Get children array.
Batch set children (sub commands).
Add a option object to this command.
Add a option object to this command.
Get value from an option.
Get options as array.
Get option set object.
Get all options include global.
Batch add options to command.
set the option alias.
The command description getter.
The command description setter.
Console name getter.
Console name setter.
Console execute code getter.
Console execute code setter.
Get the application.
Get the help manual.
Sets the help manual
Get the usage.
Sets the usage to tell user how to use this command.
Render auto complete alternatives.
Write a string to standard output.
Write a string to standard error output.
Get a value from standard input.
Set child command, note the key is no use, we use command name as key.
Is a child exists?
Unset a child command.
Get a command by name.
Details
at line line 137
__construct(string $name = null, IOInterface $io = null, AbstractCommand $parent = null)
Console constructor.
at line line 162
mixed
execute()
Execute this command.
at line line 313
IOInterface
getIO()
Method to get property Io
at line line 325
AbstractCommand
setIO(IOInterface $io)
Method to set property io
at line line 341
AbstractCommand
setParent(AbstractCommand $parent = null)
Parent command setter.
at line line 355
AbstractCommand
getParent()
Get Parent Command.
at line line 373
AbstractCommand
addCommand(string|AbstractCommand $command, string $description = null, Option[] $options = array(), Closure $handler = null)
Add an argument(sub command) setting.
at line line 429
null|string
getArgument(int $offset, callable|mixed $default = null)
Get argument by offset or return default.
at line line 459
AbstractCommand
addChild(string|AbstractCommand $argument, string $description = null, Option[] $options = array(), Closure $handler = null)
Alias of addCommand if someone think child is more semantic.
at line line 473
AbstractCommand|null
getChild(string $path)
Get a argument(command) by name path.
at line line 501
array
getChildren()
Get children array.
at line line 515
AbstractCommand
setChildren(array $children)
Batch set children (sub commands).
at line line 539
Option
addOption(mixed $option, mixed $default = null, string $description = null)
Add a option object to this command.
at line line 572
Option
addGlobalOption(mixed $option, mixed $default = null, string $description = null)
Add a option object to this command.
at line line 611
mixed
getOption(string $name, string $default = null)
Get value from an option.
If the name not found, we use alias to find options.
at line line 675
array
getAllOptions()
Get all options include global.
at line line 689
AbstractCommand
setOptions(mixed $options)
Batch add options to command.
at line line 712
AbstractCommand
setOptionAliases(mixed $aliases, string $name, bool $global = false)
set the option alias.
at line line 733
string
getDescription()
The command description getter.
at line line 747
AbstractCommand
description(string $description)
The command description setter.
at line line 761
string
getName()
Console name getter.
at line line 775
AbstractCommand
setName(string $name)
Console name setter.
at line line 803
AbstractCommand
handler(callable $handler = null)
Console execute code setter.
at line line 831
AbstractCommand
setApplication(Console $application)
Set the application.
at line line 845
string
getHelp()
Get the help manual.
at line line 859
AbstractCommand
help(string $help)
Sets the help manual
at line line 873
string
getUsage()
Get the usage.
at line line 887
AbstractCommand
usage(string $usage)
Sets the usage to tell user how to use this command.
at line line 904
void
renderAlternatives(string $wrongName, CommandNotFoundException $exception)
Render auto complete alternatives.
at line line 1008
AbstractCommand
out(string $text = '', boolean $nl = true)
Write a string to standard output.
at line line 1030
AbstractCommand
err(string $text = '', boolean $nl = true)
Write a string to standard error output.
at line line 1046
string
in(string $question = '')
Get a value from standard input.
at line line 1066
void
offsetSet(mixed $offset, AbstractCommand $value)
Set child command, note the key is no use, we use command name as key.
at line line 1080
boolean
offsetExists(string $offset)
Is a child exists?
at line line 1094
void
offsetUnset(string $offset)
Unset a child command.
at line line 1108
AbstractCommand|null
offsetGet(string $offset)
Get a command by name.