0 follower

Trait Yiisoft\DataResponse\ResponseContentTrait

Implemented byYiisoft\DataResponse\Formatter\HtmlDataResponseFormatter, Yiisoft\DataResponse\Formatter\JsonDataResponseFormatter, Yiisoft\DataResponse\Formatter\PlainTextDataResponseFormatter, Yiisoft\DataResponse\Formatter\XmlDataResponseFormatter

ResponseContentTrait provides methods for manipulating the response content.

Public Methods

Hide inherited methods

Method Description Defined By
withContentType() Returns a new instance with the specified content type. Yiisoft\DataResponse\ResponseContentTrait
withEncoding() Returns a new instance with the specified encoding. Yiisoft\DataResponse\ResponseContentTrait

Method Details

Hide inherited methods

withContentType() public method

Returns a new instance with the specified content type.

public self withContentType ( string $contentType )
$contentType string

The content type. For example, "text/html".

                public function withContentType(string $contentType): self
{
    $new = clone $this;
    $new->contentType = $contentType;
    return $new;
}

            
withEncoding() public method

Returns a new instance with the specified encoding.

public self withEncoding ( string $encoding )
$encoding string

The encoding. For example, "UTF-8".

                public function withEncoding(string $encoding): self
{
    $new = clone $this;
    $new->encoding = $encoding;
    return $new;
}