PlainObjectRenderer: less space for simple objects

This commit is contained in:
Thomas Gelf 2016-03-18 20:43:52 +01:00
parent 3f1d2c6876
commit 813d930166
1 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,17 @@ class PlainObjectRenderer
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);
foreach ($hash as $key => $val) {
$vals[] = $prefix