DescriptorHelper
extends Helper
in package
This class adds helper method to describe objects in various formats.
Tags
Table of Contents
Properties
- $helperSet : mixed
- $descriptors : array<string|int, DescriptorInterface>
Methods
- __construct() : mixed
- describe() : mixed
- Describes an object if supported.
- formatMemory() : mixed
- formatTime() : mixed
- getHelperSet() : HelperSet
- Gets the helper set associated with this helper.
- getName() : string
- Returns the canonical name of this helper.
- 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.
Properties
$helperSet
protected
mixed
$helperSet
= null
$descriptors
private
array<string|int, DescriptorInterface>
$descriptors
= []
Methods
__construct()
public
__construct() : mixed
describe()
Describes an object if supported.
public
describe(OutputInterface $output, object $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
- $options : array<string|int, mixed> = []
Tags
formatMemory()
public
static formatMemory(mixed $memory) : mixed
Parameters
- $memory : mixed
formatTime()
public
static formatTime(mixed $secs) : mixed
Parameters
- $secs : mixed
getHelperSet()
Gets the helper set associated with this helper.
public
getHelperSet() : HelperSet
Return values
HelperSet —A HelperSet instance
getName()
Returns the canonical name of this helper.
public
getName() : string
Return values
string —The canonical name
register()
Registers a descriptor.
public
register(string $format, DescriptorInterface $descriptor) : $this
Parameters
- $format : string
- $descriptor : DescriptorInterface
Return values
$thisremoveDecoration()
public
static removeDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
setHelperSet()
Sets the helper set associated with this helper.
public
setHelperSet([HelperSet $helperSet = null ]) : mixed
Parameters
- $helperSet : HelperSet = null
strlen()
Returns the length of a string, using mb_strwidth if it is available.
public
static strlen(string $string) : int
Parameters
- $string : string
-
The string to check its length
Return values
int —The length of the string
strlenWithoutDecoration()
public
static strlenWithoutDecoration(OutputFormatterInterface $formatter, mixed $string) : mixed
Parameters
- $formatter : OutputFormatterInterface
- $string : mixed
substr()
Returns the subset of a string, using mb_substr if it is available.
public
static substr(string $string, int $from[, int|null $length = null ]) : string
Parameters
- $string : string
-
String to subset
- $from : int
-
Start offset
- $length : int|null = null
-
Length to read
Return values
string —The string subset