diff options
author | Christian A. Weber | 2020-04-14 16:19:34 +0200 |
---|---|---|
committer | Christian A. Weber | 2020-04-14 16:19:34 +0200 |
commit | 12f609e72c1dc851cfce8b4e973e9684b95595ef (patch) | |
tree | 9219b9a7af2b8efbad9bb46bd7b8ef9380e0abce /it.class | |
parent | 82f8e7b0702787a623aaf9be7e444dda31472575 (diff) | |
download | itools-12f609e72c1dc851cfce8b4e973e9684b95595ef.tar.gz itools-12f609e72c1dc851cfce8b4e973e9684b95595ef.tar.bz2 itools-12f609e72c1dc851cfce8b4e973e9684b95595ef.zip |
add pretty option to it::json_encode()
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1158,10 +1158,11 @@ static function pipe($cmd, $args = array()) /** * Encodes data to json with unescaped slahes, unescape unicode and on devel pretty printing + * @param $p['pretty'] Pretty-print json */ -static function json_encode($data) +static function json_encode($data, $p = []) { - return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | (it::is_devel() ? JSON_PRETTY_PRINT : 0)); + return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | ($p['pretty'] || it::is_devel() ? JSON_PRETTY_PRINT : 0)); } /** |