class SymfonyStyle extends OutputStyle

Output decorator helpers for the Symfony Style Guide.

Constants

MAX_LINE_LENGTH

Methods

__construct(InputInterface $input, OutputInterface $output)

No description

newLine(int $count = 1)

Add newline(s).

ProgressBar
createProgressBar(int $max)

No description

write(string|iterable $messages, bool $newline = false, $type = self::OUTPUT_NORMAL)

Writes a message to the output.

writeln(string|iterable $messages, $type = self::OUTPUT_NORMAL)

Writes a message to the output and adds a newline at the end.

setVerbosity(int $level)

Sets the verbosity of the output.

int
getVerbosity()

Gets the current verbosity of the output.

setDecorated(bool $decorated)

Sets the decorated flag.

bool
isDecorated()

Gets the decorated flag.

setFormatter(OutputFormatterInterface $formatter)

No description

getFormatter()

Returns current output formatter instance.

bool
isQuiet()

Returns whether verbosity is quiet (-q).

bool
isVerbose()

Returns whether verbosity is verbose (-v).

bool
isVeryVerbose()

Returns whether verbosity is very verbose (-vv).

bool
isDebug()

Returns whether verbosity is debug (-vvv).

block(string|array $messages, string|null $type = null, string|null $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)

Formats a message as a block of text.

title(string $message)

Formats a command title.

section(string $message)

Formats a section title.

listing(array $elements)

Formats a list.

text(string|array $message)

Formats informational text.

comment(string|array $message)

Formats a command comment.

success(string|array $message)

Formats a success result bar.

error(string|array $message)

Formats an error result bar.

warning(string|array $message)

Formats an warning result bar.

note(string|array $message)

Formats a note admonition.

caution(string|array $message)

Formats a caution admonition.

table(array $headers, array $rows)

Formats a table.

mixed
ask(string $question, string|null $default = null, callable|null $validator = null)

Asks a question.

mixed
askHidden(string $question, callable|null $validator = null)

Asks a question with the user input hidden.

bool
confirm(string $question, bool $default = true)

Asks for confirmation.

mixed
choice(string $question, array $choices, string|int|null $default = null)

Asks a choice question.

progressStart(int $max)

Starts the progress output.

progressAdvance(int $step = 1)

Advances the progress output X steps.

progressFinish()

Finishes the progress output.

mixed
askQuestion(Question $question)

No description

getErrorStyle()

Returns a new instance which makes use of stderr if available.

Details

at line line 43
__construct(InputInterface $input, OutputInterface $output)

Parameters

InputInterface $input
OutputInterface $output

at line line 337
newLine(int $count = 1)

Add newline(s).

Parameters

int $count The number of newlines

at line line 268
ProgressBar createProgressBar(int $max)

Parameters

int $max

Return Value

ProgressBar

at line line 322
write(string|iterable $messages, bool $newline = false, $type = self::OUTPUT_NORMAL)

Writes a message to the output.

Parameters

string|iterable $messages The message as an iterable of strings or a single string
bool $newline Whether to add a newline
$type

at line line 307
writeln(string|iterable $messages, $type = self::OUTPUT_NORMAL)

Writes a message to the output and adds a newline at the end.

Parameters

string|iterable $messages The message as an iterable of strings or a single string
$type

in OutputStyle at line line 70
setVerbosity(int $level)

Sets the verbosity of the output.

Parameters

int $level The level of verbosity (one of the VERBOSITY constants)

in OutputStyle at line line 78
int getVerbosity()

Gets the current verbosity of the output.

Return Value

int The current level of verbosity (one of the VERBOSITY constants)

in OutputStyle at line line 86
setDecorated(bool $decorated)

Sets the decorated flag.

Parameters

bool $decorated Whether to decorate the messages

in OutputStyle at line line 94
bool isDecorated()

Gets the decorated flag.

Return Value

bool true if the output will decorate messages, false otherwise

in OutputStyle at line line 102
setFormatter(OutputFormatterInterface $formatter)

Parameters

OutputFormatterInterface $formatter

in OutputStyle at line line 110
OutputFormatterInterface getFormatter()

Returns current output formatter instance.

in OutputStyle at line line 118
bool isQuiet()

Returns whether verbosity is quiet (-q).

Return Value

bool true if verbosity is set to VERBOSITY_QUIET, false otherwise

in OutputStyle at line line 126
bool isVerbose()

Returns whether verbosity is verbose (-v).

Return Value

bool true if verbosity is set to VERBOSITY_VERBOSE, false otherwise

in OutputStyle at line line 134
bool isVeryVerbose()

Returns whether verbosity is very verbose (-vv).

Return Value

bool true if verbosity is set to VERBOSITYVERYVERBOSE, false otherwise

in OutputStyle at line line 142
bool isDebug()

Returns whether verbosity is debug (-vvv).

Return Value

bool true if verbosity is set to VERBOSITY_DEBUG, false otherwise

at line line 64
block(string|array $messages, string|null $type = null, string|null $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true)

Formats a message as a block of text.

Parameters

string|array $messages The message to write in the block
string|null $type The block type (added in [] on first line)
string|null $style The style to apply to the whole block
string $prefix The prefix for the block
bool $padding Whether to add vertical padding
bool $escape Whether to escape the message

at line line 76
title(string $message)

Formats a command title.

Parameters

string $message

at line line 89
section(string $message)

Formats a section title.

Parameters

string $message

at line line 102
listing(array $elements)

Formats a list.

Parameters

array $elements

at line line 116
text(string|array $message)

Formats informational text.

Parameters

string|array $message

at line line 131
comment(string|array $message)

Formats a command comment.

Parameters

string|array $message

at line line 139
success(string|array $message)

Formats a success result bar.

Parameters

string|array $message

at line line 147
error(string|array $message)

Formats an error result bar.

Parameters

string|array $message

at line line 155
warning(string|array $message)

Formats an warning result bar.

Parameters

string|array $message

at line line 163
note(string|array $message)

Formats a note admonition.

Parameters

string|array $message

at line line 171
caution(string|array $message)

Formats a caution admonition.

Parameters

string|array $message

at line line 179
table(array $headers, array $rows)

Formats a table.

Parameters

array $headers
array $rows

at line line 196
mixed ask(string $question, string|null $default = null, callable|null $validator = null)

Asks a question.

Parameters

string $question
string|null $default
callable|null $validator

Return Value

mixed

at line line 207
mixed askHidden(string $question, callable|null $validator = null)

Asks a question with the user input hidden.

Parameters

string $question
callable|null $validator

Return Value

mixed

at line line 220
bool confirm(string $question, bool $default = true)

Asks for confirmation.

Parameters

string $question
bool $default

Return Value

bool

at line line 228
mixed choice(string $question, array $choices, string|int|null $default = null)

Asks a choice question.

Parameters

string $question
array $choices
string|int|null $default

Return Value

mixed

at line line 241
progressStart(int $max)

Starts the progress output.

Parameters

int $max Maximum steps (0 if unknown)

at line line 250
progressAdvance(int $step = 1)

Advances the progress output X steps.

Parameters

int $step Number of steps to advance

at line line 258
progressFinish()

Finishes the progress output.

at line line 284
mixed askQuestion(Question $question)

Parameters

Question $question

Return Value

mixed

at line line 348
SymfonyStyle getErrorStyle()

Returns a new instance which makes use of stderr if available.

Return Value

SymfonyStyle