The trace argument value could be string ("*DEEP NESTED ARRAY*")

This commit is contained in:
realmfoo 2011-08-10 12:08:47 +04:00
parent 6e7439e73a
commit 4f9d229e78

View File

@ -42,14 +42,14 @@ class CodeHelper extends Helper
* *
* @return string * @return string
*/ */
public function formatArgsAsText($args) public function formatArgsAsText(array $args)
{ {
$result = array(); $result = array();
foreach ($args as $key => $item) { foreach ($args as $key => $item) {
if ('object' === $item[0]) { if ('object' === $item[0]) {
$formattedValue = sprintf("object(%s)", $item[1]); $formattedValue = sprintf("object(%s)", $item[1]);
} elseif ('array' === $item[0]) { } elseif ('array' === $item[0]) {
$formattedValue = sprintf("array(%s)", $this->formatArgsAsText($item[1])); $formattedValue = sprintf("array(%s)", is_array($item[1]) ? $this->formatArgsAsText($item[1]) : $item[1]);
} elseif ('string' === $item[0]) { } elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", $item[1]); $formattedValue = sprintf("'%s'", $item[1]);
} elseif ('null' === $item[0]) { } elseif ('null' === $item[0]) {
@ -97,7 +97,7 @@ class CodeHelper extends Helper
* *
* @return string * @return string
*/ */
public function formatArgs($args) public function formatArgs(array $args)
{ {
$result = array(); $result = array();
foreach ($args as $key => $item) { foreach ($args as $key => $item) {
@ -106,7 +106,7 @@ class CodeHelper extends Helper
$short = array_pop($parts); $short = array_pop($parts);
$formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short); $formattedValue = sprintf("<em>object</em>(<abbr title=\"%s\">%s</abbr>)", $item[1], $short);
} elseif ('array' === $item[0]) { } elseif ('array' === $item[0]) {
$formattedValue = sprintf("<em>array</em>(%s)", $this->formatArgs($item[1])); $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) { } elseif ('string' === $item[0]) {
$formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset())); $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES, $this->getCharset()));
} elseif ('null' === $item[0]) { } elseif ('null' === $item[0]) {