From 665a9d4655dbc3b97b7cd5cf821b0f357c11a054 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 22 Apr 2019 16:31:50 +0200 Subject: [PATCH] Add option for stringify (json_encod now) --- Utils/StringUtils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Utils/StringUtils.php b/Utils/StringUtils.php index d9ac5b11b..f7a5a36b9 100644 --- a/Utils/StringUtils.php +++ b/Utils/StringUtils.php @@ -397,15 +397,16 @@ final class StringUtils * Turn value into string * * @param mixed $element Value to stringify. + * @param mixed $option Stringify option * * @return null|string * * @since 1.0.0 */ - public static function stringify($element) : ?string + public static function stringify($element, $option = null) : ?string { if ($element instanceof \JsonSerializable || \is_array($element)) { - $encoded = \json_encode($element); + $encoded = \json_encode($element, $option !== null ? $option : 0); return $encoded ? $encoded : null; } elseif ($element instanceof \Serializable) {