本文整理汇总了PHP中Dumper::_marker方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::_marker方法的具体用法?PHP Dumper::_marker怎么用?PHP Dumper::_marker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dumper
的用法示例。
在下文中一共展示了Dumper::_marker方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _vars
/**
* Render a dump for the properties of an array or objeect
*
* @param mixed &$data
* @access private
* @static
*/
private static function _vars(&$data)
{
$_is_object = is_object($data);
// test for references in order to
// prevent endless recursion loops
$_recursion_marker = Dumper::_marker();
if ($_is_object) {
if (($hash = spl_object_hash($data)) && isset(self::$objectRecursionProtection[$hash])) {
$_r = self::$objectRecursionProtection[$hash];
} else {
$_r = NULL;
}
} else {
$_r = isset($data[$_recursion_marker]) ? $data[$_recursion_marker] : null;
}
// recursion detected
if ($_r > 0) {
return Dumper::_recursion();
}
// stain it
Dumper::_hive($data);
// render it
$collapsed = Dumper::_isCollapsed(self::$_level, count($data) - 1);
if ($collapsed) {
$collapse_style = 'style="display: none;"';
} else {
$collapse_style = '';
}
print "<div class=\"dumper-nest\" {$collapse_style}>";
print "<ul class=\"dumper-node\">";
// we're descending one level deeper
self::$_level++;
// Object?? - use Reflection
if ($_is_object) {
$reflection = new ReflectionObject($data);
$properties = $reflection->getProperties();
foreach ($properties as $property) {
$prefix = null;
$setAccessible = false;
if ($property->isPrivate()) {
$setAccessible = true;
$prefix = 'private';
} elseif ($property->isProtected()) {
$setAccessible = true;
$prefix = 'protected';
} elseif ($property->isPublic()) {
$prefix = 'public';
}
$name = $property->getName();
if ($setAccessible) {
$property->setAccessible(true);
}
$value = $property->getValue($data);
Dumper::_dump($value, "<span>{$prefix}</span> {$name}");
if ($setAccessible) {
$property->setAccessible(false);
}
}
} else {
// keys
$keys = array_keys($data);
// iterate
foreach ($keys as $k) {
// skip marker
if ($k === $_recursion_marker) {
continue;
}
// get real value
$v =& $data[$k];
Dumper::_dump($v, $k);
}
}
print "</ul>\n</div>";
self::$_level--;
}