PHP Класс Neos\Flow\Http\Response

Наследование: extends AbstractMessage, implements Neos\Flow\Mvc\ResponseInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$now DateTime The current point in time, used for comparisons
$parentResponse Response
$statusCode integer The HTTP status code
$statusMessage string The HTTP status message

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

Метод Описание
__construct ( Response $parentResponse = null ) Construct this Response
__toString ( ) : string Cast the response to a string: return the content part of this response
appendContent ( string $content ) : Response Appends content to the already existing content.
createFromRaw ( string $rawResponse, Response $parentResponse = null ) : Response Creates a response from the given raw, that is plain text, HTTP response.
getAge ( ) : integer Returns the age of this responds in seconds.
getContent ( ) : string Returns the response content without sending it.
getDate ( ) : DateTime Returns the date from the Date header.
getExpires ( ) : DateTime Returns the date from the Expires header or NULL if no such header is present.
getLastModified ( ) : DateTime Returns the date from the Last-Modified header or NULL if no such header is present.
getMaximumAge ( ) : integer Returns the maximum age in seconds before this response becomes stale.
getParentResponse ( ) : Response Return the parent response or NULL if none exists.
getSharedMaximumAge ( ) : integer Returns the maximum age in seconds before this response becomes stale in shared caches, such as proxies.
getStartLine ( ) : string Returns the first line of this Response Message, which is the Status-Line in this case
getStatus ( ) : string Returns status code and status message.
getStatusCode ( ) : integer Returns the status code.
getStatusLine ( ) : string Return the Status-Line of this Response Message, consisting of the version, the status code and the reason phrase Would be, for example, "HTTP/1.1 200 OK" or "HTTP/1.1 400 Bad Request"
getStatusMessageByCode ( integer $statusCode ) : string Returns the human-readable message for the given status code.
makeStandardsCompliant ( Request $request ) : void Analyzes this response, considering the given request and makes additions or removes certain headers in order to make the response compliant to RFC 2616 and related standards.
renderHeaders ( ) : array Renders the HTTP headers - including the status header - of this response
send ( ) : void Renders and sends the whole web response
sendHeaders ( ) : void Sends the HTTP headers.
setDate ( string | DateTime $date ) : Response Sets the Date header.
setExpires ( string | DateTime $date ) : Response Sets the Expires header.
setHeaders ( Headers $headers ) : void Replaces all possibly existing HTTP headers with the ones specified
setLastModified ( string | DateTime $date ) : Response Sets the Last-Modified header.
setMaximumAge ( integer $age ) : Response Sets the maximum age in seconds before this response becomes stale.
setNow ( DateTime $now ) : void Sets the current point in time.
setPrivate ( ) : Response Sets the respective directive in the Cache-Control header.
setPublic ( ) : Response Sets the respective directive in the Cache-Control header.
setSharedMaximumAge ( integer $maximumAge ) : Response Sets the maximum age in seconds before this response becomes stale in shared caches, such as proxies.
setStatus ( integer $code, string $message = null ) : Response Sets the HTTP status code and (optionally) a customized message.

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

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

Construct this Response
public __construct ( Response $parentResponse = null )
$parentResponse Response

__toString() публичный метод

Cast the response to a string: return the content part of this response
public __toString ( ) : string
Результат string The same as getContent(), an empty string if getContent() returns a value which can't be cast into a string

appendContent() публичный метод

Appends content to the already existing content.
public appendContent ( string $content ) : Response
$content string More response content
Результат Response This response, for method chaining

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

Creates a response from the given raw, that is plain text, HTTP response.
public static createFromRaw ( string $rawResponse, Response $parentResponse = null ) : Response
$rawResponse string
$parentResponse Response Parent response, if called recursively
Результат Response

getAge() публичный метод

The age is determined either by an explicitly set Age header or by the difference between Date and "now". Note that, according to RFC 2616 / 13.2.3, the presence of an Age header implies that the response is not first-hand. You should therefore only explicitly set an Age header if this is the case.
public getAge ( ) : integer
Результат integer The age in seconds

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

Returns the response content without sending it.
public getContent ( ) : string
Результат string The response content

getDate() публичный метод

The returned date is configured to be in the GMT timezone.
public getDate ( ) : DateTime
Результат DateTime The date of this response

getExpires() публичный метод

The returned date is configured to be in the GMT timezone.
public getExpires ( ) : DateTime
Результат DateTime The expiration date or NULL

getLastModified() публичный метод

The returned date is configured to be in the GMT timezone.
public getLastModified ( ) : DateTime
Результат DateTime The last modification date or NULL

getMaximumAge() публичный метод

This method returns the value from the "max-age" directive in the Cache-Control header.
public getMaximumAge ( ) : integer
Результат integer The maximum age in seconds, or NULL if none has been defined

getParentResponse() публичный метод

