PHP Interface Icicle\Http\Message\Message

Datei anzeigen Open project: icicleio/http

Public Methods

Method Description
getBody ( ) : Icicle\Stream\ReadableStream Returns the stream for the message body.
getHeader ( string $name ) : string Returns the value of the given header. If multiple headers were present for the named header, only the first header value will be returned. Use getHeaderAsArray() to return an array of all values for the particular header.
getHeaderAsArray ( string $name ) : array Returns the array of values for the given header or an empty array if the header does not exist.
getHeaders ( ) : array Returns the message headers as a string-indexed array of arrays of strings or an empty array if no headers have been set.
getProtocolVersion ( ) : string
hasHeader ( string $name ) : boolean Determines if the message has the given header.
withAddedHeader ( string $name, string | string[] $value ) : Icicle\Http\Message\Message Returns a new instance with the given value added to the named header. If the header did not exist, the header is created with the given value.
withBody ( Icicle\Stream\ReadableStream $stream ) : Icicle\Http\Message\Message Returns a new instance with the given stream for the message body.
withHeader ( string $name, string | string[] $value ) : Icicle\Http\Message\Message Returns a new instance with the given header. $value may be a string or an array of strings.
withProtocolVersion ( string $version ) : Icicle\Http\Message\Message Returns a new instance with the given protocol version.
withoutHeader ( string $name ) : Icicle\Http\Message\Message Returns a new instance without the given header.

Method Details

getBody() public method

Returns the stream for the message body.
public getBody ( ) : Icicle\Stream\ReadableStream
return Icicle\Stream\ReadableStream

getHeader() public method

Returns an empty string if the header does not exist.
public getHeader ( string $name ) : string
$name string
return string

getHeaderAsArray() public method

Returns the array of values for the given header or an empty array if the header does not exist.
public getHeaderAsArray ( string $name ) : array
$name string
return array

getHeaders() public method

Returns the message headers as a string-indexed array of arrays of strings or an empty array if no headers have been set.
public getHeaders ( ) : array
return array

getProtocolVersion() public method

public getProtocolVersion ( ) : string
return string

hasHeader() public method

Determines if the message has the given header.
public hasHeader ( string $name ) : boolean
$name string
return boolean

withAddedHeader() public method

Returns a new instance with the given value added to the named header. If the header did not exist, the header is created with the given value.
public withAddedHeader ( string $name, string | string[] $value ) : Icicle\Http\Message\Message
$name string
$value string | string[]
return Icicle\Http\Message\Message

withBody() public method

Returns a new instance with the given stream for the message body.
public withBody ( Icicle\Stream\ReadableStream $stream ) : Icicle\Http\Message\Message
$stream Icicle\Stream\ReadableStream
return Icicle\Http\Message\Message

withHeader() public method

Returns a new instance with the given header. $value may be a string or an array of strings.
public withHeader ( string $name, string | string[] $value ) : Icicle\Http\Message\Message
$name string
$value string | string[]
return Icicle\Http\Message\Message

withProtocolVersion() public method

Returns a new instance with the given protocol version.
public withProtocolVersion ( string $version ) : Icicle\Http\Message\Message
$version string
return Icicle\Http\Message\Message

withoutHeader() public method

Returns a new instance without the given header.
public withoutHeader ( string $name ) : Icicle\Http\Message\Message
$name string
return Icicle\Http\Message\Message