private function sendResponse(MethodAbstract $method, RequestInterface $request, ResponseInterface $response, $data)
    {
        $statusCode = $response->getStatusCode();
        if (empty($statusCode)) {
            // in case we have only one defined response use this code
            $responses = $method->getResponses();
            if (count($responses) == 1) {
                $statusCode = key($responses);
            } else {
                $statusCode = 200;
            }

            $response->setStatus($statusCode);
        }

        $this->responseWriter->setBody($response, $data, $request);
    }
private function sendResponse(MethodAbstract $method, RequestInterface $request, ResponseInterface $response, $data)
    {
        $statusCode = $response->getStatusCode();
        if (empty($statusCode)) {
            // in case we have only one defined response use this code
            $responses = $method->getResponses();
            if (count($responses) == 1) {
                $statusCode = key($responses);
            } else {
                $statusCode = 200;
            }

            $response->setStatus($statusCode);
        }

        $this->responseWriter->setBody($response, $data, $request);
    }
private function sendResponse ( MethodAbstract $ method , RequestInterface $ request , ResponseInterface $ response , $ data ) { $ statusCode = $ response -> getStatusCode ( ) ; if ( empty ( $ statusCode ) ) { // in case we have only one defined response use this code $ responses = $ method -> getResponses ( ) ; if ( count ( $ responses ) == 1 ) { $ statusCode = key ( $ responses ) ; } else { $ statusCode = 200 ; } $ response -> setStatus ( $ statusCode ) ; } $ this -> responseWriter -> setBody ( $ response , $ data , $ request ) ; }
Checks whether a response schema is defined for the provided status code
and writes the data to the body if a status code is available. Otherwise
the API returns 204 no content

@param \PSX\Api\Resource\MethodAbstract $method
@param \PSX\Http\RequestInterface $request
@param \PSX\Http\ResponseInterface $response
@param mixed $data
Checks whether a response schema is defined for the provided status code and writes the data to the body if a status code is available . Otherwise the API returns 204 no content