DebugFormatterHelper
extends Helper
in package
Helps outputting debug information when running an external program from a command.
An external program can be a Process, an HTTP request, or anything else.
Tags
Table of Contents
Constants
- COLORS = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']
Properties
- $helperSet : mixed
- $count : int
- $started : array<string|int, mixed>
Methods
- formatMemory() : string
- 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.
- progress() : string
- Adds progress to a formatting session.
- removeDecoration() : string
- setHelperSet() : void
- Sets the helper set associated with this helper.
- start() : string
- Starts a debug formatting session.
- stop() : string
- Stops a formatting session.
- 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.
- getBorder() : string
Constants
COLORS
private
mixed
COLORS
= ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']
Properties
$helperSet
protected
mixed
$helperSet
$count
private
int
$count
= -1
$started
private
array<string|int, mixed>
$started
= []
Methods
formatMemory()
public
static formatMemory(int $memory) : string
Parameters
- $memory : int
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
intprogress()
Adds progress to a formatting session.
public
progress(string $id, string $buffer[, bool $error = false ][, string $prefix = 'OUT' ][, string $errorPrefix = 'ERR' ]) : string
Parameters
- $id : string
- $buffer : string
- $error : bool = false
- $prefix : string = 'OUT'
- $errorPrefix : string = 'ERR'
Return values
stringremoveDecoration()
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
start()
Starts a debug formatting session.
public
start(string $id, string $message[, string $prefix = 'RUN' ]) : string
Parameters
- $id : string
- $message : string
- $prefix : string = 'RUN'
Return values
stringstop()
Stops a formatting session.
public
stop(string $id, string $message, bool $successful[, string $prefix = 'RES' ]) : string
Parameters
- $id : string
- $message : string
- $successful : bool
- $prefix : string = 'RES'
Return values
stringsubstr()
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
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
Return values
intgetBorder()
private
getBorder(string $id) : string
Parameters
- $id : string