protected function formatJsonp($response)
    {
        $bodyRaw = $response->getRawBody();
        if (is_array($bodyRaw)
            && isset($bodyRaw['data'], $bodyRaw['callback'])
        ) {
            $data = $response->app instanceof Reaction\RequestApplicationInterface
                ? $response->app->helpers->json->htmlEncode($bodyRaw['data'])
                : Json::htmlEncode($bodyRaw['data']);
            return sprintf('%s(%s);', $bodyRaw['callback'], $data);
        } elseif ($bodyRaw !== null) {
            Reaction::warning(
                "The 'jsonp' response requires that the data be an array consisting of both 'data' and 'callback' elements."
            );
        }
        return '';
    }
protected function formatJsonp($response)
    {
        $bodyRaw = $response->getRawBody();
        if (is_array($bodyRaw)
            && isset($bodyRaw['data'], $bodyRaw['callback'])
        ) {
            $data = $response->app instanceof Reaction\RequestApplicationInterface
                ? $response->app->helpers->json->htmlEncode($bodyRaw['data'])
                : Json::htmlEncode($bodyRaw['data']);
            return sprintf('%s(%s);', $bodyRaw['callback'], $data);
        } elseif ($bodyRaw !== null) {
            Reaction::warning(
                "The 'jsonp' response requires that the data be an array consisting of both 'data' and 'callback' elements."
            );
        }
        return '';
    }
protected function formatJsonp ( $ response ) { $ bodyRaw = $ response -> getRawBody ( ) ; if ( is_array ( $ bodyRaw ) && isset ( $ bodyRaw [ 'data' ] , $ bodyRaw [ 'callback' ] ) ) { $ data = $ response -> app instanceof Reaction \ RequestApplicationInterface ? $ response -> app -> helpers -> json -> htmlEncode ( $ bodyRaw [ 'data' ] ) : Json :: htmlEncode ( $ bodyRaw [ 'data' ] ) ; return sprintf ( '%s(%s);' , $ bodyRaw [ 'callback' ] , $ data ) ; } elseif ( $ bodyRaw !== null ) { Reaction :: warning ( "The 'jsonp' response requires that the data be an array consisting of both 'data' and 'callback' elements." ) ; } return '' ; }
Formats response data in JSONP format.
@param ResponseBuilderInterface $response
@return string
Formats response data in JSONP format .