lib/DataSift/ApiClient.php
protected static function decodeBody(array $res)
    {
        $format = isset($res['headers']['x-datasift-format'])
            ? $res['headers']['x-datasift-format']
            : $res['headers']['content-type'];
        $retval = array();

        if (strtolower($format) == 'json_new_line') {
            foreach (explode("\n", $res['body']) as $json_string) {
                $retval[] = json_decode($json_string, true);
            }
        } else {
            $retval = json_decode($res['body'], true);
        }

        return $retval;
    }
protected static function decodeBody(array $res)
    {
        $format = isset($res['headers']['x-datasift-format'])
            ? $res['headers']['x-datasift-format']
            : $res['headers']['content-type'];
        $retval = array();

        if (strtolower($format) == 'json_new_line') {
            foreach (explode("\n", $res['body']) as $json_string) {
                $retval[] = json_decode($json_string, true);
            }
        } else {
            $retval = json_decode($res['body'], true);
        }

        return $retval;
    }
protected static function decodeBody ( array $ res ) { $ format = isset ( $ res [ 'headers' ] [ 'x-datasift-format' ] ) ? $ res [ 'headers' ] [ 'x-datasift-format' ] : $ res [ 'headers' ] [ 'content-type' ] ; $ retval = array ( ) ; if ( strtolower ( $ format ) == 'json_new_line' ) { foreach ( explode ( "\n" , $ res [ 'body' ] ) as $ json_string ) { $ retval [ ] = json_decode ( $ json_string , true ) ; } } else { $ retval = json_decode ( $ res [ 'body' ] , true ) ; } return $ retval ; }
Decode the JSON response depending on the format.

@param array $res The parsed HTTP response.

@return array An array of the decoded JSON response
Decode the JSON response depending on the format .