_vars() private static method

Render a dump for the properties of an array or objeect
private static _vars ( &$data )
Esempio n. 1
0
 /**
  * Render a dump for an object
  *
  * @param mixed $data
  * @param string $name
  * @access private
  * @static
  */
 private static function _object(&$data, $name)
 {
     $reflection = new ReflectionObject($data);
     $properties = $reflection->getProperties();
     $childCount = count($properties);
     $collapsed = Krumo::_isCollapsed(self::$_level, $childCount);
     // Setup the CSS classes depending on how many children there are
     if ($childCount > 0 && $collapsed) {
         $elementClasses = ' krumo-expand';
     } elseif ($childCount > 0) {
         $elementClasses = ' krumo-expand krumo-opened';
     } else {
         $elementClasses = '';
     }
     print "<li class=\"krumo-child\"> <div class=\"krumo-element {$elementClasses}\"";
     if (count($data) > 0) {
         print 'onClick="krumo.toggle(this);"';
     }
     print 'onMouseOver="krumo.over(this);" onMouseOut="krumo.out(this);">';
     $empty_str = '';
     if ($childCount == 0) {
         $empty_str = ' (empty)';
     }
     print "<a class=\"krumo-name\">{$name}</a> <em class=\"krumo-type\">Object</em> ";
     print Krumo::get_separator() . " <strong class=\"krumo-class\">" . get_class($data) . "</strong>{$empty_str}</div>";
     if ($properties) {
         Krumo::_vars($data);
     }
     print "</li>";
 }