FormatterHelper
extends Helper
in package
The Formatter class provides helpers to format messages.
Tags
Table of Contents
Properties
- $helperSet : mixed
Methods
- formatBlock() : string
- Formats a message as a block of text.
- formatMemory() : string
- formatSection() : string
- Formats a message within a section.
- formatTime() : string
- getHelperSet() : HelperSet|null
- Gets the helper set associated with this helper.
- getName() : string
- Returns the canonical name of this helper.
- length() : int
- Returns the length of a string, using mb_strlen if it is available.
- removeDecoration() : string
- setHelperSet() : void
- Sets the helper set associated with this helper.
- substr() : string
- Returns the subset of a string, using mb_substr if it is available.
- truncate() : string
- Truncates a message to the given length.
- width() : int
- Returns the width of a string, using mb_strwidth if it is available.
Properties
$helperSet
protected
mixed
$helperSet
Methods
formatBlock()
Formats a message as a block of text.
public
formatBlock(string|array<string|int, mixed> $messages, string $style[, bool $large = false ]) : string
Parameters
- $messages : string|array<string|int, mixed>
- $style : string
- $large : bool = false
Return values
stringformatMemory()
public
static formatMemory(int $memory) : string
Parameters
- $memory : int
Return values
stringformatSection()
Formats a message within a section.
public
formatSection(string $section, string $message[, string $style = 'info' ]) : string
Parameters
- $section : string
- $message : string
- $style : string = 'info'
Return values
stringformatTime()
public
static formatTime(int|float $secs[, int $precision = 1 ]) : string
Parameters
- $secs : int|float
- $precision : int = 1
Return values
stringgetHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet|null
Return values
HelperSet|nullgetName()
Returns the canonical name of this helper.
public
getName() : string
Return values
stringlength()
Returns the length of a string, using mb_strlen if it is available.
public
static length(string|null $string) : int
The length is related to how many bytes the string will use.
Parameters
- $string : string|null
Return values
intremoveDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, string|null $string) : string
Parameters
- $formatter : OutputFormatterInterface
- $string : string|null
Return values
stringsetHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet|null $helperSet = null ]) : void
Parameters
- $helperSet : HelperSet|null = null
substr()
Returns the subset of a string, using mb_substr if it is available.
public
static substr(string|null $string, int $from[, int|null $length = null ]) : string
Parameters
- $string : string|null
- $from : int
- $length : int|null = null
Return values
stringtruncate()
Truncates a message to the given length.
public
truncate(string $message, int $length[, string $suffix = '...' ]) : string
Parameters
- $message : string
- $length : int
- $suffix : string = '...'
Return values
stringwidth()
Returns the width of a string, using mb_strwidth if it is available.
public
static width(string|null $string) : int
The width is how many characters positions the string will use.
Parameters
- $string : string|null