BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
HttpMessage Class Reference
Inheritance diagram for HttpMessage:
Collaboration diagram for HttpMessage:

Public Member Functions

 __construct ($message=null)
 
 getBody ()
 
 setBody ($body)
 
 getHeader ($header)
 
 getHeaders ()
 
 setHeaders (sarray $header)
 
 addHeaders (array $headers, $append=null)
 
 getType ()
 
 setType ($type)
 
 getInfo ()
 
 setInfo ($http_info)
 
 getResponseCode ()
 
 setResponseCode ($code)
 
 getResponseStatus ()
 
 setResponseStatus ($status)
 
 getRequestMethod ()
 
 setRequestMethod ($method)
 
 getRequestUrl ()
 
 setRequestUrl ($url)
 
 getHttpVersion ()
 
 setHttpVersion ($version)
 
 guessContentType ($magic_file, $magic_mode=null)
 
 getParentMessage ()
 
 send ()
 
 toString ($include_parent=null)
 
 toMessageTypeObject ()
 
 count ()
 
 serialize ()
 
 unserialize ($serialized)
 
 rewind ()
 
 valid ()
 
 current ()
 
 key ()
 
 next ()
 
 __toString ()
 
 detach ()
 
 prepend (HttpMessage $message, $top=null)
 
 reverse ()
 

Static Public Member Functions

static factory ($raw_message=null, $class_name=null)
 
static fromString ($raw_message=null, $class_name=null)
 
static fromEnv ($message_type, $class_name=null)
 

Public Attributes

const TYPE_NONE = 0
 
const TYPE_REQUEST = 1
 
const TYPE_RESPONSE = 2
 

Protected Attributes

 $type
 
 $body
 
 $requestMethod
 
 $requestUrl
 
 $responseStatus
 
 $responseCode
 
 $httpVersion
 
 $headers
 
 $parentMessage
 

Detailed Description

Constructor & Destructor Documentation

HttpMessage::__construct (   $message = null)

(PECL pecl_http >= 0.10.0)
HttpMessage constructor string $message [optional] a single or several consecutive HTTP messages

Returns
void

Member Function Documentation

HttpMessage::__toString ( )
Returns
string
HttpMessage::addHeaders ( array  $headers,
  $append = null 
)

(PECL pecl_http >= 0.10.0)
Add headers array $headers associative array containing the additional HTTP headers to add to the messages existing headers

Parameters
bool$append[optional]

if true, and a header with the same name of one to add exists already, this respective header will be converted to an array containing both header values, otherwise it will be overwritten with the new header value

Returns
void true on success or false on failure.
HttpMessage::count ( )

Count elements of an object int The custom count as an integer.

The return value is cast to an integer.

Since
5.1.0

Implements Countable.

HttpMessage::current ( )

Return the current element mixed Can return any type. 5.0.0

Implements Iterator.

HttpMessage::detach ( )
static HttpMessage::factory (   $raw_message = null,
  $class_name = null 
)
static

(PECL pecl_http >= 1.4.0)
Create HttpMessage from string string $raw_message [optional] a single or several consecutive HTTP messages

Parameters
string$class_name[optional]

a class extending HttpMessage

Returns
HttpMessage an HttpMessage object on success or NULL on failure.
static HttpMessage::fromEnv (   $message_type,
  $class_name = null 
)
static

(PECL pecl_http >= 1.5.0)
Create HttpMessage from environment int $message_type The message type. See HttpMessage type constants.

Parameters
string$class_name[optional]

a class extending HttpMessage

Returns
HttpMessage an HttpMessage object on success or NULL on failure.
static HttpMessage::fromString (   $raw_message = null,
  $class_name = null 
)
static

(PECL pecl_http 0.10.0-1.3.3)
Create HttpMessage from string string $raw_message [optional] a single or several consecutive HTTP messages

Parameters
string$class_name[optional]

a class extending HttpMessage

Returns
HttpMessage an HttpMessage object on success or NULL on failure.
HttpMessage::getBody ( )

(PECL pecl_http >= 0.10.0)
Get message body string the message body as string.

HttpMessage::getHeader (   $header)

(PECL pecl_http >= 1.1.0)
Get header string $header header name

Returns
string the header value on success or NULL if the header does not exist.
HttpMessage::getHeaders ( )

(PECL pecl_http >= 0.10.0)
Get message headers array an associative array containing the messages HTTP headers.

