ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
XML_RPC2_Backend_Php_Value_Array Class Reference
+ Inheritance diagram for XML_RPC2_Backend_Php_Value_Array:
+ Collaboration diagram for XML_RPC2_Backend_Php_Value_Array:

Public Member Functions

 __construct ($nativeValue)
 Constructor. More...
 
 encode ()
 Encode the instance into XML, for transport. More...
 
- Public Member Functions inherited from XML_RPC2_Backend_Php_Value
 getNativeValue ()
 nativeValue property getter More...
 

Static Public Member Functions

static decode ($xml)
 Decode transport XML and set the instance value accordingly. More...
 
- Static Public Member Functions inherited from XML_RPC2_Backend_Php_Value
static createFromNative ($nativeValue, $explicitType=null)
 Choose a XML_RPC2_Value subclass appropriate for the given value and create it. More...
 
static createFromDecode ($simpleXML)
 Decode an encoded value and build the applicable XML_RPC2_Value subclass. More...
 
static createFromNative ($value, $explicitType=null)
 Factory method that constructs the appropriate XML-RPC encoded type value. More...
 

Protected Member Functions

 setNativeValue ($value)
 nativeValue property setter More...
 
 setNativeValue ($value)
 nativeValue setter More...
 

Detailed Description

Definition at line 53 of file Array.php.

Constructor & Destructor Documentation

◆ __construct()

XML_RPC2_Backend_Php_Value_Array::__construct (   $nativeValue)

Constructor.

Will build a new XML_RPC2_Backend_Php_Value_Array with the given nativeValue

Parameters
mixednativeValue

Definition at line 79 of file Array.php.

80 {
81 $this->setNativeValue($nativeValue);
82 }
setNativeValue($value)
nativeValue property setter
Definition: Array.php:63

References setNativeValue().

+ Here is the call graph for this function:

Member Function Documentation

◆ decode()

static XML_RPC2_Backend_Php_Value_Array::decode (   $xml)
static

Decode transport XML and set the instance value accordingly.

Parameters
mixedThe encoded XML-RPC value,

Definition at line 114 of file Array.php.

115 {
116 // TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when
117 // xpath is used both in an element and in one of its children
118 $xml = simplexml_load_string($xml->asXML());
119 $values = $xml->xpath('/value/array/data/value');
120 $result = array();
121 foreach (array_keys($values) as $i) {
122 $result[] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i])->getNativeValue();
123 }
124 return $result;
125 }
$result
static createFromDecode($simpleXML)
Decode an encoded value and build the applicable XML_RPC2_Value subclass.
Definition: Value.php:215

References $result, and XML_RPC2_Backend_Php_Value\createFromDecode().

+ Here is the call graph for this function:

◆ encode()

XML_RPC2_Backend_Php_Value_Array::encode ( )

Encode the instance into XML, for transport.

Returns
string The encoded XML-RPC value,

Definition at line 92 of file Array.php.

93 {
94 $result = '<array><data>';
95 foreach($this->getNativeValue() as $element) {
96 $result .= '<value>';
97 $result .= ($element instanceof XML_RPC2_Backend_Php_Value) ?
98 $element->encode() :
100 $result .= '</value>';
101 }
102 $result .= '</data></array>';
103 return $result;
104 }
static createFromNative($nativeValue, $explicitType=null)
Choose a XML_RPC2_Value subclass appropriate for the given value and create it.
Definition: Value.php:123
getNativeValue()
nativeValue property getter
Definition: Value.php:76

References $result, XML_RPC2_Backend_Php_Value\createFromNative(), and XML_RPC2_Backend_Php_Value\getNativeValue().

+ Here is the call graph for this function:

◆ setNativeValue()

XML_RPC2_Backend_Php_Value_Array::setNativeValue (   $value)
protected

nativeValue property setter

Parameters
mixedvalue the new nativeValue

Reimplemented from XML_RPC2_Backend_Php_Value.

Definition at line 63 of file Array.php.

64 {
65 if (!is_array($value)) {
66 throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Value_Array from type \'%s\'.', gettype($nativeValue)));
67 }
68 parent::setNativeValue($value);
69 }

Referenced by __construct().

+ Here is the caller graph for this function:

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