PHP Class Neos\Flow\Http\AbstractMessage

Exibir arquivo Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$charset string
$content string Entity body of this message
$headers Headers
$version string The HTTP version value of this message, for example "HTTP/1.1"

Public Methods

Method Description
__construct ( )
getCharset ( ) : string Returns the character set of this response.
getContent ( ) : string Returns the content of the message body
getCookie ( string $name ) : Cookie Returns a cookie specified by the given name
getCookies ( ) : array Returns all cookies attached to the headers of this message
getHeader ( string $name ) : array | string Returns the value(s) of the specified header
getHeaders ( ) : Headers Returns the HTTP headers of this request
getStartLine ( ) : string Returns the first line of this message, which is the Request's Request-Line or the Response's Status-Line.
getVersion ( ) : string Returns the HTTP version value of this message, for example "HTTP/1.1"
hasCookie ( string $name ) : boolean Checks if the specified cookie exists
hasHeader ( string $name ) : boolean Checks if the specified header exists.
removeCookie ( string $name ) : void Removes the specified cookie from the headers of this message, if it exists
setCharset ( string $charset ) : self Sets the character set for this message.
setContent ( string $content ) : self Explicitly sets the content of the message body
setCookie ( Cookie $cookie ) : void Sets the given cookie to in the headers of this message.
setHeader ( string $name, array | string | DateTime $values, boolean $replaceExistingHeader = true ) : self Sets the specified HTTP header
setVersion ( string $version ) : void Sets the HTTP version value of this message, for example "HTTP/1.1"

Method Details

__construct() public method

public __construct ( )

getCharset() public method

Note that the default character in Flow is UTF-8.
public getCharset ( ) : string
return string An IANA character set identifier

getContent() public method

Returns the content of the message body
public getContent ( ) : string
return string The response content

getCookie() public method

This is a shortcut for $message->getHeaders()->getCookie($name);
public getCookie ( string $name ) : Cookie
$name string Name of the cookie
return Cookie The cookie or NULL if no such cookie exists

getCookies() public method

This is a shortcut for $message->getHeaders()->getCookies();
public getCookies ( ) : array
return array An array of Cookie objects

getHeader() public method

If one such header exists, the value is returned as a single string. If multiple headers of that name exist, the values are returned as an array. If no such header exists, NULL is returned. Dates are returned as DateTime objects with the timezone set to GMT.
public getHeader ( string $name ) : array | string
$name string Name of the header
return array | string An array of field values if multiple headers of that name exist, a string value if only one value exists and NULL if there is no such header.

getHeaders() public method

Returns the HTTP headers of this request
public getHeaders ( ) : Headers
return Headers

getStartLine() abstract public method

Returns the first line of this message, which is the Request's Request-Line or the Response's Status-Line.
See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html chapter 4.1 "Message Types"
abstract public getStartLine ( ) : string
return string The first line of the message

getVersion() public method

Returns the HTTP version value of this message, for example "HTTP/1.1"
public getVersion ( ) : string
return string

hasCookie() public method

This is a shortcut for $message->getHeaders()->hasCookie($name);
public hasCookie ( string $name ) : boolean
$name string Name of the cookie
return boolean

hasHeader() public method

Checks if the specified header exists.
public hasHeader ( string $name ) : boolean
$name string Name of the HTTP header
return boolean

removeCookie() public method

This is a shortcut for $message->getHeaders()->removeCookie($name); Note: This will remove the cookie object from this Headers container. If you intend to remove a cookie in the user agent (browser), you should call the cookie's expire() method and _not_ remove the cookie from the Headers container.
public removeCookie ( string $name ) : void
$name string Name of the cookie to remove
return void

setCharset() public method

If the content type of this message is a text/* media type, the character set in the respective Content-Type header will be updated by this method.
See also: http://www.iana.org/assignments/character-sets
public setCharset ( string $charset ) : self
$charset string A valid IANA character set identifier
return self This message, for method chaining

setContent() public method

Explicitly sets the content of the message body
public setContent ( string $content ) : self
$content string The body content
return self This message, for method chaining

setCookie() public method

This is a shortcut for $message->getHeaders()->setCookie($cookie);
public setCookie ( Cookie $cookie ) : void
$cookie Cookie The cookie to set
return void

setHeader() public method

DateTime objects will be converted to a string representation internally but will be returned as DateTime objects on calling getHeader(). Please note that dates are normalized to GMT internally, so that getHeader() will return the same point in time, but not necessarily in the same timezone, if it was not GMT previously. GMT is used synonymously with UTC as per RFC 2616 3.3.1.
public setHeader ( string $name, array | string | DateTime $values, boolean $replaceExistingHeader = true ) : self
$name string Name of the header, for example "Location", "Content-Description" etc.
$values array | string | DateTime An array of values or a single value for the specified header field
$replaceExistingHeader boolean If a header with the same name should be replaced. Default is TRUE.
return self This message, for method chaining

setVersion() public method

Sets the HTTP version value of this message, for example "HTTP/1.1"
public setVersion ( string $version ) : void
$version string
return void

Property Details

$charset protected_oe property

protected string $charset
return string

$content protected_oe property

Entity body of this message
protected string $content
return string

$headers protected_oe property

protected Headers,Neos\Flow\Http $headers
return Headers

$version protected_oe property

The HTTP version value of this message, for example "HTTP/1.1"
protected string $version
return string