SymfonyStyle
extends OutputStyle
in package
Output decorator helpers for the Symfony Style Guide.
Tags
Table of Contents
Constants
- MAX_LINE_LENGTH = 120
Properties
- $bufferedOutput : mixed
- $input : mixed
- $lineLength : mixed
- $output : mixed
- $progressBar : mixed
- $questionHelper : mixed
Methods
- __construct() : mixed
- ask() : mixed
- Asks a question.
- askHidden() : mixed
- Asks a question with the user input hidden.
- askQuestion() : mixed
- block() : mixed
- Formats a message as a block of text.
- caution() : mixed
- Formats a caution admonition.
- choice() : mixed
- Asks a choice question.
- comment() : mixed
- Formats a command comment.
- confirm() : bool
- Asks for confirmation.
- createProgressBar() : ProgressBar
- definitionList() : mixed
- Formats a list of key/value horizontally.
- error() : mixed
- Formats an error result bar.
- getErrorStyle() : self
- Returns a new instance which makes use of stderr if available.
- getFormatter() : OutputFormatterInterface
- Returns current output formatter instance.
- getVerbosity() : int
- Gets the current verbosity of the output.
- horizontalTable() : mixed
- Formats a horizontal table.
- isDebug() : bool
- Returns whether verbosity is debug (-vvv).
- isDecorated() : bool
- Gets the decorated flag.
- isQuiet() : bool
- Returns whether verbosity is quiet (-q).
- isVerbose() : bool
- Returns whether verbosity is verbose (-v).
- isVeryVerbose() : bool
- Returns whether verbosity is very verbose (-vv).
- listing() : mixed
- Formats a list.
- newLine() : mixed
- Add newline(s).
- note() : mixed
- Formats a note admonition.
- progressAdvance() : mixed
- Advances the progress output X steps.
- progressFinish() : mixed
- Finishes the progress output.
- progressStart() : mixed
- Starts the progress output.
- section() : mixed
- Formats a section title.
- setDecorated() : mixed
- Sets the decorated flag.
- setFormatter() : mixed
- setVerbosity() : mixed
- Sets the verbosity of the output.
- success() : mixed
- Formats a success result bar.
- table() : mixed
- Formats a table.
- text() : mixed
- Formats informational text.
- title() : mixed
- Formats a command title.
- warning() : mixed
- Formats an warning result bar.
- write() : mixed
- Writes a message to the output.
- writeln() : mixed
- Writes a message to the output and adds a newline at the end.
- getErrorOutput() : mixed
- autoPrependBlock() : void
- autoPrependText() : void
- createBlock() : array<string|int, mixed>
- getProgressBar() : ProgressBar
- writeBuffer() : void
Constants
MAX_LINE_LENGTH
public
mixed
MAX_LINE_LENGTH
= 120
Properties
$bufferedOutput
private
mixed
$bufferedOutput
$input
private
mixed
$input
$lineLength
private
mixed
$lineLength
$output
private
mixed
$output
$progressBar
private
mixed
$progressBar
$questionHelper
private
mixed
$questionHelper
Methods
__construct()
public
__construct(InputInterface $input, OutputInterface $output) : mixed
Parameters
- $input : InputInterface
- $output : OutputInterface
ask()
Asks a question.
public
ask(mixed $question[, mixed $default = null ][, mixed $validator = null ]) : mixed
Parameters
- $question : mixed
- $default : mixed = null
- $validator : mixed = null
askHidden()
Asks a question with the user input hidden.
public
askHidden(mixed $question[, mixed $validator = null ]) : mixed
Parameters
- $question : mixed
- $validator : mixed = null
askQuestion()
public
askQuestion(Question $question) : mixed
Parameters
- $question : Question
block()
Formats a message as a block of text.
public
block(string|array<string|int, mixed> $messages[, string|null $type = null ][, string|null $style = null ][, string $prefix = ' ' ][, bool $padding = false ][, bool $escape = true ]) : mixed
Parameters
- $messages : string|array<string|int, mixed>
-
The message to write in the block
- $type : string|null = null
-
The block type (added in [] on first line)
- $style : string|null = null
-
The style to apply to the whole block
- $prefix : string = ' '
-
The prefix for the block
- $padding : bool = false
-
Whether to add vertical padding
- $escape : bool = true
-
Whether to escape the message
caution()
Formats a caution admonition.
public
caution(mixed $message) : mixed
Parameters
- $message : mixed
choice()
Asks a choice question.
public
choice(mixed $question, array<string|int, mixed> $choices[, mixed $default = null ]) : mixed
Parameters
- $question : mixed
- $choices : array<string|int, mixed>
- $default : mixed = null
comment()
Formats a command comment.
public
comment(string|array<string|int, mixed> $message) : mixed
Parameters
- $message : string|array<string|int, mixed>
confirm()
Asks for confirmation.
public
confirm(mixed $question[, mixed $default = true ]) : bool
Parameters
- $question : mixed
- $default : mixed = true
Return values
boolcreateProgressBar()
public
createProgressBar([mixed $max = 0 ]) : ProgressBar
Parameters
- $max : mixed = 0
Return values
ProgressBardefinitionList()
Formats a list of key/value horizontally.
public
definitionList(string|array<string|int, mixed>|TableSeparator ...$list) : mixed
Each row can be one of:
- 'A title'
- ['key' => 'value']
- new TableSeparator()
Parameters
- $list : string|array<string|int, mixed>|TableSeparator
error()
Formats an error result bar.
public
error(mixed $message) : mixed
Parameters
- $message : mixed
getErrorStyle()
Returns a new instance which makes use of stderr if available.
public
getErrorStyle() : self
Return values
selfgetFormatter()
Returns current output formatter instance.
public
getFormatter() : OutputFormatterInterface
Return values
OutputFormatterInterfacegetVerbosity()
Gets the current verbosity of the output.
public
getVerbosity() : int
Return values
int —The current level of verbosity (one of the VERBOSITY constants)
horizontalTable()
Formats a horizontal table.
public
horizontalTable(array<string|int, mixed> $headers, array<string|int, mixed> $rows) : mixed
Parameters
- $headers : array<string|int, mixed>
- $rows : array<string|int, mixed>
isDebug()
Returns whether verbosity is debug (-vvv).
public
isDebug() : bool
Return values
bool —true if verbosity is set to VERBOSITY_DEBUG, false otherwise
isDecorated()
Gets the decorated flag.
public
isDecorated() : bool
Return values
bool —true if the output will decorate messages, false otherwise
isQuiet()
Returns whether verbosity is quiet (-q).
public
isQuiet() : bool
Return values
bool —true if verbosity is set to VERBOSITY_QUIET, false otherwise
isVerbose()
Returns whether verbosity is verbose (-v).
public
isVerbose() : bool
Return values
bool —true if verbosity is set to VERBOSITY_VERBOSE, false otherwise
isVeryVerbose()
Returns whether verbosity is very verbose (-vv).
public
isVeryVerbose() : bool
Return values
bool —true if verbosity is set to VERBOSITY_VERY_VERBOSE, false otherwise
listing()
Formats a list.
public
listing(array<string|int, mixed> $elements) : mixed
Parameters
- $elements : array<string|int, mixed>
newLine()
Add newline(s).
public
newLine([mixed $count = 1 ]) : mixed
Parameters
- $count : mixed = 1
-
The number of newlines
note()
Formats a note admonition.
public
note(mixed $message) : mixed
Parameters
- $message : mixed
progressAdvance()
Advances the progress output X steps.
public
progressAdvance([mixed $step = 1 ]) : mixed
Parameters
- $step : mixed = 1
-
Number of steps to advance
progressFinish()
Finishes the progress output.
public
progressFinish() : mixed
progressStart()
Starts the progress output.
public
progressStart([mixed $max = 0 ]) : mixed
Parameters
- $max : mixed = 0
-
Maximum steps (0 if unknown)
section()
Formats a section title.
public
section(mixed $message) : mixed
Parameters
- $message : mixed
setDecorated()
Sets the decorated flag.
public
setDecorated(mixed $decorated) : mixed
Parameters
- $decorated : mixed
-
Whether to decorate the messages
setFormatter()
public
setFormatter(OutputFormatterInterface $formatter) : mixed
Parameters
- $formatter : OutputFormatterInterface
setVerbosity()
Sets the verbosity of the output.
public
setVerbosity(mixed $level) : mixed
Parameters
- $level : mixed
-
The level of verbosity (one of the VERBOSITY constants)
success()
Formats a success result bar.
public
success(mixed $message) : mixed
Parameters
- $message : mixed
table()
Formats a table.
public
table(array<string|int, mixed> $headers, array<string|int, mixed> $rows) : mixed
Parameters
- $headers : array<string|int, mixed>
- $rows : array<string|int, mixed>
text()
Formats informational text.
public
text(mixed $message) : mixed
Parameters
- $message : mixed
title()
Formats a command title.
public
title(mixed $message) : mixed
Parameters
- $message : mixed
warning()
Formats an warning result bar.
public
warning(mixed $message) : mixed
Parameters
- $message : mixed
write()
Writes a message to the output.
public
write(mixed $messages[, mixed $newline = false ][, mixed $type = self::OUTPUT_NORMAL ]) : mixed
Parameters
- $messages : mixed
-
The message as an iterable of strings or a single string
- $newline : mixed = false
-
Whether to add a newline
- $type : mixed = self::OUTPUT_NORMAL
writeln()
Writes a message to the output and adds a newline at the end.
public
writeln(mixed $messages[, mixed $type = self::OUTPUT_NORMAL ]) : mixed
Parameters
- $messages : mixed
-
The message as an iterable of strings or a single string
- $type : mixed = self::OUTPUT_NORMAL
getErrorOutput()
protected
getErrorOutput() : mixed
autoPrependBlock()
private
autoPrependBlock() : void
autoPrependText()
private
autoPrependText() : void
createBlock()
private
createBlock(iterable<string|int, mixed> $messages[, string $type = null ][, string $style = null ][, string $prefix = ' ' ][, bool $padding = false ][, bool $escape = false ]) : array<string|int, mixed>
Parameters
- $messages : iterable<string|int, mixed>
- $type : string = null
- $style : string = null
- $prefix : string = ' '
- $padding : bool = false
- $escape : bool = false
Return values
array<string|int, mixed>getProgressBar()
private
getProgressBar() : ProgressBar
Return values
ProgressBarwriteBuffer()
private
writeBuffer(string $message, bool $newLine, int $type) : void
Parameters
- $message : string
- $newLine : bool
- $type : int