PlainObjectRenderer: less space for simple objects
This commit is contained in:
parent
3f1d2c6876
commit
813d930166
|
@ -66,6 +66,17 @@ class PlainObjectRenderer
|
||||||
return '{}';
|
return '{}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($hash) === 1) {
|
||||||
|
$current = self::renderObject(current($hash), $prefix . self::INDENTATION);
|
||||||
|
if (strlen($current) < 62) {
|
||||||
|
return sprintf(
|
||||||
|
'{ %s: %s }',
|
||||||
|
key($hash),
|
||||||
|
$current
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ksort($hash);
|
ksort($hash);
|
||||||
foreach ($hash as $key => $val) {
|
foreach ($hash as $key => $val) {
|
||||||
$vals[] = $prefix
|
$vals[] = $prefix
|
||||||
|
|
Loading…
Reference in New Issue