avoid tables to have apparently long blank line breaks and be too far appart for long nested array params

This commit is contained in:
Luis Cordova 2013-12-06 18:44:50 -05:00 committed by Fabien Potencier
parent ef3ae9cf45
commit 9d89f1e16a

View File

@ -198,7 +198,17 @@ abstract class Descriptor implements DescriptorInterface
protected function formatParameter($value)
{
if (is_bool($value) || is_array($value) || (null === $value)) {
return json_encode($value);
$jsonString = json_encode($value);
if (!function_exists('mb_strlen')) {
return substr($jsonString, 0, 60).(strlen($jsonString) > 60 ? ' ...' : '');
}
if (mb_strlen($jsonString) > 60) {
return mb_substr($jsonString, 0, 60).' ...';
}
return $jsonString;
}
return (string) $value;