From 813d9301663f23008ffb1efab6fd6a6b873510a1 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 18 Mar 2016 20:43:52 +0100 Subject: [PATCH] PlainObjectRenderer: less space for simple objects --- library/Director/PlainObjectRenderer.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/library/Director/PlainObjectRenderer.php b/library/Director/PlainObjectRenderer.php index 8257357f..8267bd4b 100644 --- a/library/Director/PlainObjectRenderer.php +++ b/library/Director/PlainObjectRenderer.php @@ -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