HttpMessage::getHttpVersion ( )

(PECL pecl_http >= 0.10.0)
Get HTTP version string the HTTP protocol version as string.

HttpMessage::getParentMessage ( )

(PECL pecl_http >= 0.10.0)
Get parent message HttpMessage the parent HttpMessage object.

HttpMessage::getRequestMethod ( )
HttpMessage::getRequestUrl ( )
HttpMessage::getResponseCode ( )
HttpMessage::getResponseStatus ( )
HttpMessage::getType ( )

(PECL pecl_http >= 0.10.0)
Get message type int the HttpMessage::TYPE.

HttpMessage::guessContentType (   $magic_file,
  $magic_mode = null 
)

(PECL pecl_http >= 1.0.0)
Guess content type string $magic_file the magic.mime database to use

Parameters
int$magic_mode[optional]

flags for libmagic

Returns
string the guessed content type on success or false on failure.
HttpMessage::key ( )

Return the key of the current element mixed scalar on success, or null on failure. 5.0.0

Implements Iterator.

HttpMessage::next ( )

Move forward to next element void Any returned value is ignored. 5.0.0

Implements Iterator.

HttpMessage::prepend ( HttpMessage  $message,
  $top = null 
)

(PECL pecl_http >= 0.22.0)
Prepend message(s) HttpMessage $message HttpMessage object to prepend

Parameters
bool$top[optional]

whether to prepend to the top most or right this message

Returns
void
HttpMessage::reverse ( )

(PECL pecl_http >= 0.23.0)
Reverse message chain HttpMessage the most parent HttpMessage object.

HttpMessage::rewind ( )

Rewind the Iterator to the first element void Any returned value is ignored. 5.0.0

Implements Iterator.

HttpMessage::send ( )

(PECL pecl_http >= 0.10.0)
Send message bool true on success or false on failure.

HttpMessage::serialize ( )
HttpMessage::setBody (   $body)

(PECL pecl_http >= 0.14.0)
Set message body string $body the new body of the message

Returns
void
HttpMessage::setHeaders ( sarray  $header)

(PECL pecl_http >= 0.10.0)
Set headers array $headers associative array containing the new HTTP headers, which will replace all previous HTTP headers of the message

Returns
void
HttpMessage::setHttpVersion (   $version)

(PECL pecl_http >= 0.10.0)
Set HTTP version string $version the HTTP protocol version

Returns
bool TRUE on success, or FALSE if supplied version is out of range (1.0/1.1).
HttpMessage::setInfo (   $http_info)
Parameters
$http_info
HttpMessage::setRequestMethod (   $method)

(PECL pecl_http >= 0.10.0)
Set request method string $method the request method name

Returns
bool TRUE on success, or FALSE if the message is not of type HttpMessage::TYPE_REQUEST or an invalid request method was supplied.
HttpMessage::setRequestUrl (   $url)

(PECL pecl_http >= 0.21.0)
Set request URL string $url the request URL

Returns
bool TRUE on success, or FALSE if the message is not of type HttpMessage::TYPE_REQUEST or supplied URL was empty.
HttpMessage::setResponseCode (   $code)

(PECL pecl_http >= 0.10.0)
Set response code int $code HTTP response code

Returns
bool TRUE on success, or FALSE if the message is not of type HttpMessage::TYPE_RESPONSE or the response code is out of range (100-510).
HttpMessage::setResponseStatus (   $status)

(PECL pecl_http >= 0.23.0)
Set response status string $status the response status text

Returns
bool TRUE on success or FALSE if the message is not of type HttpMessage::TYPE_RESPONSE.
HttpMessage::setType (   $type)

(PECL pecl_http >= 0.10.0)
Set message type int $type the HttpMessage::TYPE

Returns
void
HttpMessage::toMessageTypeObject ( )

(PECL pecl_http >= 0.22.0)
Create HTTP object regarding message type HttpRequest|HttpResponse either an HttpRequest or HttpResponse object on success, or NULL on failure.

HttpMessage::toString (   $include_parent = null)

(PECL pecl_http >= 0.10.0)
Get string representation bool $include_parent [optional] specifies whether the returned string should also contain any parent messages

Returns
string the message as string.
HttpMessage::unserialize (   $serialized)
Parameters
$serialized

Implements Serializable.


The documentation for this class was generated from the following file: