Class RDumper
When var_dump is not enough. Using this library you can browse the content of complex variables, one nested level at the time by using commands such as zoomin, zoomout and exit. Currently, this class should only be used for command line applications. Web browsable functionality will be added later using through firephp/firebug.
Using this library you can browse the content of complex variables, one nested level at the time by using commands such as zoomin, zoomout and exit
Example
<?php
require_once("rawdev/RawDev.php");
require_once(RAWDEV_LIB.'/Core/ErrorReporting.php');
require_once(RAWDEV_LIB.'/Util/Debug.php');
RErrorReporting::singleton()->initialize();
class Test {
var $a='hi';
var $b = array(1, 2);
}
$complex = array(1, 'hi', array(99, 17), 'std' => new stdClass(), new Test(), array());
RDebug::dump(17, $complex);
?>
Vars
var mixed[] $path
A stack of variables that represent the nested pages that are browsed (e.g. array($complex, $complex['city'], $complex['city']['neighborhood']) when browsing $complex.city.neighborhood).
Functions
static void function dump($value*)
Creates a new dumper object and displays the complex variable for browsing.
$value* | mixed | The value to be browsed. |
void function _dump($value)
Displays any variable for browsing. Based on the interactive feedback it execute the command (zoomin, zoomout, or exit).
$value | mixed | The value to be browsed. |
array function page($value)
Prints the variable, reads the input and returns the command that needs to be executed.
$value | mixed | The value to be displayed. |
returns | array | An array with the command (zoomin, zoomout, or exit) and optionally the variable (only on zoomin). |
static string function formatScalar($value)
Returns a string formatted scalar representation by adding quotes for string types and the text null for a null value.
$value | mixed | The scalar value. |
returns | string | The formatted value; |
string function display($value)
Returns the string to be displayed for a simple or complex value.
$value | mixed | The value to be displayed. |
returns | string | The formatted value representation. |
static int function maxLength($a)
*
Determines the max length of an array of strings. Handy for formatting.
*
$a | string[] | Strings to be evaluated. |
returns | int | The max length of all the strings. |