Help
in package
Console help class
Tags
Table of Contents
Methods
- render() : string
- Render the help screen body for a set of commands
- buildHelpRow() : array<string|int, mixed>
- Build one command's row for the help screen, wrapping its help text if needed
- colorizeHelpName() : string
- Colorize a command name (and its sub-name, if space-separated) for the help screen
- colorizeHelpParams() : string
- Colorize a command's params for the help screen
- formatHelpLabel() : array<string|int, mixed>
- Format a registered command's name/params into a colorized help label
- matchesSubCommand() : bool
- Determine if a registered command belongs to the requested subcommand namespace
Methods
render()
Render the help screen body for a set of commands
public
render(array<string|int, mixed> $commands, bool $raw, string|null $subCommand, string $indent, int|null $wrap, array<string|int, mixed> $helpColors) : string
Parameters
- $commands : array<string|int, mixed>
- $raw : bool
- $subCommand : string|null
- $indent : string
- $wrap : int|null
- $helpColors : array<string|int, mixed>
Return values
stringbuildHelpRow()
Build one command's row for the help screen, wrapping its help text if needed
protected
buildHelpRow(CommandInterface $command, string $label, int $length, int $maxLength, bool $isLast, bool $wrapped, string $indent, int|null $wrap) : array<string|int, mixed>
Parameters
- $command : CommandInterface
- $label : string
- $length : int
- $maxLength : int
- $isLast : bool
- $wrapped : bool
- $indent : string
- $wrap : int|null
Return values
array<string|int, mixed>colorizeHelpName()
Colorize a command name (and its sub-name, if space-separated) for the help screen
protected
colorizeHelpName(string $name, bool $raw, array<string|int, mixed> $helpColors) : string
Parameters
- $name : string
- $raw : bool
- $helpColors : array<string|int, mixed>
Return values
stringcolorizeHelpParams()
Colorize a command's params for the help screen
protected
colorizeHelpParams(string $params, bool $raw, array<string|int, mixed> $helpColors) : string
Parameters
- $params : string
- $raw : bool
- $helpColors : array<string|int, mixed>
Return values
stringformatHelpLabel()
Format a registered command's name/params into a colorized help label
protected
formatHelpLabel(CommandInterface $command, bool $raw, array<string|int, mixed> $helpColors) : array<string|int, mixed>
Parameters
- $command : CommandInterface
- $raw : bool
- $helpColors : array<string|int, mixed>
Return values
array<string|int, mixed>matchesSubCommand()
Determine if a registered command belongs to the requested subcommand namespace
protected
matchesSubCommand(CommandInterface $command[, string|null $subCommand = null ]) : bool
Matches against the command's bare name with its registered script name (e.g. './app') stripped off first, rather than the raw display key, so a subcommand like 'db' or 'db:' correctly matches a command named 'db:migrate' without also matching an unrelated command registered under a script name that merely happens to start with the same letters (e.g. a script called 'dbapp'). Command naming conventions aren't assumed to use any particular delimiter (':', space, or otherwise) since the script name is stripped by exact, known value rather than guessed from string structure.
Parameters
- $command : CommandInterface
- $subCommand : string|null = null