public function Test_debug() { ob_start(); AkDebug::debug($this->AkTestingObjectInspectionChildInstance); $debug_str = ob_get_contents(); ob_end_clean(); $this->assertFalse($debug_str == '', 'AkDebug::debug not working properly'); }
public function debug($data = 'active_record_class', $_functions = 0) { if (!AK_DEBUG && !AK_DEV_MODE) { return; } $data = $data == 'active_record_class' ? clone $this->_Model : $data; if ($_functions != 0) { $sf = 1; } else { $sf = 0; } if (isset($data)) { if (is_array($data) || is_object($data)) { if (count($data)) { echo AK_CLI ? "/--\n" : "<ol>\n"; while (list($key, $value) = each($data)) { if ($key[0] == '_') { continue; } $type = gettype($value); if ($type == "array") { AK_CLI ? printf("\t* (%s) %s:\n", $type, $key) : printf("<li>(%s) <b>%s</b>:\n", $type, $key); ob_start(); AkDebug::debug($value, $sf); $lines = explode("\n", ob_get_clean() . "\n"); foreach ($lines as $line) { echo "\t" . $line . "\n"; } } elseif ($type == "object") { if (method_exists($value, 'hasColumn') && $value->hasColumn($key)) { $value->toString(true); AK_CLI ? printf("\t* (%s) %s:\n", $type, $key) : printf("<li>(%s) <b>%s</b>:\n", $type, $key); ob_start(); AkDebug::debug($value, $sf); $lines = explode("\n", ob_get_clean() . "\n"); foreach ($lines as $line) { echo "\t" . $line . "\n"; } } } elseif (stristr($type, "function")) { if ($sf) { AK_CLI ? printf("\t* (%s) %s:\n", $type, $key, $value) : printf("<li>(%s) <b>%s</b> </li>\n", $type, $key, $value); } } else { if (!$value) { $value = "(none)"; } AK_CLI ? printf("\t* (%s) %s = %s\n", $type, $key, $value) : printf("<li>(%s) <b>%s</b> = %s</li>\n", $type, $key, $value); } } echo AK_CLI ? "\n--/\n" : "</ol>fin.\n"; } else { echo "(empty)"; } } } }
/** * @deprecated * @uses AkDebug::debug */ static function debug($data, $_functions = 0) { Ak::deprecateMethod(__METHOD__, 'AkDebug::debug()'); return AkDebug::debug($data, $_functions); }