Class Debug
Debug class useful for don't forgetting where debug traces are.
Automatically decorates print_r() and var_dump() with following information: – file and line of the caller – name of function/method containing the call – name of the parameter passed during call
Example:
function f($value) {Debug::printr($value);}
Result:
[function f() in file /path/to/file.php, line 31] $value = Array ( [0] => 'xyz' )
See examples/debug.php for a complete example.
private
|
|
public static
array
|
#
getCaller( string $sFunctionName = '', array $aStack = array() )
Returns an array containing function name, filename and line in filename of the caller. If called out of any function, then return '' as function name. To return the caller of your function, either call get_caller(), or get_caller(__FUNCTION__). |
private static
string
|
#
getVarName( string $sFunction, string $sFile, integer $iLine )
Return the name of the first parameter of the penultimate function call. |
private static
|
#
displayTrace( string $sPattern, string $sValue )
Use specified pattern to display function name, filename, line in filename, varname in parameter and value of this parameter of the caller. |
public static
|
#
htmlVarDump( mixed $mValue )
Display an HTML trace containing a var_dump() of the specified value. |
public static
|
|
public static
|
|
public static
|
public static
array
|
$sDisplayPatterns | array(
'html' => '<pre><i>[function %1$s in file %2$s, line %3$d]</i><br /><b>%4$s</b> = %5$s</pre>',
// @codingStandardsIgnoreStart HEREDOC syntax is not supported in array by pdepend…
'cli' => "\033[2;33;40m[function \033[1m%1\$s\033[2m in file \033[1m%2\$s\033[2m, line \033[1m%3\$d\033[2m]\n\033[1m%4\$s\033[2m = \033[0m\n%5\$s\n"
// @codingStandardsIgnoreEnd
) |
#
Patterns for both HTML and CLI rendering: |