Created
December 11, 2012 22:28
-
-
Save enumag/4262924 to your computer and use it in GitHub Desktop.
Nette\Diagnostics\Debugger::barDump shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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