diff --git a/src/main/php/util/log/Layout.class.php b/src/main/php/util/log/Layout.class.php index d0c5bad..d27ccd7 100755 --- a/src/main/php/util/log/Layout.class.php +++ b/src/main/php/util/log/Layout.class.php @@ -1,11 +1,11 @@ toString(); } else if ([] === $arg) { return '[]'; } else if (is_array($arg)) { - $indent.= ' '; if (0 === key($arg)) { $r= ''; foreach ($arg as $value) { @@ -37,21 +36,22 @@ protected function stringOf($arg, $indent= '') { } return '['.substr($r, 2).']'; } else { + $n= $indent.' '; $r= '['; foreach ($arg as $key => $value) { - $r.= "\n".$indent.$key.' => '.$this->stringOf($value, $indent); + $r.= "\n{$n}{$key} => ".$this->stringOf($value, $n); } - return $r."\n]"; + return $r."\n{$indent}]"; } } else if ($arg instanceof \Closure) { return $arg(); } else if (is_object($arg)) { - $indent.= ' '; + $n= $indent.' '; $r= nameof($arg).'@{'; foreach ((array)$arg as $key => $value) { - $r.= "\n".$indent.$key.' => '.$this->stringOf($value, $indent); + $r.= "\n{$n}{$key} => ".$this->stringOf($value, $n); } - return $r."\n}"; + return $r."\n{$indent}}"; } else { return (string)$arg; }