Annotation of /mambo/branches/4.6/includes/domit/dom_xmlrpc_array_document.php
Parent Directory
|
Revision Log
Revision 3 - (view) (download)
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * dom_xmlrpc_array_document wraps a PHP array with the DOM XML-RPC API | ||
| 4 : | * @package dom-xmlrpc | ||
| 5 : | * @copyright (C) 2004 John Heinstein. All rights reserved | ||
| 6 : | * @license http://www.gnu.org/copyleft/lesser.html LGPL License | ||
| 7 : | * @author John Heinstein <johnkarl@nbnet.nb.ca> | ||
| 8 : | * @link http://www.engageinteractive.com/dom_xmlrpc/ DOM XML-RPC Home Page | ||
| 9 : | * DOM XML-RPC is Free Software | ||
| 10 : | **/ | ||
| 11 : | |||
| 12 : | |||
| 13 : | if (!defined('DOM_XMLRPC_INCLUDE_PATH')) { | ||
| 14 : | define('DOM_XMLRPC_INCLUDE_PATH', (dirname(__FILE__) . "/")); | ||
| 15 : | } | ||
| 16 : | |||
| 17 : | require_once(DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_constants.php'); | ||
| 18 : | |||
| 19 : | /** | ||
| 20 : | * An array of XML-RPC data wrapped in the DOM XML-RPC API | ||
| 21 : | * | ||
| 22 : | * @package dom-xmlrpc | ||
| 23 : | * @author John Heinstein <johnkarl@nbnet.nb.ca> | ||
| 24 : | */ | ||
| 25 : | class dom_xmlrpc_array_document { | ||
| 26 : | /** @var string The type of method - response or fault */ | ||
| 27 : | var $methodType; | ||
| 28 : | /** @var string The name of the requested method */ | ||
| 29 : | var $methodName = ""; | ||
| 30 : | /** @var string An array containing the method response params */ | ||
| 31 : | var $params = array(); | ||
| 32 : | /** @var int The fault code, if one exists */ | ||
| 33 : | var $faultCode = null; | ||
| 34 : | /** @var string A description of the fault code, if one exists */ | ||
| 35 : | var $faultString = null; | ||
| 36 : | |||
| 37 : | /** | ||
| 38 : | * dom_xmlrpc_array_document constructor | ||
| 39 : | */ | ||
| 40 : | function dom_xmlrpc_array_document() { | ||
| 41 : | //do nothing | ||
| 42 : | } //dom_xmlrpc_array_document | ||
| 43 : | |||
| 44 : | /** | ||
| 45 : | * Returns the method type | ||
| 46 : | * @return string The method type | ||
| 47 : | */ | ||
| 48 : | function getMethodType() { | ||
| 49 : | return $this->methodType; | ||
| 50 : | } //getMethodType | ||
| 51 : | |||
| 52 : | /** | ||
| 53 : | * Returns the method name | ||
| 54 : | * @return string The method name | ||
| 55 : | */ | ||
| 56 : | function getMethodName() { | ||
| 57 : | return $this->methodName; | ||
| 58 : | //if name is "", will be picked up by methodNotFoundHandler | ||
| 59 : | } //getMethodName | ||
| 60 : | |||
| 61 : | /** | ||
| 62 : | * Returns a reference to the params array | ||
| 63 : | * @return array A reference to the params array | ||
| 64 : | */ | ||
| 65 : | function &getParams() { | ||
| 66 : | return $this->params; | ||
| 67 : | } //getParams | ||
| 68 : | |||
| 69 : | /** | ||
| 70 : | * Returns a reference to the specified param | ||
| 71 : | * @param int The param index in the params array | ||
| 72 : | * @return mixed A reference to the param | ||
| 73 : | */ | ||
| 74 : | function &getParam($index) { | ||
| 75 : | return $this->params[$index]; | ||
| 76 : | } //getParam | ||
| 77 : | |||
| 78 : | /** | ||
| 79 : | * Returns the number of params in the params array | ||
| 80 : | * @return int The number of params in the params array | ||
| 81 : | */ | ||
| 82 : | function getParamCount() { | ||
| 83 : | return count($this->params); | ||
| 84 : | } //getParamCount | ||
| 85 : | |||
| 86 : | /** | ||
| 87 : | * Determines whether the method response is a fault | ||
| 88 : | * @return boolean True if the method response is a fault | ||
| 89 : | */ | ||
| 90 : | function isFault() { | ||
| 91 : | return ($this->methodType == DOM_XMLRPC_TYPE_FAULT); | ||
| 92 : | } //isFault | ||
| 93 : | |||
| 94 : | /** | ||
| 95 : | * Returns the current fault code | ||
| 96 : | * @return int The current fault code | ||
| 97 : | */ | ||
| 98 : | function getFaultCode() { | ||
| 99 : | return $this->faultCode; | ||
| 100 : | } //getFaultCode | ||
| 101 : | |||
| 102 : | /** | ||
| 103 : | * Returns the current fault string | ||
| 104 : | * @return string The current fault string | ||
| 105 : | */ | ||
| 106 : | function getFaultString() { | ||
| 107 : | return $this->faultString; | ||
| 108 : | } //getFaultString | ||
| 109 : | |||
| 110 : | /** | ||
| 111 : | * Returns the type of the specified param | ||
| 112 : | * @param mixed The param to be tested | ||
| 113 : | * @return string The type of the specified param | ||
| 114 : | */ | ||
| 115 : | function getParamType($param) { | ||
| 116 : | require_once(DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_utilities.php'); | ||
| 117 : | return (dom_xmlrpc_utilities::getTypeFromValue($param)); | ||
| 118 : | } //getParamType | ||
| 119 : | |||
| 120 : | /** | ||
| 121 : | * Returns a string representation of the parameters array | ||
| 122 : | * @return string A string representation of the parameters array | ||
| 123 : | */ | ||
| 124 : | function toString() { | ||
| 125 : | ob_start(); | ||
| 126 : | print_r($this->params); | ||
| 127 : | |||
| 128 : | $ob_contents = ob_get_contents(); | ||
| 129 : | ob_end_clean(); | ||
| 130 : | |||
| 131 : | return $ob_contents; | ||
| 132 : | } //toString | ||
| 133 : | |||
| 134 : | /** | ||
| 135 : | * Returns a formatted string representation of the parameters array | ||
| 136 : | * @return string A formatted string representation of the parameters array | ||
| 137 : | */ | ||
| 138 : | function toNormalizedString() { | ||
| 139 : | return $this->toString(); | ||
| 140 : | } //toNormalizedString | ||
| 141 : | } //dom_xmlrpc_array_document | ||
| 142 : | |||
| 143 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

