Documentation

OutputFormatter
in package
implements WrappableOutputFormatterInterface

Formatter class for console output.

Tags
author

Konstantin Kudryashov ever.zet@gmail.com

author

Roland Franssen franssen.roland@gmail.com

Table of Contents

Interfaces

WrappableOutputFormatterInterface
Formatter interface for console output that supports word wrapping.

Properties

$decorated  : bool
$styles  : array<string|int, mixed>
$styleStack  : mixed

Methods

__clone()  : mixed
__construct()  : mixed
Initializes console output formatter.
escape()  : string
Escapes "<" and ">" special chars in given text.
format()  : string|null
{@inheritdoc}
formatAndWrap()  : mixed
Formats a message according to the given styles, wrapping at `$width` (0 means no wrapping).
getStyle()  : OutputFormatterStyleInterface
{@inheritdoc}
getStyleStack()  : OutputFormatterStyleStack
hasStyle()  : bool
{@inheritdoc}
isDecorated()  : bool
{@inheritdoc}
setDecorated()  : mixed
{@inheritdoc}
setStyle()  : mixed
{@inheritdoc}
applyCurrentStyle()  : string
Applies current style from stack to text, if must be applied.
createStyleFromString()  : OutputFormatterStyleInterface|null
Tries to create new style instance from string.

Properties

Methods

escape()

Escapes "<" and ">" special chars in given text.

public static escape(string $text) : string
Parameters
$text : string
Return values
string

format()

{@inheritdoc}

public format(string|null $message) : string|null
Parameters
$message : string|null
Return values
string|null

formatAndWrap()

Formats a message according to the given styles, wrapping at `$width` (0 means no wrapping).

public formatAndWrap(string|null $message, int $width) : mixed
Parameters
$message : string|null
$width : int

hasStyle()

{@inheritdoc}

public hasStyle(string $name) : bool
Parameters
$name : string
Return values
bool

isDecorated()

{@inheritdoc}

public isDecorated() : bool
Return values
bool

setDecorated()

{@inheritdoc}

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

applyCurrentStyle()

Applies current style from stack to text, if must be applied.

private applyCurrentStyle(string $text, string $current, int $width, int &$currentLineLength) : string
Parameters
$text : string
$current : string
$width : int
$currentLineLength : int
Return values
string

        
On this page

Search results