ConsoleOutput
class ConsoleOutput (View source)
A wrapper for Symfony ConsoleOutput and related helpers
Properties
protected ConsoleOutput | $output | ||
protected StringInput | $input | ||
protected QuestionHelper | $questionHelper | ||
protected ProgressBar | $progressBar | ||
protected Table | $table |
Methods
Creates and initializes the SymfonyConsoleOutput instance
Returns the desired maximum line length for console output.
Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
Outputs specified text to the console window and appends a line break
Formats the given text to fit into the maximum line length and outputs it to the console window
Renders a table like output of the given $rows
Asks the user to select a value
Asks a question to the user
Asks a question to the user
Asks a confirmation to the user.
Asks a question to the user, the response is hidden
Asks for a value and validates the response
Asks for a value, hide and validates the response
Starts the progress output
Advances the progress output X steps
Sets the current progress
Finishes the progress output
No description
No description
No description
No description
Returns or initializes the symfony/console QuestionHelper
If question is an array, split it into multi-line string
Returns or initializes the symfony/console ProgressHelper
Returns or initializes the symfony/console Table
Details
__construct()
Creates and initializes the SymfonyConsoleOutput instance
int
getMaximumLineLength()
Returns the desired maximum line length for console output.
void
output(string $text, array $arguments = [])
Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
void
outputLine(string $text = '', array $arguments = [])
Outputs specified text to the console window and appends a line break
void
outputFormatted(string $text = '', array $arguments = [], int $leftPadding = 0)
Formats the given text to fit into the maximum line length and outputs it to the console window
void
outputTable(array $rows, array $headers = null, string $headerTitle = null)
Renders a table like output of the given $rows
int|string|array
select(string|array $question, array $choices, mixed|null $default = null, bool $multiSelect = false, int $attempts = null)
Asks the user to select a value
mixed
ask(string|array $question, string $default = null)
Asks a question to the user
mixed
askQuestion(Question $question)
Asks a question to the user
bool
askConfirmation(string|array $question, bool $default = true)
Asks a confirmation to the user.
The question will be asked until the user answers by nothing, yes, or no.
mixed
askHiddenResponse(string|array $question, bool $fallback = true)
Asks a question to the user, the response is hidden
mixed
askAndValidate(string|array $question, callable $validator, int $attempts = null, string $default = null)
Asks for a value and validates the response
The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
mixed
askHiddenResponseAndValidate(string|array $question, callable $validator, int $attempts = null, bool $fallback = true)
Asks for a value, hide and validates the response
The validator receives the data to validate. It must return the validated data when the data is valid and throw an exception otherwise.
void
progressStart(int $max = null)
Starts the progress output
void
progressAdvance(int $step = 1)
Advances the progress output X steps
void
progressSet(int $current)
Sets the current progress
void
progressFinish()
Finishes the progress output
void
setOutput(OutputInterface $output)
No description
OutputInterface
getOutput()
No description
void
setInput(InputInterface $input)
No description
InputInterface
getInput()
No description
QuestionHelper
getQuestionHelper()
Returns or initializes the symfony/console QuestionHelper
protected string
combineQuestion(string|array $question)
If question is an array, split it into multi-line string
ProgressBar
getProgressBar()
Returns or initializes the symfony/console ProgressHelper
protected Table
getTable()
Returns or initializes the symfony/console Table