Inheritance | yii\httpclient\Message » yii\base\Component » yii\base\Object |
---|---|
Implements | yii\base\Configurable |
Subclasses | yii\httpclient\Request, yii\httpclient\Response |
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-httpclient/blob/master/Message.php |
Message represents a base HTTP message.
Property | Type | Description | Defined By |
---|---|---|---|
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component | yii\base\Component |
$client | yii\httpclient\Client | Owner client instance. | yii\httpclient\Message |
$content | string | Raw content. | yii\httpclient\Message |
$cookies | yii\web\CookieCollection|yii\web\Cookie[]|array | Cookie collection or cookies list. | yii\httpclient\Message |
$data | mixed | Content data fields. | yii\httpclient\Message |
$format | string | Body format name. | yii\httpclient\Message |
$headers | array|yii\web\HeaderCollection | Headers collection or headers list in format: [headerName => headerValue] | yii\httpclient\Message |
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\Object |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__toString() | PHP magic method that returns the string representation of this object. | yii\httpclient\Message |
__unset() | Sets a component property to be null. | yii\base\Component |
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 |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\Object |
composeHeaderLines() | Composes raw header lines from $headers. | yii\httpclient\Message |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
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 |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasHeaders() | Checks of HTTP message contains any header. | yii\httpclient\Message |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
init() | Initializes the object. | yii\base\Object |
off() | Detaches an existing event handler from this component. | yii\base\Component |
on() | Attaches an event handler to an event. | yii\base\Component |
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 |
trigger() | Triggers an event. | yii\base\Component |
Method | Description | Defined By |
---|---|---|
defaultFormat() | Returns default format name. | yii\httpclient\Message |
Owner client instance.
public yii\httpclient\Client $client = null
Raw content.
public string getContent ( )
public $this setContent ( $content )
Cookie collection or cookies list.
public yii\web\CookieCollection|yii\web\Cookie[] getCookies ( )
public $this setCookies ( $cookies )
Content data fields.
public mixed getData ( )
public $this setData ( $data )
Body format name.
public string getFormat ( )
public $this setFormat ( $format )
Headers collection or headers list in format: [headerName => headerValue]
public yii\web\HeaderCollection getHeaders ( )
public $this setHeaders ( $headers )
PHP magic method that returns the string representation of this object.
public string __toString ( ) | ||
---|---|---|
return | string |
The string representation of this object. |
Adds more cookies to the already defined ones.
public $this addCookies ( array $cookies ) | ||
---|---|---|
$cookies | yii\web\Cookie[]|array |
Additional cookies. |
return | $this |
Self reference. |
Adds data fields to the existing ones.
public $this addData ( $data ) | ||
---|---|---|
$data | array |
Additional content data fields. |
return | $this |
Self reference. |
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. |
Composes raw header lines from $headers.
Each line will be a string in format: 'header-name: value'.
public array composeHeaderLines ( ) | ||
---|---|---|
return | array |
Raw header lines. |
Returns default format name.
protected string defaultFormat ( ) | ||
---|---|---|
return | string |
Default format name. |
Returns HTTP message raw content.
public string getContent ( ) | ||
---|---|---|
return | string |
Raw body. |
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. |
Returns the data fields, parsed from raw content.
public mixed getData ( ) | ||
---|---|---|
return | mixed |
Content data fields. |
Returns body format.
public string getFormat ( ) | ||
---|---|---|
return | string |
Body format name. |
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 |
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. |
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. |
Sets the HTTP message raw content.
public $this setContent ( $content ) | ||
---|---|---|
$content | string |
Raw content. |
return | $this |
Self reference. |
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. |
Sets the data fields, which composes message content.
public $this setData ( $data ) | ||
---|---|---|
$data | mixed |
Content data fields. |
return | $this |
Self reference. |
Sets body format.
public $this setFormat ( $format ) | ||
---|---|---|
$format | string |
Body format name. |
return | $this |
Self reference. |
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. |
Returns string representation of this HTTP message.
public string toString ( ) | ||
---|---|---|
return | string |
The string representation of this HTTP message. |
© 2008–2017 by Yii Software LLC
Licensed under the three clause BSD license.
http://www.yiiframework.com/doc-2.0/yii-httpclient-message.html