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

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.

Additional Inherited Members

- Protected Member Functions inherited from XML_RPC2_Backend_Php_Value
 setNativeValue ($value)
 nativeValue setter

Detailed Description

Definition at line 64 of file Base64.php.

Constructor & Destructor Documentation

XML_RPC2_Backend_Php_Value_Base64::__construct (   $nativeValue)

Constructor.

Will build a new XML_RPC2_Backend_Php_Value_Base64 with the given value

This class handles encoding-decoding internally. Do not provide the native string base64-encoded

Parameters
mixedString $nativeValue to be transmited base64-encoded or "stdclass native value"

Definition at line 77 of file Base64.php.

References XML_RPC2_Backend_Php_Value\setNativeValue().

{
if ((is_object($nativeValue)) &&(strtolower(get_class($nativeValue)) == 'stdclass') && (isset($nativeValue->xmlrpc_type))) {
$scalar = $nativeValue->scalar;
} else {
if (!is_string($nativeValue)) {
throw new XML_RPC2_InvalidTypeException(sprintf('Cannot create XML_RPC2_Backend_Php_Value_Base64 from type \'%s\'.', gettype($nativeValue)));
}
$scalar = $nativeValue;
}
$tmp = new stdclass();
$tmp->scalar = $scalar;
$tmp->xmlrpc_type = 'base64';
$this->setNativeValue($tmp);
}

+ Here is the call graph for this function:

Member Function Documentation

static XML_RPC2_Backend_Php_Value_Base64::decode (   $xml)
static

Decode transport XML and set the instance value accordingly.

Parameters
mixed$xmlThe encoded XML-RPC value,

Definition at line 115 of file Base64.php.

References $result.

{
// 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());
$value = $xml->xpath('/value/base64/text()');
if (!array_key_exists(0, $value)) {
$value = $xml->xpath('/value/text()');
}
// Emulate xmlrpcext results (to be able to switch from a backend to another)
$result = new stdclass();
$result->scalar = base64_decode($value[0]);
$result->xmlrpc_type = 'base64';
return $result;
}
XML_RPC2_Backend_Php_Value_Base64::encode ( )

Encode the instance into XML, for transport.

Returns
string The encoded XML-RPC value,

Definition at line 101 of file Base64.php.

References XML_RPC2_Backend_Php_Value\getNativeValue().

{
$native = $this->getNativeValue();
return '<base64>' . base64_encode($native->scalar) . '</base64>';
}

+ Here is the call graph for this function:


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