Documentation

ConsoleStyle extends SymfonyStyle
in package

FinalYes

Output decorator helpers for the Symfony Style Guide.

Tags
author

Javier Eguiluz javier.eguiluz@gmail.com

author

Ryan Weaver weaverryan@gmail.com

Table of Contents

Constants

MAX_LINE_LENGTH  = 120

Properties

$bufferedOutput  : mixed
$input  : mixed
$lineLength  : int
$output  : OutputInterface
$progressBar  : mixed
$questionHelper  : mixed

Methods

__construct()  : mixed
ask()  : mixed
{@inheritdoc}
askHidden()  : mixed
{@inheritdoc}
askQuestion()  : mixed
block()  : mixed
Formats a message as a block of text.
caution()  : mixed
{@inheritdoc}
choice()  : mixed
{@inheritdoc}
comment()  : void
Formats a command comment.
confirm()  : bool
{@inheritdoc}
createProgressBar()  : ProgressBar
createTable()  : Table
definitionList()  : mixed
Formats a list of key/value horizontally.
error()  : mixed
{@inheritdoc}
getErrorStyle()  : self
Returns a new instance which makes use of stderr if available.
getFormatter()  : OutputFormatterInterface
Returns current output formatter instance.
getOutput()  : OutputInterface
getVerbosity()  : int
Gets the current verbosity of the output.
horizontalTable()  : mixed
Formats a horizontal table.
info()  : mixed
Formats an info message.
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
{@inheritdoc}
newLine()  : mixed
Add newline(s).
note()  : mixed
{@inheritdoc}
progressAdvance()  : mixed
{@inheritdoc}
progressFinish()  : mixed
{@inheritdoc}
progressIterate()  : iterable<string|int, mixed>
progressStart()  : mixed
{@inheritdoc}
section()  : mixed
{@inheritdoc}
setDecorated()  : mixed
Sets the decorated flag.
setFormatter()  : mixed
setVerbosity()  : mixed
Sets the verbosity of the output.
success()  : void
{@inheritdoc}
table()  : mixed
{@inheritdoc}
text()  : mixed
{@inheritdoc}
title()  : mixed
{@inheritdoc}
warning()  : mixed
{@inheritdoc}
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

Properties

Methods

ask()

{@inheritdoc}

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

askHidden()

{@inheritdoc}

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

block()

Formats a message as a block of text.

public block(string|array<string|int, mixed> $messages[, string $type = null ][, string $style = null ][, string $prefix = ' ' ][, bool $padding = false ][, bool $escape = true ]) : mixed
Parameters
$messages : string|array<string|int, mixed>
$type : string = null
$style : string = null
$prefix : string = ' '
$padding : bool = false
$escape : bool = true

caution()

{@inheritdoc}

public caution(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, mixed>

choice()

{@inheritdoc}

public choice(string $question, array<string|int, mixed> $choices[, mixed $default = null ]) : mixed
Parameters
$question : string
$choices : array<string|int, mixed>
$default : mixed = null

comment()

Formats a command comment.

public comment(mixed $message) : void
Parameters
$message : mixed

confirm()

{@inheritdoc}

public confirm(string $question[, bool $default = true ]) : bool
Parameters
$question : string
$default : bool = true
Return values
bool

definitionList()

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()

{@inheritdoc}

public error(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, 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

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>

info()

Formats an info message.

public info(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, mixed>

isDebug()

Returns whether verbosity is debug (-vvv).

public isDebug() : bool
Return values
bool

isDecorated()

Gets the decorated flag.

public isDecorated() : bool
Return values
bool

isQuiet()

Returns whether verbosity is quiet (-q).

public isQuiet() : bool
Return values
bool

isVerbose()

Returns whether verbosity is verbose (-v).

public isVerbose() : bool
Return values
bool

isVeryVerbose()

Returns whether verbosity is very verbose (-vv).

public isVeryVerbose() : bool
Return values
bool

listing()

{@inheritdoc}

public listing(array<string|int, mixed> $elements) : mixed
Parameters
$elements : array<string|int, mixed>

newLine()

Add newline(s).

public newLine([int $count = 1 ]) : mixed
Parameters
$count : int = 1

note()

{@inheritdoc}

public note(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, mixed>

progressAdvance()

{@inheritdoc}

public progressAdvance([int $step = 1 ]) : mixed
Parameters
$step : int = 1

progressFinish()

{@inheritdoc}

public progressFinish() : mixed

progressIterate()

public progressIterate(iterable<string|int, mixed> $iterable[, int $max = null ]) : iterable<string|int, mixed>
Parameters
$iterable : iterable<string|int, mixed>
$max : int = null
Tags
see
ProgressBar::iterate()
Return values
iterable<string|int, mixed>

progressStart()

{@inheritdoc}

public progressStart([int $max = 0 ]) : mixed
Parameters
$max : int = 0

section()

{@inheritdoc}

public section(string $message) : mixed
Parameters
$message : string

setDecorated()

Sets the decorated flag.

public setDecorated(bool $decorated) : mixed
Parameters
$decorated : bool

setVerbosity()

Sets the verbosity of the output.

public setVerbosity(int $level) : mixed
Parameters
$level : int

success()

{@inheritdoc}

public success(mixed $message) : void
Parameters
$message : mixed

table()

{@inheritdoc}

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()

{@inheritdoc}

public text(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, mixed>

title()

{@inheritdoc}

public title(string $message) : mixed
Parameters
$message : string

warning()

{@inheritdoc}

public warning(string|array<string|int, mixed> $message) : mixed
Parameters
$message : string|array<string|int, mixed>

write()

Writes a message to the output.

public write(string|iterable<string|int, mixed> $messages[, bool $newline = false ][, int $type = self::OUTPUT_NORMAL ]) : mixed
Parameters
$messages : string|iterable<string|int, mixed>
$newline : bool = false

Whether to add a newline

$type : int = self::OUTPUT_NORMAL

writeln()

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

public writeln(string|iterable<string|int, mixed> $messages[, int $type = self::OUTPUT_NORMAL ]) : mixed
Parameters
$messages : string|iterable<string|int, mixed>
$type : int = self::OUTPUT_NORMAL

getErrorOutput()

protected getErrorOutput() : mixed

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>

writeBuffer()

private writeBuffer(string $message, bool $newLine, int $type) : void
Parameters
$message : string
$newLine : bool
$type : int

        
On this page

Search results