From 3a6bf43c16f185b6082e08153fbf262716649450 Mon Sep 17 00:00:00 2001 From: Samu Voutilainen Date: Fri, 23 May 2014 12:50:51 +0300 Subject: [PATCH] Modernized old classes --- lib/xmlrpc_client.php | 372 ++++++++++++++++++++---------------------- lib/xmlrpcmsg.php | 142 +++++++--------- lib/xmlrpcresp.php | 101 ++++++------ lib/xmlrpcval.php | 193 +++++++++------------- 4 files changed, 365 insertions(+), 443 deletions(-) diff --git a/lib/xmlrpc_client.php b/lib/xmlrpc_client.php index eac05d0..7e58aee 100644 --- a/lib/xmlrpc_client.php +++ b/lib/xmlrpc_client.php @@ -1,76 +1,77 @@ debug=$in; } /** - * Add some http BASIC AUTH credentials, used by the client to authenticate - * @param string $u username - * @param string $p password - * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth) - * @access public - */ - function setCredentials($u, $p, $t=1) + * Add some http BASIC AUTH credentials, used by the client to authenticate + * @param string $u username + * @param string $p password + * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth) + */ + public function setCredentials($u, $p, $t=1) { $this->username=$u; $this->password=$p; @@ -167,25 +166,23 @@ class xmlrpc_client } /** - * Add a client-side https certificate - * @param string $cert - * @param string $certpass - * @access public - */ - function setCertificate($cert, $certpass) + * Add a client-side https certificate + * @param string $cert + * @param string $certpass + */ + public function setCertificate($cert, $certpass) { $this->cert = $cert; $this->certpass = $certpass; } /** - * Add a CA certificate to verify server with (see man page about - * CURLOPT_CAINFO for more details) - * @param string $cacert certificate file name (or dir holding certificates) - * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false - * @access public - */ - function setCaCertificate($cacert, $is_dir=false) + * Add a CA certificate to verify server with (see man page about + * CURLOPT_CAINFO for more details) + * @param string $cacert certificate file name (or dir holding certificates) + * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false + */ + public function setCaCertificate($cacert, $is_dir=false) { if ($is_dir) { @@ -198,49 +195,45 @@ class xmlrpc_client } /** - * Set attributes for SSL communication: private SSL key - * NB: does not work in older php/curl installs - * Thanks to Daniel Convissor - * @param string $key The name of a file containing a private SSL key - * @param string $keypass The secret password needed to use the private SSL key - * @access public - */ - function setKey($key, $keypass) + * Set attributes for SSL communication: private SSL key + * NB: does not work in older php/curl installs + * Thanks to Daniel Convissor + * @param string $key The name of a file containing a private SSL key + * @param string $keypass The secret password needed to use the private SSL key + */ + public function setKey($key, $keypass) { $this->key = $key; $this->keypass = $keypass; } /** - * Set attributes for SSL communication: verify server certificate - * @param bool $i enable/disable verification of peer certificate - * @access public - */ - function setSSLVerifyPeer($i) + * Set attributes for SSL communication: verify server certificate + * @param bool $i enable/disable verification of peer certificate + */ + public function setSSLVerifyPeer($i) { $this->verifypeer = $i; } /** - * Set attributes for SSL communication: verify match of server cert w. hostname - * @param int $i - * @access public - */ - function setSSLVerifyHost($i) + * Set attributes for SSL communication: verify match of server cert w. hostname + * @param int $i + */ + public function setSSLVerifyHost($i) { $this->verifyhost = $i; } /** - * Set proxy info - * @param string $proxyhost - * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS - * @param string $proxyusername Leave blank if proxy has public access - * @param string $proxypassword Leave blank if proxy has public access - * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy - * @access public - */ - function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1) + * Set proxy info + * @param string $proxyhost + * @param string $proxyport Defaults to 8080 for HTTP and 443 for HTTPS + * @param string $proxyusername Leave blank if proxy has public access + * @param string $proxypassword Leave blank if proxy has public access + * @param int $proxyauthtype set to constant CURLAUTH_NTLM to use NTLM auth with proxy + */ + public function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1) { $this->proxy = $proxyhost; $this->proxyport = $proxyport; @@ -250,14 +243,13 @@ class xmlrpc_client } /** - * Enables/disables reception of compressed xmlrpc responses. - * Note that enabling reception of compressed responses merely adds some standard - * http headers to xmlrpc requests. It is up to the xmlrpc server to return - * compressed responses when receiving such requests. - * @param string $compmethod either 'gzip', 'deflate', 'any' or '' - * @access public - */ - function setAcceptedCompression($compmethod) + * Enables/disables reception of compressed xmlrpc responses. + * Note that enabling reception of compressed responses merely adds some standard + * http headers to xmlrpc requests. It is up to the xmlrpc server to return + * compressed responses when receiving such requests. + * @param string $compmethod either 'gzip', 'deflate', 'any' or '' + */ + public function setAcceptedCompression($compmethod) { if ($compmethod == 'any') $this->accepted_compression = array('gzip', 'deflate'); @@ -269,31 +261,29 @@ class xmlrpc_client } /** - * Enables/disables http compression of xmlrpc request. - * Take care when sending compressed requests: servers might not support them - * (and automatic fallback to uncompressed requests is not yet implemented) - * @param string $compmethod either 'gzip', 'deflate' or '' - * @access public - */ - function setRequestCompression($compmethod) + * Enables/disables http compression of xmlrpc request. + * Take care when sending compressed requests: servers might not support them + * (and automatic fallback to uncompressed requests is not yet implemented) + * @param string $compmethod either 'gzip', 'deflate' or '' + */ + public function setRequestCompression($compmethod) { $this->request_compression = $compmethod; } /** - * Adds a cookie to list of cookies that will be sent to server. - * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie: - * do not do it unless you know what you are doing - * @param string $name - * @param string $value - * @param string $path - * @param string $domain - * @param int $port - * @access public - * - * @todo check correctness of urlencoding cookie value (copied from php way of doing it...) - */ - function setCookie($name, $value='', $path='', $domain='', $port=null) + * Adds a cookie to list of cookies that will be sent to server. + * NB: setting any param but name and value will turn the cookie into a 'version 1' cookie: + * do not do it unless you know what you are doing + * @param string $name + * @param string $value + * @param string $path + * @param string $domain + * @param int $port + * + * @todo check correctness of urlencoding cookie value (copied from php way of doing it...) + */ + public function setCookie($name, $value='', $path='', $domain='', $port=null) { $this->cookies[$name]['value'] = urlencode($value); if ($path || $domain || $port) @@ -310,33 +300,32 @@ class xmlrpc_client } /** - * Directly set cURL options, for extra flexibility - * It allows eg. to bind client to a specific IP interface / address - * @param array $options - */ + * Directly set cURL options, for extra flexibility + * It allows eg. to bind client to a specific IP interface / address + * @param array $options + */ function SetCurlOptions( $options ) { $this->extracurlopts = $options; } /** - * Set user-agent string that will be used by this client instance - * in http headers sent to the server - */ + * Set user-agent string that will be used by this client instance + * in http headers sent to the server + */ function SetUserAgent( $agentstring ) { $this->user_agent = $agentstring; } /** - * Send an xmlrpc request - * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request - * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply - * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used - * @return xmlrpcresp - * @access public - */ - function& send($msg, $timeout=0, $method='') + * Send an xmlrpc request + * @param mixed $msg The message object, or an array of messages for using multicall, or the complete xml representation of a request + * @param integer $timeout Connection timeout, in seconds, If unspecified, a platform specific timeout will apply + * @param string $method if left unspecified, the http protocol chosen during creation of the object will be used + * @return xmlrpcresp + */ + public function& send($msg, $timeout=0, $method='') { // if user deos not specify http protocol, use native method of this client // (i.e. method set during call to constructor) @@ -429,10 +418,7 @@ class xmlrpc_client return $r; } - /** - * @access private - */ - function &sendPayloadHTTP10($msg, $server, $port, $timeout=0, + private function &sendPayloadHTTP10($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1) { @@ -619,10 +605,7 @@ class xmlrpc_client } - /** - * @access private - */ - function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='', + private function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='', $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $keepalive=false, $key='', $keypass='') @@ -634,12 +617,11 @@ class xmlrpc_client } /** - * Contributed by Justin Miller - * Requires curl to be built into PHP - * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers! - * @access private - */ - function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', + * Contributed by Justin Miller + * Requires curl to be built into PHP + * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers! + */ + private function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='', $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='', $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https', $keepalive=false, $key='', $keypass='') @@ -915,28 +897,27 @@ class xmlrpc_client } /** - * Send an array of request messages and return an array of responses. - * Unless $this->no_multicall has been set to true, it will try first - * to use one single xmlrpc call to server method system.multicall, and - * revert to sending many successive calls in case of failure. - * This failure is also stored in $this->no_multicall for subsequent calls. - * Unfortunately, there is no server error code universally used to denote - * the fact that multicall is unsupported, so there is no way to reliably - * distinguish between that and a temporary failure. - * If you are sure that server supports multicall and do not want to - * fallback to using many single calls, set the fourth parameter to FALSE. - * - * NB: trying to shoehorn extra functionality into existing syntax has resulted - * in pretty much convoluted code... - * - * @param array $msgs an array of xmlrpcmsg objects - * @param integer $timeout connection timeout (in seconds) - * @param string $method the http protocol variant to be used - * @param boolean fallback When true, upon receiving an error during multicall, multiple single calls will be attempted - * @return array - * @access public - */ - function multicall($msgs, $timeout=0, $method='', $fallback=true) + * Send an array of request messages and return an array of responses. + * Unless $this->no_multicall has been set to true, it will try first + * to use one single xmlrpc call to server method system.multicall, and + * revert to sending many successive calls in case of failure. + * This failure is also stored in $this->no_multicall for subsequent calls. + * Unfortunately, there is no server error code universally used to denote + * the fact that multicall is unsupported, so there is no way to reliably + * distinguish between that and a temporary failure. + * If you are sure that server supports multicall and do not want to + * fallback to using many single calls, set the fourth parameter to FALSE. + * + * NB: trying to shoehorn extra functionality into existing syntax has resulted + * in pretty much convoluted code... + * + * @param array $msgs an array of xmlrpcmsg objects + * @param integer $timeout connection timeout (in seconds) + * @param string $method the http protocol variant to be used + * @param boolean fallback When true, upon receiving an error during multicall, multiple single calls will be attempted + * @return array + */ + public function multicall($msgs, $timeout=0, $method='', $fallback=true) { $xmlrpc = Phpxmlrpc::instance(); @@ -1005,12 +986,11 @@ class xmlrpc_client } /** - * Attempt to boxcar $msgs via system.multicall. - * Returns either an array of xmlrpcreponses, an xmlrpc error response - * or false (when received response does not respect valid multicall syntax) - * @access private - */ - function _try_multicall($msgs, $timeout, $method) + * Attempt to boxcar $msgs via system.multicall. + * Returns either an array of xmlrpcreponses, an xmlrpc error response + * or false (when received response does not respect valid multicall syntax) + */ + private function _try_multicall($msgs, $timeout, $method) { // Construct multicall message $calls = array(); diff --git a/lib/xmlrpcmsg.php b/lib/xmlrpcmsg.php index 7a6d32a..428acc5 100644 --- a/lib/xmlrpcmsg.php +++ b/lib/xmlrpcmsg.php @@ -1,18 +1,18 @@ methodname=$meth; if(is_array($pars) && count($pars)>0) @@ -24,10 +24,7 @@ class xmlrpcmsg } } - /** - * @access private - */ - function xml_header($charset_encoding='') + private function xml_header($charset_encoding='') { if ($charset_encoding != '') { @@ -39,26 +36,17 @@ class xmlrpcmsg } } - /** - * @access private - */ - function xml_footer() + private function xml_footer() { return ''; } - /** - * @access private - */ - function kindOf() + private function kindOf() { return 'msg'; } - /** - * @access private - */ - function createPayload($charset_encoding='') + private function createPayload($charset_encoding='') { if ($charset_encoding != '') $this->content_type = 'text/xml; charset=' . $charset_encoding; @@ -78,12 +66,11 @@ class xmlrpcmsg } /** - * Gets/sets the xmlrpc method to be invoked - * @param string $meth the method to be set (leave empty not to set it) - * @return string the method that will be invoked - * @access public - */ - function method($meth='') + * Gets/sets the xmlrpc method to be invoked + * @param string $meth the method to be set (leave empty not to set it) + * @return string the method that will be invoked + */ + public function method($meth='') { if($meth!='') { @@ -93,24 +80,22 @@ class xmlrpcmsg } /** - * Returns xml representation of the message. XML prologue included - * @param string $charset_encoding - * @return string the xml representation of the message, xml prologue included - * @access public - */ - function serialize($charset_encoding='') + * Returns xml representation of the message. XML prologue included + * @param string $charset_encoding + * @return string the xml representation of the message, xml prologue included + */ + public function serialize($charset_encoding='') { $this->createPayload($charset_encoding); return $this->payload; } /** - * Add a parameter to the list of parameters to be used upon method invocation - * @param xmlrpcval $par - * @return boolean false on failure - * @access public - */ - function addParam($par) + * Add a parameter to the list of parameters to be used upon method invocation + * @param xmlrpcval $par + * @return boolean false on failure + */ + public function addParam($par) { // add check: do not add to self params which are not xmlrpcvals if(is_object($par) && is_a($par, 'xmlrpcval')) @@ -125,34 +110,31 @@ class xmlrpcmsg } /** - * Returns the nth parameter in the message. The index zero-based. - * @param integer $i the index of the parameter to fetch (zero based) - * @return xmlrpcval the i-th parameter - * @access public - */ - function getParam($i) { return $this->params[$i]; } + * Returns the nth parameter in the message. The index zero-based. + * @param integer $i the index of the parameter to fetch (zero based) + * @return xmlrpcval the i-th parameter + */ + public function getParam($i) { return $this->params[$i]; } /** - * Returns the number of parameters in the messge. - * @return integer the number of parameters currently set - * @access public - */ - function getNumParams() { return count($this->params); } + * Returns the number of parameters in the messge. + * @return integer the number of parameters currently set + */ + public function getNumParams() { return count($this->params); } /** - * Given an open file handle, read all data available and parse it as axmlrpc response. - * NB: the file handle is not closed by this function. - * NNB: might have trouble in rare cases to work on network streams, as we - * check for a read of 0 bytes instead of feof($fp). - * But since checking for feof(null) returns false, we would risk an - * infinite loop in that case, because we cannot trust the caller - * to give us a valid pointer to an open file... - * @access public - * @param resource $fp stream pointer - * @return xmlrpcresp - * @todo add 2nd & 3rd param to be passed to ParseResponse() ??? - */ - function &parseResponseFile($fp) + * Given an open file handle, read all data available and parse it as axmlrpc response. + * NB: the file handle is not closed by this function. + * NNB: might have trouble in rare cases to work on network streams, as we + * check for a read of 0 bytes instead of feof($fp). + * But since checking for feof(null) returns false, we would risk an + * infinite loop in that case, because we cannot trust the caller + * to give us a valid pointer to an open file... + * @param resource $fp stream pointer + * @return xmlrpcresp + * @todo add 2nd & 3rd param to be passed to ParseResponse() ??? + */ + public function &parseResponseFile($fp) { $ipd=''; while($data=fread($fp, 32768)) @@ -165,10 +147,9 @@ class xmlrpcmsg } /** - * Parses HTTP headers and separates them from data. - * @access private - */ - function &parseResponseHeaders(&$data, $headers_processed=false) + * Parses HTTP headers and separates them from data. + */ + private function &parseResponseHeaders(&$data, $headers_processed=false) { $xmlrpc = Phpxmlrpc::instance(); // Support "web-proxy-tunelling" connections for https through proxies @@ -400,14 +381,13 @@ class xmlrpcmsg } /** - * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object. - * @param string $data the xmlrpc response, eventually including http headers - * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding - * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals' - * @return xmlrpcresp - * @access public - */ - function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals') + * Parse the xmlrpc response contained in the string $data and return an xmlrpcresp object. + * @param string $data the xmlrpc response, eventually including http headers + * @param bool $headers_processed when true prevents parsing HTTP headers for interpretation of content-encoding and consequent decoding + * @param string $return_type decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or 'phpvals' + * @return xmlrpcresp + */ + public function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals') { $xmlrpc = Phpxmlrpc::instance(); diff --git a/lib/xmlrpcresp.php b/lib/xmlrpcresp.php index df4c265..9898173 100644 --- a/lib/xmlrpcresp.php +++ b/lib/xmlrpcresp.php @@ -1,28 +1,28 @@ errno; } /** - * Returns the error code of the response. - * @return string the error string of this response ('' for not-error responses) - * @access public - */ - function faultString() + * Returns the error code of the response. + * @return string the error string of this response ('' for not-error responses) + */ + public function faultString() { return $this->errstr; } /** - * Returns the value received by the server. - * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects - * @access public - */ - function value() + * Returns the value received by the server. + * @return mixed the xmlrpcval object returned by the server. Might be an xml string or php value if the response has been created by specially configured xmlrpc_client objects + */ + public function value() { return $this->val; } /** - * Returns an array with the cookies received from the server. - * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...) - * with attributes being e.g. 'expires', 'path', domain'. - * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past) - * are still present in the array. It is up to the user-defined code to decide - * how to use the received cookies, and whether they have to be sent back with the next - * request to the server (using xmlrpc_client::setCookie) or not - * @return array array of cookies received from the server - * @access public - */ - function cookies() + * Returns an array with the cookies received from the server. + * Array has the form: $cookiename => array ('value' => $val, $attr1 => $val1, $attr2 = $val2, ...) + * with attributes being e.g. 'expires', 'path', domain'. + * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past) + * are still present in the array. It is up to the user-defined code to decide + * how to use the received cookies, and whether they have to be sent back with the next + * request to the server (using xmlrpc_client::setCookie) or not + * @return array array of cookies received from the server + */ + public function cookies() { return $this->_cookies; } /** - * Returns xml representation of the response. XML prologue not included - * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed - * @return string the xml representation of the response - * @access public - */ - function serialize($charset_encoding='') + * Returns xml representation of the response. XML prologue not included + * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed + * @return string the xml representation of the response + */ + public function serialize($charset_encoding='') { $xmlrpc = Phpxmlrpc::instance(); diff --git a/lib/xmlrpcval.php b/lib/xmlrpcval.php index dd845ed..59ef28b 100644 --- a/lib/xmlrpcval.php +++ b/lib/xmlrpcval.php @@ -1,17 +1,17 @@ mytype==0) @@ -155,14 +154,13 @@ class xmlrpcval } /** - * Add an array of named xmlrpcval objects to an xmlrpcval - * @param array $vals - * @return int 1 or 0 on failure - * @access public - * - * @todo add some checking for $vals to be an array? - */ - function addStruct($vals) + * Add an array of named xmlrpcval objects to an xmlrpcval + * @param array $vals + * @return int 1 or 0 on failure + * + * @todo add some checking for $vals to be an array? + */ + public function addStruct($vals) { $xmlrpc = Phpxmlrpc::instance(); @@ -185,29 +183,11 @@ class xmlrpcval } } - // poor man's version of print_r ??? - // DEPRECATED! - function dump($ar) - { - foreach($ar as $key => $val) - { - echo "$key => $val
"; - if($key == 'array') - { - while(list($key2, $val2) = each($val)) - { - echo "-- $key2 => $val2
"; - } - } - } - } - /** - * Returns a string containing "struct", "array" or "scalar" describing the base type of the value - * @return string - * @access public - */ - function kindOf() + * Returns a string containing "struct", "array" or "scalar" describing the base type of the value + * @return string + */ + public function kindOf() { switch($this->mytype) { @@ -225,10 +205,7 @@ class xmlrpcval } } - /** - * @access private - */ - function serializedata($typ, $val, $charset_encoding='') + private function serializedata($typ, $val, $charset_encoding='') { $xmlrpc = Phpxmlrpc::instance(); $rs=''; @@ -336,12 +313,11 @@ class xmlrpcval } /** - * Returns xml representation of the value. XML prologue not included - * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed - * @return string - * @access public - */ - function serialize($charset_encoding='') + * Returns xml representation of the value. XML prologue not included + * @param string $charset_encoding the charset to be used for serialization. if null, US-ASCII is assumed + * @return string + */ + public function serialize($charset_encoding='') { // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals... //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval'))) @@ -366,44 +342,40 @@ class xmlrpcval } /** - * Checks whether a struct member with a given name is present. - * Works only on xmlrpcvals of type struct. - * @param string $m the name of the struct member to be looked up - * @return boolean - * @access public - */ - function structmemexists($m) + * Checks whether a struct member with a given name is present. + * Works only on xmlrpcvals of type struct. + * @param string $m the name of the struct member to be looked up + * @return boolean + */ + public function structmemexists($m) { return array_key_exists($m, $this->me['struct']); } /** - * Returns the value of a given struct member (an xmlrpcval object in itself). - * Will raise a php warning if struct member of given name does not exist - * @param string $m the name of the struct member to be looked up - * @return xmlrpcval - * @access public - */ - function structmem($m) + * Returns the value of a given struct member (an xmlrpcval object in itself). + * Will raise a php warning if struct member of given name does not exist + * @param string $m the name of the struct member to be looked up + * @return xmlrpcval + */ + public function structmem($m) { return $this->me['struct'][$m]; } /** - * Reset internal pointer for xmlrpcvals of type struct. - * @access public - */ - function structreset() + * Reset internal pointer for xmlrpcvals of type struct. + */ + public function structreset() { reset($this->me['struct']); } /** - * Return next member element for xmlrpcvals of type struct. - * @return xmlrpcval - * @access public - */ - function structeach() + * Return next member element for xmlrpcvals of type struct. + * @return xmlrpcval + */ + public function structeach() { return each($this->me['struct']); } @@ -449,11 +421,10 @@ class xmlrpcval } /** - * Returns the value of a scalar xmlrpcval - * @return mixed - * @access public - */ - function scalarval() + * Returns the value of a scalar xmlrpcval + * @return mixed + */ + public function scalarval() { reset($this->me); list(,$b)=each($this->me); @@ -461,12 +432,11 @@ class xmlrpcval } /** - * Returns the type of the xmlrpcval. - * For integers, 'int' is always returned in place of 'i4' - * @return string - * @access public - */ - function scalartyp() + * Returns the type of the xmlrpcval. + * For integers, 'int' is always returned in place of 'i4' + * @return string + */ + public function scalartyp() { $xmlrpc = Phpxmlrpc::instance(); @@ -480,32 +450,29 @@ class xmlrpcval } /** - * Returns the m-th member of an xmlrpcval of struct type - * @param integer $m the index of the value to be retrieved (zero based) - * @return xmlrpcval - * @access public - */ - function arraymem($m) + * Returns the m-th member of an xmlrpcval of struct type + * @param integer $m the index of the value to be retrieved (zero based) + * @return xmlrpcval + */ + public function arraymem($m) { return $this->me['array'][$m]; } /** - * Returns the number of members in an xmlrpcval of array type - * @return integer - * @access public - */ - function arraysize() + * Returns the number of members in an xmlrpcval of array type + * @return integer + */ + public function arraysize() { return count($this->me['array']); } /** - * Returns the number of members in an xmlrpcval of struct type - * @return integer - * @access public - */ - function structsize() + * Returns the number of members in an xmlrpcval of struct type + * @return integer + */ + public function structsize() { return count($this->me['struct']); } -- 2.43.0