ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML_RPC2_Backend_Php_Value_Scalar Class Reference
+ Inheritance diagram for XML_RPC2_Backend_Php_Value_Scalar:
+ Collaboration diagram for XML_RPC2_Backend_Php_Value_Scalar:

Public Member Functions

 getScalarType ()
 scalarType property getter
 __construct ($scalarType, $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 createFromNative ($nativeValue, $explicitType=null)
 Choose a XML_RPC2_Value subclass appropriate for the given value and create it.
- Static Public Member Functions inherited from XML_RPC2_Backend_Php_Value
static createFromDecode ($simpleXML)
 Decode an encoded value and build the applicable XML_RPC2_Value subclass.

Protected Member Functions

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

Private Attributes

 $_scalarType = null

Detailed Description

Definition at line 57 of file Scalar.php.

Constructor & Destructor Documentation

XML_RPC2_Backend_Php_Value_Scalar::__construct (   $scalarType,
  $nativeValue 
)

Constructor.

Will build a new XML_RPC2_Value_Scalar with the given nativeValue

Parameters
mixednativeValue

Definition at line 115 of file Scalar.php.

References XML_RPC2_Backend_Php_Value\setNativeValue(), and setScalarType().

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

+ Here is the call graph for this function:

Member Function Documentation

static XML_RPC2_Backend_Php_Value_Scalar::createFromNative (   $nativeValue,
  $explicitType = null 
)
static

Choose a XML_RPC2_Value subclass appropriate for the given value and create it.

Parameters
stringThe native value
stringOptinally, the scalar type to use
Exceptions
XML_RPC2_InvalidTypeEncodeExceptionWhen native value's type is not a native type
Returns
XML_RPC2_Value The newly created value

Reimplemented from XML_RPC2_Backend_Php_Value.

Definition at line 133 of file Scalar.php.

{
if (is_null($explicitType)) {
switch (gettype($nativeValue)) {
case 'boolean':
case 'integer':
case 'double':
case 'string':
$explicitType = gettype($nativeValue);
break;
default:
throw new XML_RPC2_InvalidTypeEncodeException(sprintf('Impossible to encode scalar value \'%s\' from type \'%s\'. Native type is not a scalar XML_RPC type (boolean, integer, double, string)',
(string) $nativeValue,
gettype($nativeValue)));
}
}
$explicitType = ucfirst(strtolower($explicitType));
require_once(sprintf('XML/RPC2/Backend/Php/Value/%s.php', $explicitType));
$explicitType = sprintf('XML_RPC2_Backend_Php_Value_%s', $explicitType);
return new $explicitType($nativeValue);
}
XML_RPC2_Backend_Php_Value_Scalar::encode ( )

Encode the instance into XML, for transport.

Returns
string The encoded XML-RPC value,

Reimplemented in XML_RPC2_Backend_Php_Value_String, and XML_RPC2_Backend_Php_Value_Boolean.

Definition at line 163 of file Scalar.php.

References XML_RPC2_Backend_Php_Value\getNativeValue(), and getScalarType().

{
return '<' . $this->getScalarType() . '>' . $this->getNativeValue() . '</' . $this->getScalarType() . '>';
}

+ Here is the call graph for this function:

XML_RPC2_Backend_Php_Value_Scalar::getScalarType ( )

scalarType property getter

Returns
mixed The current scalarType

Definition at line 102 of file Scalar.php.

References $_scalarType.

Referenced by encode().

{
}

+ Here is the caller graph for this function:

XML_RPC2_Backend_Php_Value_Scalar::setScalarType (   $value)
protected

scalarType property setter

Parameters
mixedvalue The new scalarType

Definition at line 77 of file Scalar.php.

Referenced by XML_RPC2_Backend_Php_Value_String\__construct(), XML_RPC2_Backend_Php_Value_Integer\__construct(), XML_RPC2_Backend_Php_Value_Double\__construct(), and __construct().

{
switch ($value) {
case 'int':
case 'i4':
case 'boolean':
case 'string':
case 'double':
case 'dateTime.iso8601':
case 'base64':
$this->_scalarType = $value;
break;
default:
throw new XML_RPC2_InvalidTypeException(sprintf('Type \'%s\' is not an XML-RPC scalar type', $value));
}
}

+ Here is the caller graph for this function:

Field Documentation

XML_RPC2_Backend_Php_Value_Scalar::$_scalarType = null
private

Definition at line 67 of file Scalar.php.

Referenced by getScalarType().


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