Documentation

SymfonyStyle extends OutputStyle
in package

Output decorator helpers for the Symfony Style Guide.

Tags
author

Kevin Bond kevinbond@gmail.com

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()  : string
Asks a question.
askHidden()  : string
Asks a question with the user input hidden.
askQuestion()  : string
block()  : mixed
Formats a message as a block of text.
caution()  : mixed
Formats a caution admonition.
choice()  : string
Asks a choice question.
comment()  : mixed
Formats a command comment.
confirm()  : bool
Asks for confirmation.
createProgressBar()  : ProgressBar
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.
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
Sets output formatter.
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()  : mixed
autoPrependText()  : mixed
createBlock()  : mixed
getProgressBar()  : ProgressBar
reduceBuffer()  : mixed

Constants

Properties

Methods

ask()

Asks a question.

public ask(mixed $question[, mixed $default = null ][, mixed $validator = null ]) : string
Parameters
$question : mixed
$default : mixed = null
$validator : mixed = null
Return values
string

askHidden()

Asks a question with the user input hidden.

public askHidden(mixed $question[, mixed $validator = null ]) : string
Parameters
$question : mixed
$validator : mixed = null
Return values
string

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 ]) : string
Parameters
$question : mixed
$choices : array<string|int, mixed>
$default : mixed = null
Return values
string

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
bool

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
self

getVerbosity()

Gets the current verbosity of the output.

public getVerbosity() : int
Return values
int

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

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

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 array of lines 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 array of lines of a single string

$type : mixed = self::OUTPUT_NORMAL

getErrorOutput()

protected getErrorOutput() : mixed

createBlock()

private createBlock(mixed $messages[, mixed $type = null ][, mixed $style = null ][, mixed $prefix = ' ' ][, mixed $padding = false ][, mixed $escape = false ]) : mixed
Parameters
$messages : mixed
$type : mixed = null
$style : mixed = null
$prefix : mixed = ' '
$padding : mixed = false
$escape : mixed = false

reduceBuffer()

private reduceBuffer(mixed $messages) : mixed
Parameters
$messages : mixed

        
On this page

Search results