/** * dump information about variables * * @param mixed $data * * @return void|string */ public static function dump($data = null) { if (!Kint::enabled()) { return; } # find caller information $trace = debug_backtrace(); list($names, $modifier, $callee, $previousCaller) = self::_getPassedNames($trace); if ($names === array(null) && func_num_args() === 1 && $data === 1) { $call = reset($trace); if (!isset($call['file']) && isset($call['class']) && $call['class'] === __CLASS__) { array_shift($trace); $call = reset($trace); } while (isset($call['file']) && $call['file'] === __FILE__) { array_shift($trace); $call = reset($trace); } self::trace($trace); return; } # process modifiers: @, + and - switch ($modifier) { case '-': self::$_firstRun = true; while (ob_get_level()) { ob_end_clean(); } break; case '!': self::$expandedByDefault = true; break; case '+': $maxLevelsOldValue = self::$maxLevels; self::$maxLevels = false; break; case '@': $firstRunOldValue = self::$_firstRun; self::$_firstRun = true; break; } $data = func_num_args() === 0 ? array("[[no arguments passed]]") : func_get_args(); $output = Kint_Decorators_Rich::_css(); $output .= Kint_Decorators_Rich::_wrapStart($callee); foreach ($data as $k => $argument) { $output .= self::_dump($argument, $names[$k]); } $output .= Kint_Decorators_Rich::_wrapEnd($callee, $previousCaller); self::$_firstRun = false; switch ($modifier) { case '+': self::$maxLevels = $maxLevelsOldValue; echo $output; break; case '@': self::$_firstRun = $firstRunOldValue; return $output; break; default: echo $output; break; } return ''; }