A createFromNative(
mixed
$nativeValue, [string
$explicitType = null])
|
|
Choose a XML_RPC2_Value subclass appropriate for the given value and create it.
This method tries to find the most adequate XML-RPC datatype to hold a given PHP native type. Note that distinguishing some datatypes may be difficult:
- Timestamps are represented by PHP integers, so an XML_RPC2_Value_Datetime is never returned
- Indexed arrays and associative arrays are the same native PHP type. In this case:
a) The array's indexes start at 0 or 1 and increase monotonically with step 1, or
b) they do not
in the first case, an XML_RPC2_Value_Array is returned. In the second, a XML_RPC2_Value_Struct is returned.
- PHP Objects are serialized and represented in an XML_RPC2_Value_Base64
Whenever native object automatic detection proves inaccurate, use XML_RPC2_Value::createFromNative providing a valid explicit type as second argument
the appropriate XML_RPC2_Value child class instead.
Overridden in child classes as:
- XML_RPC2_Backend_Php_Value_Scalar::createFromNative()
- Choose a XML_RPC2_Value subclass appropriate for the given value and create it.
Overrides
XML_RPC2_Value::createFromNative() (Factory method that constructs the appropriate XML-RPC encoded type value)
Parameters: