src/Type/Json.php
public static function encode($data, $prettyPrint = false)
    {
        if ($prettyPrint) {
            // Check if the PHP version is >= 5.4 and has the JSON_PRETTY_PRINT constant
            if (version_compare(PHP_VERSION, '5.4.0', '>=') && defined('JSON_PRETTY_PRINT')) {
                return json_encode($data, JSON_PRETTY_PRINT);
            } else {
                $jsonPretty = new JsonPretty();
                return $jsonPretty->prettify($data, null, '    ');
            }
        }

        return json_encode($data);
    }
public static function encode($data, $prettyPrint = false)
    {
        if ($prettyPrint) {
            // Check if the PHP version is >= 5.4 and has the JSON_PRETTY_PRINT constant
            if (version_compare(PHP_VERSION, '5.4.0', '>=') && defined('JSON_PRETTY_PRINT')) {
                return json_encode($data, JSON_PRETTY_PRINT);
            } else {
                $jsonPretty = new JsonPretty();
                return $jsonPretty->prettify($data, null, '    ');
            }
        }

        return json_encode($data);
    }
public static function encode ( $ data , $ prettyPrint = false ) { if ( $ prettyPrint ) { // Check if the PHP version is >= 5.4 and has the JSON_PRETTY_PRINT constant if ( version_compare ( PHP_VERSION , '5.4.0' , '>=' ) && defined ( 'JSON_PRETTY_PRINT' ) ) { return json_encode ( $ data , JSON_PRETTY_PRINT ) ; } else { $ jsonPretty = new JsonPretty ( ) ; return $ jsonPretty -> prettify ( $ data , null , '    ' ) ; } } return json_encode ( $ data ) ; }
Encodes an array to json strutcture
@param  array   $data        Data to encode
@param  boolean $prettyPrint True to output the encoded data a little bit more readable for the humans
@return string
Encodes an array to json strutcture