class FormatterHelper extends Helper

The Formatter class provides helpers to format messages.

Methods

setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

from Helper
getHelperSet()

Gets the helper set associated with this helper.

from Helper
static int
strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

from Helper
static 
formatTime($secs)

No description

from Helper
static 
formatMemory($memory)

No description

from Helper
static 
strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

No description

from Helper
string
formatSection(string $section, string $message, string $style = 'info')

Formats a message within a section.

string
formatBlock(string|array $messages, string $style, bool $large = false)

Formats a message as a block of text.

string
truncate(string $message, int $length, string $suffix = '...')

Truncates a message to the given length.

string
getName()

Returns the canonical name of this helper.

Details

in Helper at line line 30
setHelperSet(HelperSet $helperSet = null)

Sets the helper set associated with this helper.

Parameters

HelperSet $helperSet A HelperSet instance

in Helper at line line 40
HelperSet getHelperSet()

Gets the helper set associated with this helper.

Return Value

HelperSet A HelperSet instance

in Helper at line line 52
static int strlen(string $string)

Returns the length of a string, using mb_strwidth if it is available.

Parameters

string $string The string to check its length

Return Value

int The length of the string

in Helper at line line 61
static formatTime($secs)

Parameters

$secs

in Helper at line line 90
static formatMemory($memory)

Parameters

$memory

in Helper at line line 107
static strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)

Parameters

OutputFormatterInterface $formatter
$string

at line line 32
string formatSection(string $section, string $message, string $style = 'info')

Formats a message within a section.

Parameters

string $section The section name
string $message The message
string $style The style to apply to the section

Return Value

string The format section

at line line 46
string formatBlock(string|array $messages, string $style, bool $large = false)

Formats a message as a block of text.

Parameters

string|array $messages The message to write in the block
string $style The style to apply to the whole block
bool $large Whether to return a large block

Return Value

string The formatter message

at line line 84
string truncate(string $message, int $length, string $suffix = '...')

Truncates a message to the given length.

Parameters

string $message
int $length
string $suffix

Return Value

string

at line line 102
string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name