PHP Класс Webiny\Component\Http\Response

Наследование: use trait Webiny\Component\StdLib\StdObjectTrait
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$httpStatuses An array of http status codes by RFC2616 standard or some other if noted by comment.

Открытые методы

Метод Описание
__construct ( string $content = '', integer $statusCode = 200, array $headers = [] ) Constructs the Response object.
cacheControl ( ) : CacheControl Get access to cache control headers.
create ( string $content = '', integer $statusCode = 200, array $headers = [] ) : Response Static constructor.
getCharset ( ) : string Returns currently set response charset.
getContent ( ) : string Get response content.
getContentType ( ) : string Returns the currently set content type.
getHeaders ( ) : array Returns an array of current headers.
getStatusCode ( ) : integer Returns current status code.
send ( ) Sends both the headers and the content to the browser.
sendContent ( ) Sends the content to the browser.
sendHeaders ( ) Send the currently defined headers.
setAsNotModified ( ) Sets the response as not modified.
setCharset ( string $charset ) Set the response charset.
setContent ( string $content ) Set response content.
setContentType ( string $contentType ) Sets the Content-Type header value.
setHeader ( string $key, string $value ) Sets or adds a header.
setStatusCode ( integer $statusCode, string $message = '' ) Set HTTP response status code. The status code must be a valid HTTP status code, or an exception will be thrown.

Описание методов

__construct() публичный Метод

Constructs the Response object.
public __construct ( string $content = '', integer $statusCode = 200, array $headers = [] )
$content string Content that will be attached to the response.
$statusCode integer HTTP status code that will be sent back to the user.
$headers array Additional headers that should be attached to the response.

cacheControl() публичный Метод

Get access to cache control headers.
public cacheControl ( ) : CacheControl
Результат Webiny\Component\Http\Response\CacheControl

create() публичный статический Метод

Static constructor.
public static create ( string $content = '', integer $statusCode = 200, array $headers = [] ) : Response
$content string Content that will be attached to the response.
$statusCode integer HTTP status code that will be sent back to the user.
$headers array Additional headers that should be attached to the response.
Результат Response

getCharset() публичный Метод

Returns currently set response charset.
public getCharset ( ) : string
Результат string

getContent() публичный Метод

Get response content.
public getContent ( ) : string
Результат string

getContentType() публичный Метод

Returns the currently set content type.
public getContentType ( ) : string
Результат string

getHeaders() публичный Метод

Returns an array of current headers.
public getHeaders ( ) : array
Результат array

getStatusCode() публичный Метод

Returns current status code.
public getStatusCode ( ) : integer
Результат integer

send() публичный Метод

Sends both the headers and the content to the browser.
public send ( )

sendContent() публичный Метод

Sends the content to the browser.
public sendContent ( )

sendHeaders() публичный Метод

This also sends the cache control headers.
public sendHeaders ( )

setAsNotModified() публичный Метод

Sets the response as not modified.
public setAsNotModified ( )

setCharset() публичный Метод

Set the response charset.
public setCharset ( string $charset )
$charset string Charset name.

setContent() публичный Метод

Set response content.
public setContent ( string $content )
$content string Response content.

setContentType() публичный Метод

Sets the Content-Type header value.
public setContentType ( string $contentType )
$contentType string

setHeader() публичный Метод

Sets or adds a header.
public setHeader ( string $key, string $value )
$key string Header name.
$value string Header value.

setStatusCode() публичный Метод

Set HTTP response status code. The status code must be a valid HTTP status code, or an exception will be thrown.
public setStatusCode ( integer $statusCode, string $message = '' )
$statusCode integer Http status code.
$message string Http status message. If not set we will use the default message by RFC2616.

Описание свойств

$httpStatuses публичное статическое свойство

An array of http status codes by RFC2616 standard or some other if noted by comment.
public static $httpStatuses