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

Public Member Functions

 __construct ($methodName, $params=array())
 
 addParam ($param)
 Add a parameter to the list of parameters to be used upon method invocation.
 
 createPayload ($charsetEncoding='')
 
 getCharsetEncoder ()
 
 getLogger ()
 
 getNumParams ()
 Returns the number of parameters in the message.
 
 getParam ($i)
 Returns the nth parameter in the request.
 
 getParser ()
 
 kindOf ()
 Kept the old name even if Request class was renamed, for compatibility.
 
 method ($methodName='')
 Gets/sets the xmlrpc method to be invoked.
 
 parseResponse ($data='', $headersProcessed=false, $returnType=XMLParser::RETURN_XMLRPCVALS)
 Parse the xmlrpc response contained in the string $data and return a Response object.
 
 parseResponseFile ($fp, $headersProcessed=false, $returnType='xmlrpcvals')
 Given an open file handle, read all data available and parse it as an xmlrpc response.
 
 serialize ($charsetEncoding='')
 Returns xml representation of the message.
 
 setCharsetEncoder ($charsetEncoder)
 
 setDebug ($level)
 Enables/disables the echoing to screen of the xmlrpc responses received.
 
 xml_footer ()
 
 xml_header ($charsetEncoding='')
 

Static Public Member Functions

static setLogger ($logger)
 
static setParser ($parser)
 

Public Attributes

 $content_type = 'text/xml'
 
 $debug = 0
 
 $methodname
 
 $params = array()
 
 $payload
 

Protected Attributes

 $httpResponse = array()
 

Static Protected Attributes

static $charsetEncoder
 
static $logger
 
static $parser
 

Constructor & Destructor Documentation

◆ __construct()

PhpXmlRpc\Request::__construct ( $methodName,
$params = array() )
Parameters
string$methodNamethe name of the method to invoke
Value[]$paramsarray of parameters to be passed to the method (NB: Value objects, not plain php values)

Member Function Documentation

◆ addParam()

PhpXmlRpc\Request::addParam ( $param)

Add a parameter to the list of parameters to be used upon method invocation.

Checks that $params is actually a Value object and not a plain php value.

Parameters
Value$param
Return values
booleanfalse on failure

◆ getNumParams()

PhpXmlRpc\Request::getNumParams ( )

Returns the number of parameters in the message.

Return values
integerthe number of parameters currently set

◆ getParam()

PhpXmlRpc\Request::getParam ( $i)

Returns the nth parameter in the request.

The index zero-based.

Parameters
integer$ithe index of the parameter to fetch (zero based)
Return values
Valuethe i-th parameter

◆ kindOf()

PhpXmlRpc\Request::kindOf ( )

Kept the old name even if Request class was renamed, for compatibility.

Return values
string

◆ method()

PhpXmlRpc\Request::method ( $methodName = '')

Gets/sets the xmlrpc method to be invoked.

Parameters
string$methodNamethe method to be set (leave empty not to set it)
Return values
stringthe method that will be invoked

◆ parseResponse()

PhpXmlRpc\Request::parseResponse ( $data = '',
$headersProcessed = false,
$returnType = XMLParser::RETURN_XMLRPCVALS )

Parse the xmlrpc response contained in the string $data and return a Response object.

When $this->debug has been set to a value greater than 0, will echo debug messages to screen while decoding.

Parameters
string$datathe xmlrpc response, possibly including http headers
bool$headersProcessedwhen true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding
string$returnTypedecides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals'
Return values
Response
Todo
parsing Responses is not really the responsibility of the Request class. Maybe of the Client...

◆ parseResponseFile()

PhpXmlRpc\Request::parseResponseFile ( $fp,
$headersProcessed = false,
$returnType = 'xmlrpcvals' )

Given an open file handle, read all data available and parse it as an xmlrpc response.

NB: the file handle is not closed by this function. NNB: might have trouble in rare cases to work on network streams, as we check for a read of 0 bytes instead of feof($fp). But since checking for feof(null) returns false, we would risk an infinite loop in that case, because we cannot trust the caller to give us a valid pointer to an open file...

Parameters
resource$fpstream pointer
bool$headersProcessed
string$returnType
Return values
Response

◆ serialize()

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

Returns xml representation of the message.

XML prologue included.

Parameters
string$charsetEncoding
Return values
stringthe xml representation of the message, xml prologue included

◆ setDebug()

PhpXmlRpc\Request::setDebug ( $level)

Enables/disables the echoing to screen of the xmlrpc responses received.

Parameters
integer$levelvalues 0, 1, 2 are supported

Member Data Documentation

◆ $httpResponse

PhpXmlRpc\Request::$httpResponse = array()
protected
Deprecated
will be removed in a future release

◆ $payload

PhpXmlRpc\Request::$payload
Todo
: do these need to be public?

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