Return the parent response or NULL if none exists.
public getParentResponse ( ) : Response
Результат Response the parent response, or NULL if none

getSharedMaximumAge() публичный метод

This method returns the value from the "s-maxage" directive in the Cache-Control header.
public getSharedMaximumAge ( ) : integer
Результат integer The maximum age in seconds, or NULL if none has been defined

getStartLine() публичный метод

Returns the first line of this Response Message, which is the Status-Line in this case
См. также: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html chapter 4.1 "Message Types"
public getStartLine ( ) : string
Результат string The Status-Line of this Response

getStatus() публичный метод

Returns status code and status message.
public getStatus ( ) : string
Результат string The status code and status message, eg. "404 Not Found"

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

Returns the status code.
public getStatusCode ( ) : integer
Результат integer The status code, eg. 404

getStatusLine() публичный метод

Return the Status-Line of this Response Message, consisting of the version, the status code and the reason phrase Would be, for example, "HTTP/1.1 200 OK" or "HTTP/1.1 400 Bad Request"
См. также: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1
public getStatusLine ( ) : string
Результат string

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

Returns the human-readable message for the given status code.
public static getStatusMessageByCode ( integer $statusCode ) : string
$statusCode integer
Результат string

makeStandardsCompliant() публичный метод

It is recommended to call this method before the response is sent and Flow does so by default in its built-in HTTP request handler.
public makeStandardsCompliant ( Request $request ) : void
$request Request The corresponding request
Результат void

renderHeaders() публичный метод

Renders the HTTP headers - including the status header - of this response
public renderHeaders ( ) : array
Результат array The HTTP headers

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

Renders and sends the whole web response
public send ( ) : void
Результат void

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

If headers have been sent previously, this method fails silently.
public sendHeaders ( ) : void
Результат void

setDate() публичный метод

The given date must either be an RFC2822 parseable date string or a DateTime object. The timezone will be converted to GMT internally, but the point in time remains the same.
public setDate ( string | DateTime $date ) : Response
$date string | DateTime
Результат Response This response, for method chaining

setExpires() публичный метод

The given date must either be an RFC2822 parseable date string or a DateTime object. The timezone will be converted to GMT internally, but the point in time remains the same. In order to signal that the response has already expired, the date should be set to the same date as the Date header (that is, $now). To communicate an infinite expiration time, the date should be set to one year in the future. Expiration times should not be more than one year in the future, according to RFC 2616 / 14.21
public setExpires ( string | DateTime $date ) : Response
$date string | DateTime
Результат Response This response, for method chaining

setHeaders() публичный метод

Replaces all possibly existing HTTP headers with the ones specified
public setHeaders ( Headers $headers ) : void
$headers Headers
Результат void

setLastModified() публичный метод

The given date must either be an RFC2822 parseable date string or a DateTime object. The timezone will be converted to GMT internally, but the point in time remains the same.
public setLastModified ( string | DateTime $date ) : Response
$date string | DateTime
Результат Response This response, for method chaining

setMaximumAge() публичный метод

This method sets the "max-age" directive in the Cache-Control header.
public setMaximumAge ( integer $age ) : Response
$age integer The maximum age in seconds
Результат Response This response, for method chaining

setNow() публичный метод

This date / time is used internally for comparisons in order to determine the freshness of this response. By default this DateTime object is set automatically through dependency injection, configured in the Objects.yaml of the Flow package. Unless you are mocking the current time in a test, there is probably no need to use this function. Also note that this method must be called before any of the Response methods are used and it must not be called a second time.
public setNow ( DateTime $now ) : void
$now DateTime The current point in time
Результат void

setPrivate() публичный метод

A response flagged as "private" tells that it is intended for a specific user and must not be cached by a shared cache.
public setPrivate ( ) : Response
Результат Response This response, for method chaining

setPublic() публичный метод

A response flagged as "public" may be cached by any cache, even if it normally wouldn't be cacheable in a shared cache.
public setPublic ( ) : Response
Результат Response This response, for method chaining

setSharedMaximumAge() публичный метод

This method sets the "s-maxage" directive in the Cache-Control header.
public setSharedMaximumAge ( integer $maximumAge ) : Response
$maximumAge integer The maximum age in seconds
Результат Response This response, for method chaining

setStatus() публичный метод

Sets the HTTP status code and (optionally) a customized message.
public setStatus ( integer $code, string $message = null ) : Response
$code integer The status code
$message string If specified, this message is sent instead of the standard message
Результат Response This response, for method chaining

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

$now защищенное свойство

The current point in time, used for comparisons
protected DateTime $now
Результат DateTime

$parentResponse защищенное свойство

protected Response,Neos\Flow\Http $parentResponse
Результат Response

$statusCode защищенное свойство

The HTTP status code
protected int $statusCode
Результат integer

$statusMessage защищенное свойство

The HTTP status message
protected string $statusMessage
Результат string