/**
* Append a response subsection to an action.
*
* @param string $contents
* @param \Dingo\Blueprint\Annotation\Response $response
* @param \Dingo\Blueprint\Resource $resource
*
* @return void
*/
protected function appendResponse(&$contents, Annotation\Response $response, Resource $resource)
{
$this->appendSection($contents, sprintf('Response %s', $response->statusCode));
if (isset($response->contentType)) {
$contents .= ' (' . $response->contentType . ')';
}
if (!empty($response->headers) || $resource->hasResponseHeaders()) {
$this->appendHeaders($contents, array_merge($resource->getResponseHeaders(), $response->headers));
}
if (isset($response->attributes)) {
$this->appendAttributes($contents, collect($response->attributes), 1);
}
if (isset($response->body)) {
$this->appendBody($contents, $this->prepareBody($response->body, $response->contentType));
}
}