private static function krumo::_vars in Devel 7
Same name and namespace in other branches
- 6 krumo/class.krumo.php \krumo::_vars()
Render a dump for the properties of an array or objeect
@access private @static
Parameters
mixed &$data:
2 calls to krumo::_vars()
- krumo::_array in krumo/
class.krumo.php - Render a dump for an array
- krumo::_object in krumo/
class.krumo.php - Render a dump for an object
File
- krumo/
class.krumo.php, line 939
Class
- krumo
- Krumo API
Code
private static function _vars(&$data) {
$_is_object = is_object($data);
// test for references in order to
// prevent endless recursion loops
//
$_recursion_marker = krumo::_marker();
$_r = $_is_object ? @$data->{$_recursion_marker} : @$data[$_recursion_marker];
$_r = (int) $_r;
// recursion detected
//
if ($_r > 0) {
return krumo::_recursion();
}
// stain it
//
krumo::_hive($data);
// render it
//
?>
<div class="krumo-nest" style="display:none;">
<ul class="krumo-node">
<?php
if ($_is_object && get_class($data) != 'stdClass') {
// this part for protected/private properties only
$refl = new ReflectionClass($data);
foreach ($refl
->getProperties() as $property) {
$k = $property
->getName();
if ($k === $_recursion_marker || $property
->isPublic()) {
continue;
}
// add key indicators
if ($property
->isProtected()) {
$k .= ':protected';
}
elseif ($property
->isPrivate()) {
$k .= ':private';
}
$property
->setAccessible(TRUE);
$v = $property
->getValue($data);
krumo::_dump($v, $k);
}
}
// keys ?
//
$keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);
// itterate
//
foreach ($keys as $k) {
// skip marker
//
if ($k === $_recursion_marker) {
continue;
}
// get real value
//
if ($_is_object) {
$v =& $data->{$k};
}
else {
$v =& $data[$k];
}
krumo::_dump($v, $k);
}
?>
</ul>
</div>
<?php
}