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
Properties
- $helperSet : mixed
- $colors : mixed
- $count : mixed
- $started : mixed
Methods
- formatMemory() : mixed
- formatTime() : mixed
- getHelperSet() : HelperSet
- Gets the helper set associated with this helper.
- getName() : string
- Returns the canonical name of this helper.
- progress() : string
- Adds progress to a formatting session.
- removeDecoration() : mixed
- setHelperSet() : mixed
- Sets the helper set associated with this helper.
- start() : string
- Starts a debug formatting session.
- stop() : string
- Stops a formatting session.
- 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.
- getBorder() : string
Properties
$helperSet
protected
mixed
$helperSet
= null
$colors
private
mixed
$colors
= ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default']
$count
private
mixed
$count
= -1
$started
private
mixed
$started
= []
Methods
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
progress()
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
-
The id of the formatting session
- $buffer : string
-
The message to display
- $error : bool = false
-
Whether to consider the buffer as error
- $prefix : string = 'OUT'
-
The prefix for output
- $errorPrefix : string = 'ERR'
-
The prefix for error output
Return values
stringremoveDecoration()
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
start()
Starts a debug formatting session.
public
start(string $id, string $message[, string $prefix = 'RUN' ]) : string
Parameters
- $id : string
-
The id of the formatting session
- $message : string
-
The message to display
- $prefix : string = 'RUN'
-
The prefix to use
Return values
stringstop()
Stops a formatting session.
public
stop(string $id, string $message, bool $successful[, string $prefix = 'RES' ]) : string
Parameters
- $id : string
-
The id of the formatting session
- $message : string
-
The message to display
- $successful : bool
-
Whether to consider the result as success
- $prefix : string = 'RES'
-
The prefix for the end output
Return values
stringstrlen()
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
getBorder()
private
getBorder(string $id) : string
Parameters
- $id : string