/**
  * Debugging used by Debug::show()
  *
  * @return string HTML data representing this object
  */
 public function debug()
 {
     $val = "<h3>Database record: {$this->class}</h3>\n<ul>\n";
     if ($this->record) {
         foreach ($this->record as $fieldName => $fieldVal) {
             $val .= "\t<li>{$fieldName}: " . Debug::text($fieldVal) . "</li>\n";
         }
     }
     $val .= "</ul>\n";
     return $val;
 }
 public function debug()
 {
     $result = "{$this->class} ({$this->name}) <ul>";
     foreach ($this->children as $child) {
         $result .= "<li>" . Debug::text($child) . "&nbsp;</li>";
     }
     $result .= "</ul>";
     return $result;
 }
 /**
  * @param mixed $val
  * @return string
  */
 public static function text($val)
 {
     if (is_object($val)) {
         if (method_exists($val, 'hasMethod')) {
             $hasDebugMethod = $val->hasMethod('debug');
         } else {
             $hasDebugMethod = method_exists($val, 'debug');
         }
         if ($hasDebugMethod) {
             return $val->debug();
         }
     }
     if (is_array($val)) {
         $result = "<ul>\n";
         foreach ($val as $k => $v) {
             $result .= "<li>{$k} = " . Debug::text($v) . "</li>\n";
         }
         $val = $result . "</ul>\n";
     } else {
         if (is_object($val)) {
             $val = var_export($val, true);
         } else {
             if (is_bool($val)) {
                 $val = $val ? 'true' : 'false';
                 $val = '(bool) ' . $val;
             } else {
                 if (!Director::is_cli() && !Director::is_ajax()) {
                     $val = "<pre style=\"font-family: Courier new\">" . htmlentities($val, ENT_COMPAT, 'UTF-8') . "</pre>\n";
                 }
             }
         }
     }
     return $val;
 }
 public function debug()
 {
     $val = "<h2>" . $this->class . "</h2><ul>";
     foreach ($this->toNestedArray() as $item) {
         $val .= "<li style=\"list-style-type: disc; margin-left: 20px\">" . Debug::text($item) . "</li>";
     }
     $val .= "</ul>";
     return $val;
 }