public static function stringifyArray(array $value, $depth = 1)
{
$nextDepth = $depth + 1;
if ($nextDepth >= self::$maxDepthStringify) {
return self::$maxReplacementStringify;
}
if (empty($value)) {
return '{ }';
}
$total = count($value);
$string = '';
$current = 0;
foreach ($value as $childKey => $childValue) {
if ($current++ >= self::$maxCountStringify) {
$string .= self::$maxReplacementStringify;
break;
}
if (!is_int($childKey)) {
$string .= sprintf('%s: ', static::stringify($childKey, $nextDepth));
}
$string .= static::stringify($childValue, $nextDepth);
if ($current !== $total) {
$string .= ', ';
}
}
return sprintf('{ %s }', $string);
}