DescriptorHelper
extends Helper
in package
This class adds helper method to describe objects in various formats.
Tags
Table of Contents
- $helperSet : mixed
- $descriptors : array<string|int, DescriptorInterface>
- __construct() : mixed
- describe() : mixed
- Describes an object if supported.
- formatMemory() : mixed
- formatTime() : mixed
- getFormats() : array<string|int, mixed>
- getHelperSet() : HelperSet|null
- Gets the helper set associated with this helper.
- getName() : mixed
- {@inheritdoc}
- length() : int
- Returns the length of a string, using mb_strlen if it is available.
- register() : $this
- Registers a descriptor.
- removeDecoration() : mixed
- setHelperSet() : mixed
- Sets the helper set associated with this helper.
- strlen() : int
- Returns the length of a string, using mb_strwidth if it is available.
- strlenWithoutDecoration() : mixed
- substr() : string
- Returns the subset of a string, using mb_substr if it is available.
- width() : int
- Returns the width of a string, using mb_strwidth if it is available.
Properties
$helperSet
protected
mixed
$helperSet
= null
$descriptors
private
array<string|int, DescriptorInterface>
$descriptors
= []
Methods
__construct()
public
__construct() : mixed
Return values
mixed —describe()
Describes an object if supported.
public
describe(OutputInterface $output, object|null $object[, array<string|int, mixed> $options = [] ]) : mixed
Available options are:
- format: string, the output format name
- raw_text: boolean, sets output type as raw
Parameters
- $output : OutputInterface
- $object : object|null
- $options : array<string|int, mixed> = []
Tags
Return values
mixed —formatMemory()
public
static formatMemory(int $memory) : mixed
Parameters
- $memory : int
Return values
mixed —formatTime()
public
static formatTime(mixed $secs) : mixed
Parameters
- $secs : mixed
Return values
mixed —getFormats()
public
getFormats() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet|null
Return values
HelperSet|null —getName()
{@inheritdoc}
public
getName() : mixed
Return values
mixed —length()
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
int —register()
Registers a descriptor.
public
register(string $format, DescriptorInterface $descriptor) : $this
Parameters
- $format : string
- $descriptor : DescriptorInterface
Return values
$this —removeDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, string|null $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : string|null
Return values
mixed —setHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet|null $helperSet = null ]) : mixed
Parameters
- $helperSet : HelperSet|null = null
Return values
mixed —strlen()
Returns the length of a string, using mb_strwidth if it is available.
public
static strlen(string|null $string) : int
Parameters
- $string : string|null
Tags
Return values
int —strlenWithoutDecoration()
public
static strlenWithoutDecoration(OutputFormatterInterface $formatter, string|null $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : string|null
Tags
Return values
mixed —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
string —width()
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