public function getResponse($code = ResponseCode::NO_CONTENT, $content = null, $headers = [])
    {
        $response = clone $this->baseResponse;

        if ($code !== false) {
            $response->setStatus($code);
        }

        if ($content !== false) {
            $response->setBody($content);
        }

        if ($this->headersMode === self::HEADERS_MODE_ADD) {
            foreach ($headers as $name => $value) {
                $response->addHeader($name, $value);
            }

        } else {
            foreach ($headers as $name => $value) {
                $response->setHeader($name, $value);
            }
        }

        return $response;
    }
public function getResponse($code = ResponseCode::NO_CONTENT, $content = null, $headers = [])
    {
        $response = clone $this->baseResponse;

        if ($code !== false) {
            $response->setStatus($code);
        }

        if ($content !== false) {
            $response->setBody($content);
        }

        if ($this->headersMode === self::HEADERS_MODE_ADD) {
            foreach ($headers as $name => $value) {
                $response->addHeader($name, $value);
            }

        } else {
            foreach ($headers as $name => $value) {
                $response->setHeader($name, $value);
            }
        }

        return $response;
    }
public function getResponse ( $ code = ResponseCode :: NO_CONTENT , $ content = null , $ headers = [ ] ) { $ response = clone $ this -> baseResponse ; if ( $ code !== false ) { $ response -> setStatus ( $ code ) ; } if ( $ content !== false ) { $ response -> setBody ( $ content ) ; } if ( $ this -> headersMode === self :: HEADERS_MODE_ADD ) { foreach ( $ headers as $ name => $ value ) { $ response -> addHeader ( $ name , $ value ) ; } } else { foreach ( $ headers as $ name => $ value ) { $ response -> setHeader ( $ name , $ value ) ; } } return $ response ; }
Produces response with default values.

@param int|false   $code    Code to use. If you pass false code will be derived from base response.
@param null|false  $content Content to use in new response. If you pass false content from default response will
be used.
@param array|false $headers Additional headers to add to new response.

@return ResponseInterface
Produces response with default values .