protected function setResponseData(Response $response, array $data)
    {
        if ($response instanceof JsonResponse) {
            /** @var $response JsonResponse */
            return $response->setData($data);
        }

        $content = json_encode($data, JsonResponse::DEFAULT_ENCODING_OPTIONS);

        return $response->setContent($content);
    }
protected function setResponseData(Response $response, array $data)
    {
        if ($response instanceof JsonResponse) {
            /** @var $response JsonResponse */
            return $response->setData($data);
        }

        $content = json_encode($data, JsonResponse::DEFAULT_ENCODING_OPTIONS);

        return $response->setContent($content);
    }
protected function setResponseData ( Response $ response , array $ data ) { if ( $ response instanceof JsonResponse ) { /** @var $response JsonResponse */ return $ response -> setData ( $ data ) ; } $ content = json_encode ( $ data , JsonResponse :: DEFAULT_ENCODING_OPTIONS ) ; return $ response -> setContent ( $ content ) ; }
Updates the response content

@param Response $response
@param array    $data
@return JsonResponse|Response
Updates the response content