Skip to content

Instantly share code, notes, and snippets.

@enumag
Created December 11, 2012 22:28
Show Gist options
  • Save enumag/4262924 to your computer and use it in GitHub Desktop.
Save enumag/4262924 to your computer and use it in GitHub Desktop.
Nette\Diagnostics\Debugger::barDump shortcut
<?php
use \Nette\Diagnostics\Debugger;
/**
* Nette\Diagnostics\Debugger::barDump shortcut.
* @author Jáchym Toušek
* @param mixed $value
*/
function bd($value)
{
$trace = debug_backtrace(FALSE, 1);
$title = pathinfo($trace[0]['file'], PATHINFO_BASENAME) . ':' . $trace[0]['line'];
foreach (func_get_args() as $var) {
if (is_array($var) && empty($var)) {
Debugger::barDump($var, $title . ' [empty]');
} else {
Debugger::barDump($var, $title);
}
}
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment