本文整理汇总了PHP中Kint::expanded方法的典型用法代码示例。如果您正苦于以下问题:PHP Kint::expanded方法的具体用法?PHP Kint::expanded怎么用?PHP Kint::expanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kint
的用法示例。
在下文中一共展示了Kint::expanded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump
/**
* Dump information about variables, accepts any number of parameters, supports modifiers:.
*
* clean up any output before kint and place the dump at the top of page:
* - Kint::dump()
* *****
* expand all nodes on display:
* ! Kint::dump()
* *****
* dump variables disregarding their depth:
* + Kint::dump()
* *****
* return output instead of displaying it:
*
* @ Kint::dump()
* *****
* force output as plain text
* ~ Kint::dump()
*
* Modifiers are supported by all dump wrapper functions, including Kint::trace(). Space is optional.
*
* @param mixed $data
*
* @return void|string
*/
public static function dump($data = null)
{
if (!self::$enabled_mode) {
return '';
}
$stash = self::settings();
list($names, $parameters, $modifiers, $callee, $caller, $mini_trace) = self::getCalleeInfo(defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace());
// set mode for current run
if (self::$enabled_mode === true) {
self::$enabled_mode = self::$mode_default;
if (PHP_SAPI === 'cli' && self::$cli_detection === true) {
self::$enabled_mode = self::$mode_default_cli;
}
}
if (strpos($modifiers, '~') !== false) {
self::$enabled_mode = self::MODE_WHITESPACE;
}
if (!array_key_exists(self::$enabled_mode, self::$renderers)) {
$renderer = self::$renderers[self::MODE_PLAIN];
} else {
$renderer = self::$renderers[self::$enabled_mode];
}
// process modifiers: @, +, ! and -
if (strpos($modifiers, '-') !== false) {
while (ob_get_level()) {
ob_end_clean();
}
}
if (strpos($modifiers, '!') !== false) {
self::$expanded = true;
}
if (strpos($modifiers, '+') !== false) {
self::$max_depth = false;
}
if (strpos($modifiers, '@') !== false) {
self::$return = true;
}
$renderer = new $renderer($names, $parameters, $modifiers, $callee, $caller, $mini_trace);
$output = call_user_func(array($renderer, 'preRender'));
$parser = new Kint_Parser(self::$max_depth, empty($caller['class']) ? null : $caller['class']);
if ($names === array(null) && func_num_args() === 1 && $data === 1) {
// Kint::dump(1) shorthand
$trace = Kint_Parser_Plugin_Trace::trimTrace(debug_backtrace(true));
$lastframe = array_shift($trace);
$tracename = $lastframe['function'] . '(1)';
if (isset($lastframe['class'], $lastframe['type'])) {
$tracename = $lastframe['class'] . $lastframe['type'] . $tracename;
}
$tracebase = Kint_Object::blank($tracename, 'debug_backtrace()');
if (empty($trace)) {
$output .= call_user_func(array($renderer, 'render'), $tracebase->transplant(new Kint_Object_Trace()));
} else {
$output .= call_user_func(array($renderer, 'render'), $parser->parse($trace, $tracebase));
}
} else {
$data = func_get_args();
if ($data === array()) {
$output .= call_user_func(array($renderer, 'render'), new Kint_Object_Nothing());
}
foreach ($data as $i => $argument) {
$output .= call_user_func(array($renderer, 'render'), $parser->parse($argument, Kint_Object::blank(isset($names[$i]) ? $names[$i] : null, isset($parameters[$i]) ? $parameters[$i] : null)));
}
}
$output .= call_user_func(array($renderer, 'postRender'));
if (self::$return) {
self::settings($stash);
return $output;
}
self::settings($stash);
echo $output;
return '';
}