JsonLdResponse.php
public function processData($data = array())
    {
        // return an empty object instead of an empty array
        if (is_array($data) && 0 === count($data)) {
            $data = new \stdClass();
        }

        if (!is_string($data)) {
            $options = 0;

            if (PHP_VERSION_ID >= 50400)
            {
                $options |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

                if (self::$pretty)
                {
                    $options |= JSON_PRETTY_PRINT;
                }

                $data = json_encode($data, $options);
            }
            else
            {
                $data = json_encode($data);
                $data = str_replace('\\/', '/', $data);  // unescape slahes

                // unescape unicode
                $data = preg_replace_callback(
                    '/\\\\u([a-f0-9]{4})/',
                    function ($match) {
                        return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($match[1])));
                    },
                    $data);
            }
        }

        return $this->setContent($data);
    }
public function processData($data = array())
    {
        // return an empty object instead of an empty array
        if (is_array($data) && 0 === count($data)) {
            $data = new \stdClass();
        }

        if (!is_string($data)) {
            $options = 0;

            if (PHP_VERSION_ID >= 50400)
            {
                $options |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;

                if (self::$pretty)
                {
                    $options |= JSON_PRETTY_PRINT;
                }

                $data = json_encode($data, $options);
            }
            else
            {
                $data = json_encode($data);
                $data = str_replace('\\/', '/', $data);  // unescape slahes

                // unescape unicode
                $data = preg_replace_callback(
                    '/\\\\u([a-f0-9]{4})/',
                    function ($match) {
                        return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($match[1])));
                    },
                    $data);
            }
        }

        return $this->setContent($data);
    }
public function processData ( $ data = array ( ) ) { // return an empty object instead of an empty array if ( is_array ( $ data ) && 0 === count ( $ data ) ) { $ data = new \ stdClass ( ) ; } if ( ! is_string ( $ data ) ) { $ options = 0 ; if ( PHP_VERSION_ID >= 50400 ) { $ options |= JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ; if ( self :: $ pretty ) { $ options |= JSON_PRETTY_PRINT ; } $ data = json_encode ( $ data , $ options ) ; } else { $ data = json_encode ( $ data ) ; $ data = str_replace ( '\\/' , '/' , $ data ) ; // unescape slahes // unescape unicode $ data = preg_replace_callback ( '/\\\\u([a-f0-9]{4})/' , function ( $ match ) { return iconv ( 'UCS-4LE' , 'UTF-8' , pack ( 'V' , hexdec ( $ match [ 1 ] ) ) ) ; } , $ data ) ; } } return $ this -> setContent ( $ data ) ; }
Processes the data

If necessary, the data is serialized and then set as the content of
the response.

@param mixed $data

@return JsonLdResponse
Processes the data