PHP Class yii\httpclient\Message

Since: 2.0
Author: Paul Klimov ([email protected])
Inheritance: extends yii\base\Component
Afficher le fichier Open project: yiisoft/yii2-httpclient Class Usage Examples

Méthodes publiques

Свойство Type Description
$client owner client instance.

Méthodes publiques

Méthode Description
__toString ( ) : string PHP magic method that returns the string representation of this object.
addCookies ( array $cookies ) Adds more cookies to the already defined ones.
addData ( array $data ) Adds data fields to the existing ones.
addHeaders ( array $headers ) Adds more headers to the already defined ones.
composeHeaderLines ( ) : array Composes raw header lines from [[headers]].
getContent ( ) : string Returns HTTP message raw content.
getCookies ( ) : CookieCollection | Cookie[] Returns the cookie collection.
getData ( ) : mixed Returns the data fields, parsed from raw content.
getFormat ( ) : string Returns body format.
getHeaders ( ) : HeaderCollection Returns the header collection.
hasCookies ( ) : boolean Checks of HTTP message contains any cookie.
hasHeaders ( ) : boolean Checks of HTTP message contains any header.
setContent ( string $content ) Sets the HTTP message raw content.
setCookies ( CookieCollection | Cookie[] | array $cookies ) Sets the cookies associated with HTTP message.
setData ( mixed $data ) Sets the data fields, which composes message content.
setFormat ( string $format ) Sets body format.
setHeaders ( array | HeaderCollection $headers ) Sets the HTTP headers associated with HTTP message.
toString ( ) : string Returns string representation of this HTTP message.

Méthodes protégées

Méthode Description
defaultFormat ( ) : string Returns default format name.

Method Details

__toString() public méthode

PHP magic method that returns the string representation of this object.
public __toString ( ) : string
Résultat string the string representation of this object.

addCookies() public méthode

Adds more cookies to the already defined ones.
public addCookies ( array $cookies )
$cookies array additional cookies.

addData() public méthode

Adds data fields to the existing ones.
Since: 2.0.1
public addData ( array $data )
$data array additional content data fields.

addHeaders() public méthode

Adds more headers to the already defined ones.
public addHeaders ( array $headers )
$headers array additional headers in format: [headerName => headerValue]

composeHeaderLines() public méthode

Each line will be a string in format: 'header-name: value'.
public composeHeaderLines ( ) : array
Résultat array raw header lines.

defaultFormat() protected méthode

Returns default format name.
protected defaultFormat ( ) : string
Résultat string default format name.

getContent() public méthode

Returns HTTP message raw content.
public getContent ( ) : string
Résultat string raw body.

getCookies() public méthode

The cookie collection contains the cookies associated with HTTP message.
public getCookies ( ) : CookieCollection | Cookie[]
Résultat yii\web\CookieCollection | yii\web\Cookie[] the cookie collection.

getData() public méthode

Returns the data fields, parsed from raw content.
public getData ( ) : mixed
Résultat mixed content data fields.

getFormat() public méthode

Returns body format.
public getFormat ( ) : string
Résultat string body format name.

getHeaders() public méthode

The header collection contains the HTTP headers associated with HTTP message.
public getHeaders ( ) : HeaderCollection
Résultat yii\web\HeaderCollection the header collection

hasCookies() public méthode

Using this method you are able to check cookie presence without instantiating [[CookieCollection]].
public hasCookies ( ) : boolean
Résultat boolean whether message contains any cookie.

hasHeaders() public méthode

Using this method you are able to check cookie presence without instantiating [[HeaderCollection]].
public hasHeaders ( ) : boolean
Résultat boolean whether message contains any header.

setContent() public méthode

Sets the HTTP message raw content.
public setContent ( string $content )
$content string raw content.

setCookies() public méthode

Sets the cookies associated with HTTP message.
public setCookies ( CookieCollection | Cookie[] | array $cookies )
$cookies yii\web\CookieCollection | yii\web\Cookie[] | array cookie collection or cookies list.

setData() public méthode

Sets the data fields, which composes message content.
public setData ( mixed $data )
$data mixed content data fields.

setFormat() public méthode

Sets body format.
public setFormat ( string $format )
$format string body format name.

setHeaders() public méthode

Sets the HTTP headers associated with HTTP message.
public setHeaders ( array | HeaderCollection $headers )
$headers array | yii\web\HeaderCollection headers collection or headers list in format: [headerName => headerValue]

toString() public méthode

Returns string representation of this HTTP message.
public toString ( ) : string
Résultat string the string representation of this HTTP message.

Property Details

$client public_oe property

owner client instance.
public $client