ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Backend_Php_Value_Struct Class Reference
+ Inheritance diagram for XML_RPC2_Backend_Php_Value_Struct:
+ Collaboration diagram for XML_RPC2_Backend_Php_Value_Struct:

Public Member Functions

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

Static Public Member Functions

static decode ($xml)
 Decode transport XML and set the instance value accordingly.
- 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.
static createFromDecode ($simpleXML)
 Decode an encoded value and build the applicable XML_RPC2_Value subclass.

Protected Member Functions

 setNativeValue ($value)
 nativeValue property setter

Detailed Description

Definition at line 57 of file Struct.php.

Constructor & Destructor Documentation

XML_RPC2_Backend_Php_Value_Struct::__construct (   $nativeValue)

Constructor.

Will build a new XML_RPC2_Backend_Php_Value_Scalar with the given nativeValue

Parameters
mixednativeValue

Definition at line 83 of file Struct.php.

References setNativeValue().

{
$this->setNativeValue($nativeValue);
}

+ Here is the call graph for this function:

Member Function Documentation

static XML_RPC2_Backend_Php_Value_Struct::decode (   $xml)
static

Decode transport XML and set the instance value accordingly.

Parameters
mixedThe encoded XML-RPC value,

Definition at line 123 of file Struct.php.

References $result, and XML_RPC2_Backend_Php_Value\createFromDecode().

{
// TODO Remove reparsing of XML fragment, when SimpleXML proves more solid. Currently it segfaults when
// xpath is used both in an element and in one of its children
$xml = simplexml_load_string($xml->asXML());
$values = $xml->xpath('/value/struct/member');
$result = array();
foreach (array_keys($values) as $i) {
$result[(string) $values[$i]->name] = XML_RPC2_Backend_Php_Value::createFromDecode($values[$i]->value)->getNativeValue();
}
return $result;
}

+ Here is the call graph for this function:

XML_RPC2_Backend_Php_Value_Struct::encode ( )

Encode the instance into XML, for transport.

Returns
string The encoded XML-RPC value,

Definition at line 96 of file Struct.php.

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

{
$result = '<struct>';
foreach($this->getNativeValue() as $name => $element) {
$result .= '<member>';
$result .= '<name>';
$result .= strtr($name, array('&' => '&amp;', '<' => '&lt;', '>' => '&gt;'));
$result .= '</name>';
$result .= '<value>';
$result .= ($element instanceof XML_RPC2_Backend_Php_Value) ?
$element->encode() :
$result .= '</value>';
$result .= '</member>';
}
$result .= '</struct>';
return $result;
}

+ Here is the call graph for this function:

XML_RPC2_Backend_Php_Value_Struct::setNativeValue (   $value)
protected

nativeValue property setter

Parameters
mixedvalue the new nativeValue

Reimplemented from XML_RPC2_Backend_Php_Value.

Definition at line 67 of file Struct.php.

Referenced by __construct().

{
if (!is_array($value)) {
throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Struct from type \'%s\'.', gettype($nativeValue)));
}
}

+ Here is the caller graph for this function:


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