From 5481456fe553efa3dbdb90c3c05799637b595737 Mon Sep 17 00:00:00 2001 From: gggeek Date: Mon, 25 May 2015 18:42:21 +0100 Subject: [PATCH] Add a warning to the manual; move more method names to camelCase; fix support for very legacy calling convention in wrap_xmlrpc_method --- demo/client/wrap.php | 2 +- demo/server/server.php | 22 ++++----- demo/vardemo.php | 10 ++-- doc/manual/phpxmlrpc_manual.adoc | 5 +- lib/xmlrpc.inc | 8 ++-- lib/xmlrpc_wrappers.inc | 82 +++++++++++++++++++++++++------- src/Encoder.php | 4 +- src/Helper/Date.php | 4 +- src/Wrapper.php | 55 ++++++++++++--------- 9 files changed, 127 insertions(+), 65 deletions(-) diff --git a/demo/client/wrap.php b/demo/client/wrap.php index 0b3022d..c13c55d 100644 --- a/demo/client/wrap.php +++ b/demo/client/wrap.php @@ -29,7 +29,7 @@ if ($resp->faultCode()) { foreach ($resp->value() as $methodName) { // $resp->value is an array of strings if ($methodName == 'examples.getStateName') { - $callable = $wrapper->wrap_xmlrpc_method($client, $methodName); + $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); if ($callable) { echo "
  • Remote server method " . htmlspecialchars($methodName) . " wrapped into php function
  • \n"; } else { diff --git a/demo/server/server.php b/demo/server/server.php index e2e3c6f..1fdd49b 100644 --- a/demo/server/server.php +++ b/demo/server/server.php @@ -150,27 +150,27 @@ function inner_findstate($stateNo) $wrapper = new PhpXmlRpc\Wrapper(); -$findstate2_sig = $wrapper->wrap_php_function('inner_findstate'); +$findstate2_sig = $wrapper->wrapPhpFunction('inner_findstate'); -$findstate3_sig = $wrapper->wrap_php_function(array('xmlrpcServerMethodsContainer', 'findState')); +$findstate3_sig = $wrapper->wrapPhpFunction(array('xmlrpcServerMethodsContainer', 'findState')); $obj = new xmlrpcServerMethodsContainer(); -$findstate4_sig = $wrapper->wrap_php_function(array($obj, 'findstate')); +$findstate4_sig = $wrapper->wrapPhpFunction(array($obj, 'findstate')); -$findstate5_sig = $wrapper->wrap_php_function('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true)); +$findstate5_sig = $wrapper->wrapPhpFunction('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true)); eval($findstate5_sig['source']); -$findstate6_sig = $wrapper->wrap_php_function('inner_findstate', '', array('return_source' => true)); +$findstate6_sig = $wrapper->wrapPhpFunction('inner_findstate', '', array('return_source' => true)); eval($findstate6_sig['source']); -$findstate7_sig = $wrapper->wrap_php_function(array('xmlrpcServerMethodsContainer', 'findState'), '', array('return_source' => true)); +$findstate7_sig = $wrapper->wrapPhpFunction(array('xmlrpcServerMethodsContainer', 'findState'), '', array('return_source' => true)); eval($findstate7_sig['source']); $obj = new xmlrpcServerMethodsContainer(); -$findstate8_sig = $wrapper->wrap_php_function(array($obj, 'findstate'), '', array('return_source' => true)); +$findstate8_sig = $wrapper->wrapPhpFunction(array($obj, 'findstate'), '', array('return_source' => true)); eval($findstate8_sig['source']); -$findstate9_sig = $wrapper->wrap_php_function('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true)); +$findstate9_sig = $wrapper->wrapPhpFunction('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true)); eval($findstate9_sig['source']); $findstate10_sig = array( @@ -179,12 +179,12 @@ $findstate10_sig = array( "docstring" => $findstate_doc, ); -$findstate11_sig = $wrapper->wrap_php_function(function ($stateNo) { return inner_findstate($stateNo); }); +$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return inner_findstate($stateNo); }); $c = new xmlrpcServerMethodsContainer; -$moreSignatures = $wrapper->wrap_php_class($c, array('prefix' => 'tests.', 'method_type' => 'all')); +$moreSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'tests.', 'method_type' => 'all')); -$returnObj_sig = $wrapper->wrap_php_function(array($c, 'returnObject'), '', array('encode_php_objs' => true)); +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); $addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt)); $addtwo_doc = 'Add two integers together and return the result'; diff --git a/demo/vardemo.php b/demo/vardemo.php index d24d04e..bb69756 100644 --- a/demo/vardemo.php +++ b/demo/vardemo.php @@ -78,13 +78,13 @@ print "
    " . htmlentities($op) . "
    "; print "

    Testing ISO date format

    \n";
     
     $t = time();
    -$date = PhpXmlRpc\Helper\Date::iso8601_encode($t);
    +$date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
     print "Now is $t --> $date\n";
    -print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601_encode($t, 1) . "\n";
    -$tb = PhpXmlRpc\Helper\Date::iso8601_decode($date);
    +print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n";
    +$tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
     print "That is to say $date --> $tb\n";
    -print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601_encode($tb) . "\n";
    -print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601_decode($date, 1) . "\n";
    +print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n";
    +print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Eecode($date, 1) . "\n";
     
     print "
    \n"; diff --git a/doc/manual/phpxmlrpc_manual.adoc b/doc/manual/phpxmlrpc_manual.adoc index 907f00b..7a8b880 100644 --- a/doc/manual/phpxmlrpc_manual.adoc +++ b/doc/manual/phpxmlrpc_manual.adoc @@ -1,6 +1,6 @@ = XML-RPC for PHP :revision: 4.0.0 -:keywords: xml, rpc, xmlrpc, webservices, http +:keywords: xmlrpc, ,xml, rpc, webservices, http :toc: left :imagesdir: images :source-highlighter: highlightjs @@ -9,6 +9,9 @@ [preface] == Introduction +NB: THIS MANUAL HAS NOT YET BEEN UPDATED TO REFLECT ALL THE CHANGES WHICH HAVE MADE IN VERSION 4. +DO NOT USE FOR NOW. + XML-RPC is a format devised by link:$$http://www.userland.com/$$[Userland Software] for achieving remote procedure call via XML using HTTP as the transport. XML-RPC has its own web site, link:$$http://www.xmlrpc.com/$$[www.xmlrpc.com] diff --git a/lib/xmlrpc.inc b/lib/xmlrpc.inc index 450e881..0ae42fd 100644 --- a/lib/xmlrpc.inc +++ b/lib/xmlrpc.inc @@ -160,12 +160,12 @@ function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='') function iso8601_encode($timeT, $utc=0) { - return PhpXmlRpc\Helper\Date::iso8601_encode($timeT, $utc); + return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc); } function iso8601_decode($iDate, $utc=0) { - return PhpXmlRpc\Helper\Date::iso8601_decode($iDate, $utc); + return PhpXmlRpc\Helper\Date::iso8601Decode($iDate, $utc); } function decode_chunked($buffer) @@ -188,7 +188,7 @@ function php_xmlrpc_encode($phpVal, $options=array()) function php_xmlrpc_decode_xml($xmlVal, $options=array()) { $encoder = new PhpXmlRpc\Encoder(); - return $encoder->decode_xml($xmlVal, $options); + return $encoder->decodeXml($xmlVal, $options); } function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null) @@ -203,5 +203,5 @@ function has_encoding($xmlChunk) function is_valid_charset($encoding, $validList) { - return PhpXmlRpc\Helper\Charset::instance()->is_valid_charset($encoding, $validList); + return PhpXmlRpc\Helper\Charset::instance()->isValidCharset($encoding, $validList); } diff --git a/lib/xmlrpc_wrappers.inc b/lib/xmlrpc_wrappers.inc index fc178dc..c9e3449 100644 --- a/lib/xmlrpc_wrappers.inc +++ b/lib/xmlrpc_wrappers.inc @@ -12,47 +12,97 @@ include_once(__DIR__.'/../src/Wrapper.php'); /* Expose as global functions the ones which are now class methods */ +/** + * @see PhpXmlRpc\Wrapper::php_2_xmlrpc_type + * @param string $phpType + * @return string + */ function php_2_xmlrpc_type($phpType) { $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->php_2_xmlrpc_type($phpType); + return $wrapper->php2XmlrpcType($phpType); } +/** + * @see PhpXmlRpc\Wrapper::xmlrpc_2_php_type + * @param string $xmlrpcType + * @return string + */ function xmlrpc_2_php_type($xmlrpcType) { $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->xmlrpc_2_php_type($xmlrpcType); + return $wrapper->xmlrpc2PhpType($xmlrpcType); } -/// @todo return string instead of callable +/// @todo backwards compat: return string instead of callable +/** + * @see PhpXmlRpc\Wrapper::wrap_php_function + * @param callable $funcName + * @param string $newFuncName + * @param array $extraOptions + * @return array|false + */ function wrap_php_function($funcName, $newFuncName='', $extraOptions=array()) { $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->wrap_php_function($funcName, $newFuncName, $extraOptions); + return $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions); } -/// @todo return strings instead of callables +/// @todo backwards compat: return strings instead of callables +/** + * @see PhpXmlRpc\Wrapper::wrap_php_class + * @param string|object $className + * @param array $extraOptions + * @return array|false + */ function wrap_php_class($className, $extraOptions=array()) { $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->wrap_php_class($className, $extraOptions); + return $wrapper->wrapPhpClass($className, $extraOptions); } -/// @todo support different calling convention -/// @todo return string instead of callable +/// @todo backwards compat: return string instead of callable +/** + * @see PhpXmlRpc\Wrapper::wrapXmlrpcMethod + * @param xmlrpc_client $client + * @param string $methodName + * @param int|array $extraOptions the usage of an int as signature number is deprecated, use an option in $extraOptions + * @param int $timeout deprecated, use an option in $extraOptions + * @param string $protocol deprecated, use an option in $extraOptions + * @param string $newFuncName deprecated, use an option in $extraOptions + * @return array|callable|false + */ function wrap_xmlrpc_method($client, $methodName, $extraOptions=0, $timeout=0, $protocol='', $newFuncName='') { + if (!is_array($extraOptions)) + { + $sigNum = $extraOptions; + $extraOptions = array( + 'signum' => $sigNum, + 'timeout' => $timeout, + 'protocol' => $protocol, + 'new_function_name' => $newFuncName + ); + } + $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->wrap_xmlrpc_method($client, $methodName, $extraOptions, $timeout, $protocol, $newFuncName); + return $wrapper->wrapXmlrpcMethod($client, $methodName, $extraOptions); } -/// @todo return strings instead of callables +/// @todo backwards compat: return strings instead of callables +/** + * @see PhpXmlRpc\Wrapper::wrap_xmlrpc_server + * @param xmlrpc_client $client + * @param array $extraOptions + * @return mixed + */ function wrap_xmlrpc_server($client, $extraOptions=array()) { $wrapper = new PhpXmlRpc\Wrapper(); - return $wrapper->wrap_xmlrpc_server($client, $extraOptions); + return $wrapper->wrapXmlrpcServer($client, $extraOptions); } +/// @todo fix dangling usage of $this-> /** * Given the necessary info, build php code that creates a new function to invoke a remote xmlrpc method. * Take care that no full checking of input parameters is done to ensure that valid php code is emitted. @@ -62,9 +112,9 @@ function wrap_xmlrpc_server($client, $extraOptions=array()) * @deprecated */ function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, - $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', - $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, - $faultResponse = '', $namespace = '\\PhpXmlRpc\\') + $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', + $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, + $faultResponse = '', $namespace = '\\PhpXmlRpc\\') { $code = "function $xmlrpcFuncName ("; if ($clientCopyMode < 2) { @@ -106,14 +156,14 @@ function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, } } $innerCode .= "\$req->addparam(\$p$i);\n"; - $mDesc .= '* @param ' . $this->xmlrpc_2_php_type($pType) . " \$p$i\n"; + $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; } if ($clientCopyMode < 2) { $plist[] = '$debug=0'; $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; } $plist = implode(', ', $plist); - $mDesc .= '* @return ' . $this->xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; + $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; if ($decodeFault) { diff --git a/src/Encoder.php b/src/Encoder.php index 21be70f..7f51cfa 100644 --- a/src/Encoder.php +++ b/src/Encoder.php @@ -39,7 +39,7 @@ class Encoder case 'dateTime.iso8601': $xmlrpcVal->scalar = $val; $xmlrpcVal->type = 'datetime'; - $xmlrpcVal->timestamp = \PhpXmlRpc\Helper\Date::iso8601_decode($val); + $xmlrpcVal->timestamp = \PhpXmlRpc\Helper\Date::iso8601Decode($val); return $xmlrpcVal; case 'base64': @@ -230,7 +230,7 @@ class Encoder * * @return mixed false on error, or an instance of either Value, Request or Response */ - public function decode_xml($xmlVal, $options = array()) + public function decodeXml($xmlVal, $options = array()) { // 'guestimate' encoding $valEncoding = XMLParser::guessEncoding('', $xmlVal); diff --git a/src/Helper/Date.php b/src/Helper/Date.php index 8bd7993..f97f52c 100644 --- a/src/Helper/Date.php +++ b/src/Helper/Date.php @@ -22,7 +22,7 @@ class Date * * @return string */ - public static function iso8601_encode($timet, $utc = 0) + public static function iso8601Encode($timet, $utc = 0) { if (!$utc) { $t = strftime("%Y%m%dT%H:%M:%S", $timet); @@ -47,7 +47,7 @@ class Date * * @return int (datetime) */ - public static function iso8601_decode($idate, $utc = 0) + public static function iso8601Decode($idate, $utc = 0) { $t = 0; if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs)) { diff --git a/src/Wrapper.php b/src/Wrapper.php index 02ced67..21321a6 100644 --- a/src/Wrapper.php +++ b/src/Wrapper.php @@ -18,7 +18,7 @@ namespace PhpXmlRpc; */ class Wrapper { - /// used to hold a reference to object instances whose methods get wrapped by wrap_php_function(), in 'create source' mode + /// used to hold a reference to object instances whose methods get wrapped by wrapPhpFunction(), in 'create source' mode public static $objHolder = array(); /** @@ -34,7 +34,7 @@ class Wrapper * * @return string */ - public function php_2_xmlrpc_type($phpType) + public function php2XmlrpcType($phpType) { switch (strtolower($phpType)) { case 'string': @@ -76,7 +76,7 @@ class Wrapper * * @return string */ - public function xmlrpc_2_php_type($xmlrpcType) + public function xmlrpc2PhpType($xmlrpcType) { switch (strtolower($xmlrpcType)) { case 'base64': @@ -128,7 +128,7 @@ class Wrapper * php functions (ie. functions not expecting a single Request obj as parameter) * is by making use of the functions_parameters_type class member. * - * @param string|array $callable the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') and array('class', 'methodname') are ok too + * @param callable $callable the PHP user function to be exposed as xmlrpc method/ a closure, function name, array($obj, 'methodname') or array('class', 'methodname') are ok * @param string $newFuncName (optional) name for function to be created. Used only when return_source in $extraOptions is true * @param array $extraOptions (optional) array of options for conversion. valid values include: * - bool return_source when true, php code w. function definition will be returned, instead of a closure @@ -148,7 +148,7 @@ class Wrapper * @todo add a verbatim_object_copy parameter to allow avoiding usage the same obj instance? * @todo add an option to allow generated function to skip validation of number of parameters, as that is done by the server anyway */ - public function wrap_php_function($callable, $newFuncName = '', $extraOptions = array()) + public function wrapPhpFunction($callable, $newFuncName = '', $extraOptions = array()) { $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; @@ -367,12 +367,12 @@ class Wrapper $sigsDocs = array(); foreach ($parsVariations as $pars) { // build a signature - $sig = array($this->php_2_xmlrpc_type($funcDesc['returns'])); + $sig = array($this->php2XmlrpcType($funcDesc['returns'])); $pSig = array($funcDesc['returnsDocs']); for ($i = 0; $i < count($pars); $i++) { $name = strtolower($funcDesc['params'][$i]['name']); if (isset($funcDesc['paramDocs'][$name]['type'])) { - $sig[] = $this->php_2_xmlrpc_type($funcDesc['paramDocs'][$name]['type']); + $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); } else { $sig[] = Value::$xmlrpcValue; } @@ -589,15 +589,15 @@ class Wrapper * PHP 'wrapper' functions that can be exposed as xmlrpc methods from an xmlrpc server * object and called from remote clients (as well as their corresponding signature info). * - * @param mixed $className the name of the class whose methods are to be exposed as xmlrpc methods, or an object instance of that class - * @param array $extraOptions see the docs for wrap_php_method for basic options, plus + * @param string|object $className the name of the class whose methods are to be exposed as xmlrpc methods, or an object instance of that class + * @param array $extraOptions see the docs for wrapPhpMethod for basic options, plus * - string method_type 'static', 'nonstatic', 'all' and 'auto' (default); the latter will switch between static and non-static depending on whether $className is a class name or object instance * - string method_filter a regexp used to filter methods to wrap based on their names * - string prefix used for the names of the xmlrpc methods created * * @return array|false false on failure */ - public function wrap_php_class($className, $extraOptions = array()) + public function wrapPhpClass($className, $extraOptions = array()) { $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; $methodType = isset($extraOptions['method_type']) ? $extraOptions['method_type'] : 'auto'; @@ -612,7 +612,7 @@ class Wrapper if (($func->isStatic() && ($methodType == 'all' || $methodType == 'static' || ($methodType == 'auto' && is_string($className)))) || (!$func->isStatic() && ($methodType == 'all' || $methodType == 'nonstatic' || ($methodType == 'auto' && is_object($className)))) ) { - $methodWrap = $this->wrap_php_function(array($className, $mName), '', $extraOptions); + $methodWrap = $this->wrapPhpFunction(array($className, $mName), '', $extraOptions); if ($methodWrap) { if (is_object($className)) { $realClassName = get_class($className); @@ -674,7 +674,7 @@ class Wrapper * * @return \closure|array|false false on failure, closure by default and array for return_source = true */ - public function wrap_xmlrpc_method($client, $methodName, $extraOptions = array()) + public function wrapXmlrpcMethod($client, $methodName, $extraOptions = array()) { $newFuncName = isset($extraOptions['new_function_name']) ? $extraOptions['new_function_name'] : ''; @@ -873,6 +873,15 @@ class Wrapper return $function; } + /** + * @param Client $client + * @param string $methodName + * @param array $extraOptions + * @param string $newFuncName + * @param array $mSig + * @param string $mDesc + * @return array + */ protected function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') { $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; @@ -895,7 +904,7 @@ class Wrapper if ($clientCopyMode < 2) { // client copy mode 0 or 1 == full / partial client copy in emitted code $verbatimClientCopy = !$clientCopyMode; - $innerCode = $this->build_client_wrapper_code($client, $verbatimClientCopy, $prefix, $namespace); + $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); $innerCode .= "\$client->setDebug(\$debug);\n"; $this_ = ''; } else { @@ -932,14 +941,14 @@ class Wrapper } } $innerCode .= "\$req->addparam(\$p$i);\n"; - $mDesc .= '* @param ' . $this->xmlrpc_2_php_type($pType) . " \$p$i\n"; + $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; } if ($clientCopyMode < 2) { $plist[] = '$debug=0'; $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; } $plist = implode(', ', $plist); - $mDesc .= '* @return ' . $this->xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; + $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; if ($decodeFault) { @@ -963,16 +972,16 @@ class Wrapper } /** - * Similar to wrap_xmlrpc_method, but will generate a php class that wraps + * Similar to wrapXmlrpcMethod, but will generate a php class that wraps * all xmlrpc methods exposed by the remote server as own methods. - * For more details see wrap_xmlrpc_method. + * For more details see wrapXmlrpcMethod. * * For a slimmer alternative, see the code in demo/client/proxy.php * - * Note that unlike wrap_xmlrpc_method, we always have to generate php code here. It seems that php 7 will have anon classes... + * Note that unlike wrapXmlrpcMethod, we always have to generate php code here. It seems that php 7 will have anon classes... * * @param Client $client the client obj all set to query the desired server - * @param array $extraOptions list of options for wrapped code. See the ones from wrap_xmlrpc_method plus + * @param array $extraOptions list of options for wrapped code. See the ones from wrapXmlrpcMethod plus * - string method_filter regular expression * - string new_class_name * - string prefix @@ -980,7 +989,7 @@ class Wrapper * * @return mixed false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriatevoption is set in extra_options) */ - public function wrap_xmlrpc_server($client, $extraOptions = array()) + public function wrapXmlrpcServer($client, $extraOptions = array()) { $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; @@ -1027,7 +1036,7 @@ class Wrapper /// @todo add function setdebug() to new class, to enable/disable debugging $source = "class $xmlrpcClassName\n{\npublic \$client;\n\n"; $source .= "function __construct()\n{\n"; - $source .= $this->build_client_wrapper_code($client, $verbatimClientCopy, $prefix, $namespace); + $source .= $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); $source .= "\$this->client = \$client;\n}\n\n"; $opts = array( 'return_source' => true, @@ -1044,7 +1053,7 @@ class Wrapper // note: this will fail if server exposes 2 methods called f.e. do.something and do_something $opts['new_function_name'] = preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), array('_', ''), $mName); - $methodWrap = $this->wrap_xmlrpc_method($client, $mName, $opts); + $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts); if ($methodWrap) { if (!$buildIt) { $source .= $methodWrap['docstring']; @@ -1083,7 +1092,7 @@ class Wrapper * * @return string */ - protected function build_client_wrapper_code($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) { $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; -- 2.43.0