Zend Framework  2.4
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
AbstractValue Class Reference

Represent a native XML-RPC value entity, used as parameters for the methods called by the Zend object and as the return value for those calls. More...

Public Member Functions

 getType ()
 Get the native XML-RPC type (the type is one of the Value::XMLRPC_TYPE_* constants)
 
 getValue ()
 Return the value of this object, convert the XML-RPC native value into a PHP variable.
 
 saveXml ()
 Return the XML code that represent a native MXL-RPC value.
 
 generateXml ()
 Generate XML code that represent a native XML/RPC value.
 

Static Public Member Functions

static getGenerator ()
 Get XML generator instance.
 
static setGenerator (Generator\GeneratorInterface $generator=null)
 Sets XML generator instance.
 
static setEncoding ($encoding)
 Changes the encoding of the generator.
 
static getXmlRpcValue ($value, $type=self::AUTO_DETECT_TYPE)
 Creates a Value* object, representing a native XML-RPC value A XmlRpcValue object can be created in 3 ways: 1.
 
static getXmlRpcTypeByValue ($value)
 Get XML-RPC type for a PHP native variable.
 

Public Attributes

const AUTO_DETECT_TYPE = 'auto_detect'
 Specify that the XML-RPC native type will be auto detected from a PHP variable type.
 
const XML_STRING = 'xml'
 Specify that the XML-RPC value will be parsed out from a given XML code.
 
const XMLRPC_TYPE_I4 = 'i4'
 All the XML-RPC native types.
 
const XMLRPC_TYPE_INTEGER = 'int'
 
const XMLRPC_TYPE_I8 = 'i8'
 
const XMLRPC_TYPE_APACHEI8 = 'ex:i8'
 
const XMLRPC_TYPE_DOUBLE = 'double'
 
const XMLRPC_TYPE_BOOLEAN = 'boolean'
 
const XMLRPC_TYPE_STRING = 'string'
 
const XMLRPC_TYPE_DATETIME = 'dateTime.iso8601'
 
const XMLRPC_TYPE_BASE64 = 'base64'
 
const XMLRPC_TYPE_ARRAY = 'array'
 
const XMLRPC_TYPE_STRUCT = 'struct'
 
const XMLRPC_TYPE_NIL = 'nil'
 
const XMLRPC_TYPE_APACHENIL = 'ex:nil'
 

Protected Member Functions

 _setXML ($xml)
 

Static Protected Member Functions

static _phpVarToNativeXmlRpc ($value)
 Transform a PHP native variable into a XML-RPC native value.
 
static _xmlStringToNativeXmlRpc ($xml)
 Transform an XML string into a XML-RPC native value.
 
static _createSimpleXMLElement (&$xml)
 
static _extractTypeAndValue (\SimpleXMLElement $xml, &$type, &$value)
 Extract XML/RPC type and value from SimpleXMLElement object.
 

Protected Attributes

 $value
 The native XML-RPC representation of this object's value.
 
 $type
 The native XML-RPC type of this object One of the XMLRPC_TYPE_* constants.
 
 $xml
 XML code representation of this object (will be calculated only once)
 

Static Protected Attributes

static $generator
 

Detailed Description

Represent a native XML-RPC value entity, used as parameters for the methods called by the Zend object and as the return value for those calls.

This object as a very important static function Zend::getXmlRpcValue, this function acts likes a factory for the Zend objects

Using this function, users/Zend object can create the Zend objects from PHP variables, XML string or by specifying the exact XML-RPC native type

Member Function Documentation

static _createSimpleXMLElement ( $xml)
staticprotected
static _extractTypeAndValue ( \SimpleXMLElement  $xml,
$type,
$value 
)
staticprotected

Extract XML/RPC type and value from SimpleXMLElement object.

Parameters
\SimpleXMLElement$xml
string&$typeType bind variable
string&$valueValue bind variable
Returns
void
static _phpVarToNativeXmlRpc (   $value)
staticprotected

Transform a PHP native variable into a XML-RPC native value.

Parameters
mixed$valueThe PHP variable for conversion
Exceptions
Exception\InvalidArgumentException
Returns
AbstractValue
_setXML (   $xml)
protected
Parameters
$xml
Returns
void
static _xmlStringToNativeXmlRpc (   $xml)
staticprotected

Transform an XML string into a XML-RPC native value.

Parameters
string | \SimpleXMLElement$xmlA SimpleXMLElement object represent the XML string It can be also a valid XML string for conversion
Exceptions
Exception\ValueException
Returns
generateXml ( )

Generate XML code that represent a native XML/RPC value.

Returns
void
static getGenerator ( )
static

Get XML generator instance.

Returns
getType ( )

Get the native XML-RPC type (the type is one of the Value::XMLRPC_TYPE_* constants)

Returns
string
getValue ( )
abstract

Return the value of this object, convert the XML-RPC native value into a PHP variable.

Returns
mixed
static getXmlRpcTypeByValue (   $value)
static

Get XML-RPC type for a PHP native variable.

Parameters
mixed$value
Exceptions
Exception\InvalidArgumentException
Returns
string
static getXmlRpcValue (   $value,
  $type = self::AUTO_DETECT_TYPE 
)
static

Creates a Value* object, representing a native XML-RPC value A XmlRpcValue object can be created in 3 ways: 1.

Autodetecting the native type out of a PHP variable (if $type is not set or equal to Value::AUTO_DETECT_TYPE) 2. By specifying the native type ($type is one of the Value::XMLRPC_TYPE_* constants) 3. From a XML string ($type is set to Value::XML_STRING)

By default the value type is autodetected according to it's PHP type

Parameters
mixed$value
Zend\XmlRpc\Value::constant$type
Exceptions
Exception\ValueException
Returns
AbstractValue
saveXml ( )

Return the XML code that represent a native MXL-RPC value.

Returns
string
static setEncoding (   $encoding)
static

Changes the encoding of the generator.

Parameters
string$encoding
Returns
void
static setGenerator ( Generator\GeneratorInterface  $generator = null)
static

Sets XML generator instance.

Parameters
null | Generator\GeneratorInterface$generator
Returns
void

Member Data Documentation

$generator
staticprotected
$type
protected

The native XML-RPC type of this object One of the XMLRPC_TYPE_* constants.

$value
protected

The native XML-RPC representation of this object's value.

If the native type of this object is array or struct, this will be an array of Value objects

$xml
protected

XML code representation of this object (will be calculated only once)

const AUTO_DETECT_TYPE = 'auto_detect'

Specify that the XML-RPC native type will be auto detected from a PHP variable type.

const XML_STRING = 'xml'

Specify that the XML-RPC value will be parsed out from a given XML code.

const XMLRPC_TYPE_APACHEI8 = 'ex:i8'
const XMLRPC_TYPE_APACHENIL = 'ex:nil'
const XMLRPC_TYPE_ARRAY = 'array'
const XMLRPC_TYPE_BASE64 = 'base64'
const XMLRPC_TYPE_BOOLEAN = 'boolean'
const XMLRPC_TYPE_DATETIME = 'dateTime.iso8601'
const XMLRPC_TYPE_DOUBLE = 'double'
const XMLRPC_TYPE_I4 = 'i4'

All the XML-RPC native types.

const XMLRPC_TYPE_I8 = 'i8'
const XMLRPC_TYPE_INTEGER = 'int'
const XMLRPC_TYPE_NIL = 'nil'
const XMLRPC_TYPE_STRING = 'string'
const XMLRPC_TYPE_STRUCT = 'struct'