ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
XML_RPC2_Backend_Php_Request Class Reference
+ Collaboration diagram for XML_RPC2_Backend_Php_Request:

Public Member Functions

 setParameters ($value)
 parameters property setter More...
 
 addParameter ($value)
 parameters property appender More...
 
 getParameters ()
 parameters property getter More...
 
 getMethodName ()
 method name getter More...
 
 __construct ($methodName, $encoding='iso-8859-1')
 Create a new xml-rpc request with the provided methodname. More...
 
 encode ()
 Encode the request for transmission. More...
 

Static Public Member Functions

static createFromDecode ($simpleXML)
 Decode a request from XML and construct a request object with the createFromDecoded values. More...
 

Private Attributes

 $_methodName = ''
 
 $_parameters = null
 
 $_encoding = 'iso-8859-1'
 

Detailed Description

Definition at line 58 of file Request.php.

Constructor & Destructor Documentation

◆ __construct()

XML_RPC2_Backend_Php_Request::__construct (   $methodName,
  $encoding = 'iso-8859-1' 
)

Create a new xml-rpc request with the provided methodname.

Parameters
stringName of method targeted by this xml-rpc request
stringencoding of the request

Definition at line 144 of file Request.php.

References setParameters().

145  {
146  $this->_methodName = $methodName;
147  $this->setParameters(array());
148  $this->_encoding = $encoding;
149  }
setParameters($value)
parameters property setter
Definition: Request.php:91
+ Here is the call graph for this function:

Member Function Documentation

◆ addParameter()

XML_RPC2_Backend_Php_Request::addParameter (   $value)

parameters property appender

Parameters
mixedvalue The new parameter

Definition at line 104 of file Request.php.

105  {
106  $this->_parameters[] = $value;
107  }

◆ createFromDecode()

static XML_RPC2_Backend_Php_Request::createFromDecode (   $simpleXML)
static

Decode a request from XML and construct a request object with the createFromDecoded values.

Parameters
SimpleXMLElementThe encoded XML-RPC request.
Returns
XML_RPC2_Backend_Php_Request The xml-rpc request, represented as an object instance

Definition at line 187 of file Request.php.

References $result, and XML_RPC2_Backend_Php_Value\createFromDecode().

Referenced by XML_RPC2_Backend_Php_Server\getResponse().

188  {
189  $methodName = (string) $simpleXML->methodName;
190  $params = array();
191  foreach ($simpleXML->params->param as $param) {
192  foreach ($param->value as $value) {
193  $params[] = XML_RPC2_Backend_Php_Value::createFromDecode($value)->getNativeValue();
194  }
195  }
196  $result = new XML_RPC2_Backend_Php_Request($methodName);
197  $result->setParameters($params);
198  return $result;
199  }
$result
static createFromDecode($simpleXML)
Decode an encoded value and build the applicable XML_RPC2_Value subclass.
Definition: Value.php:215
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encode()

XML_RPC2_Backend_Php_Request::encode ( )

Encode the request for transmission.

Returns
string XML-encoded request (a full XML document)

Definition at line 159 of file Request.php.

References $_methodName, $result, XML_RPC2_Backend_Php_Value\createFromNative(), and getParameters().

160  {
161  $methodName = $this->_methodName;
162  $parameters = $this->getParameters();
163 
164  $result = '<?xml version="1.0" encoding="' . $this->_encoding . '"?>';
165  $result .= '<methodCall>';
166  $result .= "<methodName>${methodName}</methodName>";
167  $result .= '<params>';
168  foreach($parameters as $parameter) {
169  $result .= '<param><value>';
170  $result .= ($parameter instanceof XML_RPC2_Backend_Php_Value) ? $parameter->encode() : XML_RPC2_Backend_Php_Value::createFromNative($parameter)->encode();
171  $result .= '</value></param>';
172  }
173  $result .= '</params>';
174  $result .= '</methodCall>';
175  return $result;
176  }
getParameters()
parameters property getter
Definition: Request.php:117
$result
static createFromNative($nativeValue, $explicitType=null)
Choose a XML_RPC2_Value subclass appropriate for the given value and create it.
Definition: Value.php:123
+ Here is the call graph for this function:

◆ getMethodName()

XML_RPC2_Backend_Php_Request::getMethodName ( )

method name getter

Returns
string method name

Definition at line 130 of file Request.php.

References $_methodName.

131  {
132  return $this->_methodName;
133  }

◆ getParameters()

XML_RPC2_Backend_Php_Request::getParameters ( )

parameters property getter

Returns
mixed The current parameters

Definition at line 117 of file Request.php.

References $_parameters.

Referenced by encode().

118  {
119  return $this->_parameters;
120  }
+ Here is the caller graph for this function:

◆ setParameters()

XML_RPC2_Backend_Php_Request::setParameters (   $value)

parameters property setter

Parameters
mixedvalue The new parameters

Definition at line 91 of file Request.php.

Referenced by __construct().

92  {
93  $this->_parameters = $value;
94  }
+ Here is the caller graph for this function:

Field Documentation

◆ $_encoding

XML_RPC2_Backend_Php_Request::$_encoding = 'iso-8859-1'
private

Definition at line 81 of file Request.php.

◆ $_methodName

XML_RPC2_Backend_Php_Request::$_methodName = ''
private

Definition at line 67 of file Request.php.

Referenced by encode(), and getMethodName().

◆ $_parameters

XML_RPC2_Backend_Php_Request::$_parameters = null
private

Definition at line 74 of file Request.php.

Referenced by getParameters().


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