InteractsWithIO
trait InteractsWithIO
Properties
| protected Factory|null | $components | The console components factory. |
|
| protected InputInterface|null | $input | ||
| protected OutputStyle|null | $output | ||
| protected int | $verbosity | The default verbosity of output commands. |
|
| protected array | $verbosityMap | The mapping between human readable verbosity levels and Symfony's OutputInterface. |
Methods
Retrieve the command's input as a CommandInput instance or retrieve an input item.
Determine if the given argument is present.
Get the value of a command argument.
Get all of the arguments passed to the command.
Determine if the given option is present.
Get the value of a command option.
Get all of the options passed to the command.
Confirm a question with the user.
Prompt the user for input.
Prompt the user for input with auto completion.
Prompt the user for input with auto completion.
Prompt the user for input but hide the answer from the console.
Give the user a single choice from an array of answers.
Execute a given callback while advancing a progress bar.
Write a string as information output.
Write a string as standard output.
Write a string as comment output.
Write a string as question output.
Write a string as error output.
Write a string as warning output.
Write a string in an alert box.
Write a blank line.
Set the input interface implementation.
Get the output implementation.
Get the output component factory implementation.
Set the verbosity level.
Get the verbosity level in terms of Symfony's OutputInterface level.
Details
at line 53
mixed
input(string|null $key = null, mixed $default = null)
Retrieve the command's input as a CommandInput instance or retrieve an input item.
at line 63
bool
hasArgument(int|string $name)
Determine if the given argument is present.
at line 71
mixed
argument(string|null $key = null)
Get the value of a command argument.
at line 83
array
arguments()
Get all of the arguments passed to the command.
at line 91
bool
hasOption(string $name)
Determine if the given option is present.
at line 99
mixed
option(string|null $key = null)
Get the value of a command option.
at line 111
array
options()
Get all of the options passed to the command.
at line 119
bool
confirm(string $question, bool $default = false)
Confirm a question with the user.
at line 127
mixed
ask(string $question, string|null $default = null)
Prompt the user for input.
at line 135
mixed
anticipate(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
at line 143
mixed
askWithCompletion(string $question, iterable|callable $choices, string|null $default = null)
Prompt the user for input with auto completion.
at line 157
mixed
secret(string $question, bool $fallback = true)
Prompt the user for input but hide the answer from the console.
at line 169
array|string
choice(string $question, array $choices, int|string|null $default = null, int|null $attempts = null, bool $multiple = false)
Give the user a single choice from an array of answers.
at line 181
void
table(array $headers, array|Arrayable $rows, string|TableStyle $tableStyle = 'default', array $columnStyles = [])
Format input to textual table.
at line 201
mixed
withProgressBar(iterable|int $totalSteps, Closure $callback)
Execute a given callback while advancing a progress bar.
at line 231
void
info(string $string, int|string|null $verbosity = null)
Write a string as information output.
at line 239
void
line(string $string, string|null $style = null, int|string|null $verbosity = null)
Write a string as standard output.
at line 249
void
comment(string $string, int|string|null $verbosity = null)
Write a string as comment output.
at line 257
void
question(string $string, int|string|null $verbosity = null)
Write a string as question output.
at line 265
void
error(string $string, int|string|null $verbosity = null)
Write a string as error output.
at line 273
void
warn(string $string, int|string|null $verbosity = null)
Write a string as warning output.
at line 287
void
alert(string $string, int|string|null $verbosity = null)
Write a string in an alert box.
at line 301
InteractsWithIO
newLine(int $count = 1)
Write a blank line.
at line 311
void
setInput(InputInterface $input)
Set the input interface implementation.
at line 319
void
setOutput(OutputStyle $output)
Set the output interface implementation.
at line 327
OutputStyle|null
getOutput()
Get the output implementation.
at line 335
Factory|null
outputComponents()
Get the output component factory implementation.
at line 343
protected void
setVerbosity(int|string $level)
Set the verbosity level.
at line 351
protected int
parseVerbosity(int|string|null $level = null)
Get the verbosity level in terms of Symfony's OutputInterface level.