【php开源代码栏目提醒】:网学会员php开源代码为您提供Value.php参考,解决您在Value.php学习中工作中的难题,参考学习。
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to version 1.0 of the Zend Framework
* license, that is bundled with this package in the file LICENSE, and
* is available through the world-wide-web at the following URL:
* http://www.zend.com/license/framework/1_0.txt. If you did not receive
* a copy of the Zend Framework license and are unable to obtain it
* through the world-wide-
web, please send a note to license@zend.com
* so we can mail you a copy immediately.
*
* @package Zend_XmlRpc
* @subpackage Value
* @copyright Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
*/
/** Zend_XmlRpc_Value_Exception */
require_once 'Zend/XmlRpc/Value/Exception.php';
/** Zend_XmlRpc_Value_Scalar */
require_once 'Zend/XmlRpc/Value/Scalar.php';
/** Zend_XmlRpc_Value_Base64 */
require_once 'Zend/XmlRpc/Value/Base64.php';
/** Zend_XmlRpc_Value_Boolean */
require_once 'Zend/XmlRpc/Value/Boolean.php';
/** Zend_XmlRpc_Value_DateTime */
require_once 'Zend/XmlRpc/Value/DateTime.php';
/** Zend_XmlRpc_Value_Double */
require_once 'Zend/XmlRpc/Value/Double.php';
/** Zend_XmlRpc_Value_Integer */
require_once 'Zend/XmlRpc/Value/Integer.php';
/** Zend_XmlRpc_Value_String */
require_once 'Zend/XmlRpc/Value/String.php';
/** Zend_XmlRpc_Value_Collection */
require_once 'Zend/XmlRpc/Value/Collection.php';
/** Zend_XmlRpc_Value_Array */
require_once 'Zend/XmlRpc/Value/Array.php';
/** Zend_XmlRpc_Value_Struct */
require_once 'Zend/XmlRpc/Value/Struct.php';
/**
* Represent a native XML-RPC value entity, used as parameters for the methods
* called by the Zend_XmlRpc_Client object and as the return value for those calls.
*
* This object as a very important static function Zend_XmlRpc_Value::getXmlRpcValue, this
* function acts likes a factory for the Zend_XmlRpc_Value objects
*
* Using this function, users/Zend_XmlRpc_Client object can create the Zend_XmlRpc_Value objects
* from PHP variables, XML string or by specifing the exact XML-RPC natvie type
*
* @package Zend_XmlRpc
* @copyright Copyright (c) 2005-2006 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
*/
abstract class Zend_XmlRpc_Value
{
/**
* 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 Zend_XmlRpc_Value objects
*/
protected $_value;
/**
* The native XML-RPC type of this object
* One of the XMLRPC_TYPE_* constants
*/
protected $_type;
/**
* XML code representation of this object (will be calculated only once)
*/
protected $_as_xml;
/**
* Specify that the XML-RPC native type will be auto detected from a PHP variable type
*/
const AUTO_DETECT_TYPE = 'auto_detect';
/**
* Specify that the XML-RPC value will be parsed out from a given XML code
*/
const XML_STRING = '
xml';
/**
* All the XML-RPC native types
*/
const XMLRPC_TYPE_I4 = 'i4';
const XMLRPC_TYPE_INTEGER = 'int';
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';
/**
* Get the native XML-RPC type (the type is one of the Zend_XmlRpc_Value::XMLRPC_TYPE_* constants)
*
* @return string
*/
public function getType()
{
return $this->_type;
}
/**
* Return the value of this object, convert the XML-RPC native value into a PHP variable
*
* @return mixed
*/
abstract public function getValue();
/**
* Return the XML code that represent a native MXL-RPC value
*
* @return string
*/
abstract public function getAsXML();
/**
* Creates a Zend_XmlRpc_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 Zend_XmlRpc_Value::AUTO_DETECT_TYPE)
* 2. By specifing the native type ($type is one of the Zend_XmlRpc_Value::XMLRPC_TYPE_* constants)
* 3. From a XML string ($type is set to Zend_XmlRpc_Value::XML_STRING)
*
* By default the value type is autodetected according to it's PHP type
*
* @param mixed $value
* @param Zend_XmlRpc_Value::constant $type
*
* @return Zend_