Class yii\httpclient\Message

Inheritanceyii\httpclient\Message » yii\base\Component
Subclassesyii\httpclient\Request, yii\httpclient\Response
Available since version2.0

Message represents a base HTTP message.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$client yii\httpclient\Client Owner client instance. yii\httpclient\Message

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__toString() PHP magic method that returns the string representation of this object. yii\httpclient\Message
addCookies() Adds more cookies to the already defined ones. yii\httpclient\Message
addData() Adds data fields to the existing ones. yii\httpclient\Message
addHeaders() Adds more headers to the already defined ones. yii\httpclient\Message
composeHeaderLines() Composes raw header lines from \yii\httpclient\headers. yii\httpclient\Message
getContent() Returns HTTP message raw content. yii\httpclient\Message
getCookies() Returns the cookie collection. yii\httpclient\Message
getData() Returns the data fields, parsed from raw content. yii\httpclient\Message
getFormat() Returns body format. yii\httpclient\Message
getHeaders() Returns the header collection. yii\httpclient\Message
hasCookies() Checks of HTTP message contains any cookie. yii\httpclient\Message
hasHeaders() Checks of HTTP message contains any header. yii\httpclient\Message
setContent() Sets the HTTP message raw content. yii\httpclient\Message
setCookies() Sets the cookies associated with HTTP message. yii\httpclient\Message
setData() Sets the data fields, which composes message content. yii\httpclient\Message
setFormat() Sets body format. yii\httpclient\Message
setHeaders() Sets the HTTP headers associated with HTTP message. yii\httpclient\Message
toString() Returns string representation of this HTTP message. yii\httpclient\Message

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
defaultFormat() Returns default format name. yii\httpclient\Message

Property Details

$client public property

Owner client instance.

Method Details

__toString() public method

PHP magic method that returns the string representation of this object.

public string __toString ( )
return string

The string representation of this object.

addCookies() public method

Adds more cookies to the already defined ones.

public $this addCookies ( array $cookies )
$cookies \yii\web\Cookie[]|array

Additional cookies.

return $this

Self reference.

addData() public method (available since version 2.0.1)

Adds data fields to the existing ones.

public $this addData ( $data )
$data array

Additional content data fields.

return $this

Self reference.

addHeaders() public method

Adds more headers to the already defined ones.

public $this addHeaders ( array $headers )
$headers array

Additional headers in format: [headerName => headerValue]

return $this

Self reference.

composeHeaderLines() public method

Composes raw header lines from \yii\httpclient\headers.

Each line will be a string in format: 'header-name: value'.

public array composeHeaderLines ( )
return array

Raw header lines.

defaultFormat() protected method

Returns default format name.

protected string defaultFormat ( )
return string

Default format name.

getContent() public method

Returns HTTP message raw content.

public string getContent ( )
return string

Raw body.

getCookies() public method

Returns the cookie collection.

The cookie collection contains the cookies associated with HTTP message.

public \yii\web\CookieCollection|\yii\web\Cookie[] getCookies ( )
return \yii\web\CookieCollection|\yii\web\Cookie[]

The cookie collection.

getData() public method

Returns the data fields, parsed from raw content.

public mixed getData ( )
return mixed

Content data fields.

getFormat() public method

Returns body format.

public string getFormat ( )
return string

Body format name.

getHeaders() public method

Returns the header collection.

The header collection contains the HTTP headers associated with HTTP message.

public \yii\web\HeaderCollection getHeaders ( )
return \yii\web\HeaderCollection

The header collection

hasCookies() public method

Checks of HTTP message contains any cookie.

Using this method you are able to check cookie presence without instantiating \yii\web\CookieCollection.

public boolean hasCookies ( )
return boolean

Whether message contains any cookie.

hasHeaders() public method

Checks of HTTP message contains any header.

Using this method you are able to check cookie presence without instantiating \yii\web\HeaderCollection.

public boolean hasHeaders ( )
return boolean

Whether message contains any header.

setContent() public method

Sets the HTTP message raw content.

public $this setContent ( $content )
$content string

Raw content.

return $this

Self reference.

setCookies() public method

Sets the cookies associated with HTTP message.

public $this setCookies ( $cookies )
$cookies \yii\web\CookieCollection|\yii\web\Cookie[]|array

Cookie collection or cookies list.

return $this

Self reference.

setData() public method

Sets the data fields, which composes message content.

public $this setData ( $data )
$data mixed

Content data fields.

return $this

Self reference.

setFormat() public method

Sets body format.

public $this setFormat ( $format )
$format string

Body format name.

return $this

Self reference.

setHeaders() public method

Sets the HTTP headers associated with HTTP message.

public $this setHeaders ( $headers )
$headers array|\yii\web\HeaderCollection

Headers collection or headers list in format: [headerName => headerValue]

return $this

Self reference.

toString() public method

Returns string representation of this HTTP message.

public string toString ( )
return string

The string representation of this HTTP message.