Dingo\Blueprint\Blueprint::appendResponse PHP Method

appendResponse() protected method

Append a response subsection to an action.
protected appendResponse ( string &$contents, Dingo\Blueprint\Annotation\Response $response, Resource $resource ) : void
$contents string
$response Dingo\Blueprint\Annotation\Response
$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));
        }
    }