interface WrappableOutputFormatterInterface implementsOutputFormatterInterface

Formatter interface for console output that supports word wrapping.

Methods

void
setDecorated(bool$decorated)

Sets the decorated flag.

bool
isDecorated()

Whether the output will decorate messages.

void
setStyle(string$name,OutputFormatterStyleInterface$style)

Sets a new style.

bool
hasStyle(string$name)

Checks if output formatter has style with specified name.

getStyle(string$name)

Gets style options from style with specified name.

string|null
format(string|null$message)

Formats a message according to the given styles.

string
formatAndWrap(string|null$message,int$width)

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

Details

void setDecorated(bool$decorated)

Sets the decorated flag.

Parameters

bool $decorated

Return Value

void

bool isDecorated()

Whether the output will decorate messages.

Return Value

bool

void setStyle(string$name,OutputFormatterStyleInterface$style)

Sets a new style.

Parameters

string $name
OutputFormatterStyleInterface $style

Return Value

void

bool hasStyle(string$name)

Checks if output formatter has style with specified name.

Parameters

string $name

Return Value

bool

OutputFormatterStyleInterface getStyle(string$name)

Gets style options from style with specified name.

Parameters

string $name

Return Value

OutputFormatterStyleInterface

Exceptions

InvalidArgumentException When style isn't defined

string|null format(string|null$message)

Formats a message according to the given styles.

Parameters

string|null $message

Return Value

string|null

string formatAndWrap(string|null$message,int$width)

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

Parameters

string|null $message
int $width

Return Value

string