made dump accept second parameter as native function var_dump
This commit is contained in:
parent
b8d1ab881b
commit
6a2012b4cf
@ -485,9 +485,10 @@ final class Doctrine
|
|||||||
* dumps a given variable
|
* dumps a given variable
|
||||||
*
|
*
|
||||||
* @param mixed $var a variable of any type
|
* @param mixed $var a variable of any type
|
||||||
|
* @param boolean $output whether to output the content
|
||||||
* @return void|string
|
* @return void|string
|
||||||
*/
|
*/
|
||||||
public static function dump($var)
|
public static function dump($var, $output = true)
|
||||||
{
|
{
|
||||||
$ret = array();
|
$ret = array();
|
||||||
switch (gettype($var)) {
|
switch (gettype($var)) {
|
||||||
@ -504,6 +505,9 @@ final class Doctrine
|
|||||||
default:
|
default:
|
||||||
$ret[] = var_export($var, true);
|
$ret[] = var_export($var, true);
|
||||||
}
|
}
|
||||||
|
if ($output) {
|
||||||
|
print implode("\n", $ret);
|
||||||
|
}
|
||||||
return implode("\n", $ret);
|
return implode("\n", $ret);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user