Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
PhpXmlRpc\Response Class Reference

Public Member Functions

 __construct ($val, $fCode=0, $fString='', $valType='', $httpResponse=null)
 
 __get ($name)
 
 __isset ($name)
 
 __set ($name, $value)
 
 __unset ($name)
 
 cookies ()
 Returns an array with the cookies received from the server.
 
 faultCode ()
 Returns the error code of the response.
 
 faultString ()
 Returns the error code of the response.
 
 getCharsetEncoder ()
 
 httpResponse ()
 
 serialize ($charsetEncoding='')
 Returns xml representation of the response.
 
 setCharsetEncoder ($charsetEncoder)
 
 value ()
 Returns the value received by the server.
 

Public Attributes

 $content_type = 'text/xml'
 
 $errno = 0
 
 $errstr = ''
 
 $payload
 
 $val = 0
 
 $valtyp
 

Protected Attributes

 $httpResponse = array('headers' => array(), 'cookies' => array(), 'raw_data' => '', 'status_code' => null)
 

Static Protected Attributes

static $charsetEncoder
 

Constructor & Destructor Documentation

◆ __construct()

PhpXmlRpc\Response::__construct ( $val,
$fCode = 0,
$fString = '',
$valType = '',
$httpResponse = null )
Parameters
Value | string | mixed$valeither a Value object, a php value or the xml serialization of an xmlrpc value (a string)
integer$fCodeset it to anything but 0 to create an error response. In that case, $val is discarded
string$fStringthe error string, in case of an error response
string$valTypeThe type of $val passed in. Either 'xmlrpcvals', 'phpvals' or 'xml'. Leave empty to let the code guess the correct type.
array | null$httpResponse
Todo
add check that $val / $fCode / $fString is of correct type??? NB: as of now we do not do it, since it might be either an xmlrpc value or a plain php val, or a complete xml chunk, depending on usage of Client\send() inside which creator is called...

Member Function Documentation

◆ cookies()

PhpXmlRpc\Response::cookies ( )

Returns an array with the cookies received from the server.

Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 => $val2, ...) with attributes being e.g. 'expires', 'path', domain'. NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past) are still present in the array. It is up to the user-defined code to decide how to use the received cookies, and whether they have to be sent back with the next request to the server (using Client\setCookie) or not.

Return values
array[]array of cookies received from the server

◆ faultCode()

PhpXmlRpc\Response::faultCode ( )

Returns the error code of the response.

Return values
integerthe error code of this response (0 for not-error responses)

◆ faultString()

PhpXmlRpc\Response::faultString ( )

Returns the error code of the response.

Return values
stringthe error string of this response ('' for not-error responses)

◆ httpResponse()

PhpXmlRpc\Response::httpResponse ( )
Return values
arrayarray with keys 'headers', 'cookies', 'raw_data' and 'status_code'

◆ serialize()

PhpXmlRpc\Response::serialize ( $charsetEncoding = '')

Returns xml representation of the response.

XML prologue not included.

Parameters
string$charsetEncodingthe charset to be used for serialization. If null, US-ASCII is assumed
Return values
stringthe xml representation of the response
Exceptions
Exception

◆ value()

PhpXmlRpc\Response::value ( )

Returns the value received by the server.

If the Response's faultCode is non-zero then the value returned by this method should not be used (it may not even be an object).

Return values
Value|string|mixedthe Value object returned by the server. Might be an xml string or plain php value depending on the convention adopted when creating the Response

Member Data Documentation

◆ $val

PhpXmlRpc\Response::$val = 0
Todo
: do these need to be public?

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