@@ -6,7 +6,7 @@ |
||
6 | 6 | <h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3> |
7 | 7 | <?php |
8 | 8 | |
9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
10 | 10 | PhpXmlRpc\Autoloader::register(); |
11 | 11 | |
12 | 12 | class PhpXmlRpcProxy |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | <h3>The code demonstrates usage of the PhpXmlRpc\Encoder class</h3> |
7 | 7 | <?php |
8 | 8 | |
9 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
9 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
10 | 10 | PhpXmlRpc\Autoloader::register(); |
11 | 11 | |
12 | 12 | $req = new PhpXmlRpc\Request('interopEchoTests.whichToolkit', array()); |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
17 | 17 | $value = $encoder->decode($resp->value()); |
18 | 18 | print "<pre>"; |
19 | - print "name: " . htmlspecialchars($value["toolkitName"]) . "\n"; |
|
20 | - print "version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"; |
|
21 | - print "docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"; |
|
22 | - print "os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"; |
|
19 | + print "name: ".htmlspecialchars($value["toolkitName"])."\n"; |
|
20 | + print "version: ".htmlspecialchars($value["toolkitVersion"])."\n"; |
|
21 | + print "docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n"; |
|
22 | + print "os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n"; |
|
23 | 23 | print "</pre>"; |
24 | 24 | } else { |
25 | 25 | print "An error occurred: "; |
26 | - print "Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"; |
|
26 | + print "Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n"; |
|
27 | 27 | } |
28 | 28 | ?> |
29 | 29 | </body> |
@@ -8,34 +8,34 @@ |
||
8 | 8 | <h3>The code demonstrates usage of automatic encoding/decoding of php variables into xmlrpc values</h3> |
9 | 9 | <?php |
10 | 10 | |
11 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
11 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
12 | 12 | PhpXmlRpc\Autoloader::register(); |
13 | 13 | |
14 | 14 | if (isset($_POST["stateno"]) && $_POST["stateno"] != "") { |
15 | - $stateNo = (integer)$_POST["stateno"]; |
|
15 | + $stateNo = (integer) $_POST["stateno"]; |
|
16 | 16 | $encoder = new PhpXmlRpc\Encoder(); |
17 | 17 | $req = new PhpXmlRpc\Request('examples.getStateName', |
18 | 18 | array($encoder->encode($stateNo)) |
19 | 19 | ); |
20 | - print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n"; |
|
20 | + print "Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n"; |
|
21 | 21 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
22 | 22 | $client->setDebug(1); |
23 | 23 | $r = $client->send($req); |
24 | 24 | if (!$r->faultCode()) { |
25 | 25 | $v = $r->value(); |
26 | - print "<br/>State number <b>" . $stateNo . "</b> is <b>" |
|
27 | - . htmlspecialchars($encoder->decode($v)) . "</b><br/>"; |
|
26 | + print "<br/>State number <b>".$stateNo."</b> is <b>" |
|
27 | + . htmlspecialchars($encoder->decode($v))."</b><br/>"; |
|
28 | 28 | } else { |
29 | 29 | print "An error occurred: "; |
30 | - print "Code: " . htmlspecialchars($r->faultCode()) |
|
31 | - . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>"; |
|
30 | + print "Code: ".htmlspecialchars($r->faultCode()) |
|
31 | + . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>"; |
|
32 | 32 | } |
33 | 33 | } else { |
34 | 34 | $stateNo = ""; |
35 | 35 | } |
36 | 36 | |
37 | 37 | print "<form action=\"getstatename.php\" method=\"POST\"> |
38 | -<input name=\"stateno\" value=\"" . $stateNo . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
38 | +<input name=\"stateno\" value=\"" . $stateNo."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form> |
|
39 | 39 | <p>Enter a state number to query its name</p>"; |
40 | 40 | |
41 | 41 | ?> |
@@ -561,8 +561,9 @@ discard block |
||
561 | 561 | } |
562 | 562 | foreach ($parsVariations as $i => $pars) { |
563 | 563 | $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
564 | - if ($i < (count($parsVariations) - 1)) |
|
565 | - $innerCode .= "else\n"; |
|
564 | + if ($i < (count($parsVariations) - 1)) { |
|
565 | + $innerCode .= "else\n"; |
|
566 | + } |
|
566 | 567 | } |
567 | 568 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
568 | 569 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
@@ -615,7 +616,7 @@ discard block |
||
615 | 616 | if ($methodWrap) { |
616 | 617 | if (is_object($className)) { |
617 | 618 | $realClassName = get_class($className); |
618 | - }else { |
|
619 | + } else { |
|
619 | 620 | $realClassName = $className; |
620 | 621 | } |
621 | 622 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @todo validate params? In theory all validation is left to the dispatch map... |
394 | 394 | * @todo add support for $catchWarnings |
395 | 395 | * |
396 | - * @param $callable |
|
396 | + * @param callable $callable |
|
397 | 397 | * @param array $extraOptions |
398 | 398 | * @param string $plainFuncName |
399 | 399 | * @param array $funcDesc |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | |
460 | 460 | /** |
461 | 461 | * Return a name for a new function, based on $callable, insuring its uniqueness |
462 | - * @param mixed $callable a php callable, or the name of an xmlrpc method |
|
462 | + * @param callable $callable a php callable, or the name of an xmlrpc method |
|
463 | 463 | * @param string $newFuncName when not empty, it is used instead of the calculated version |
464 | 464 | * @return string |
465 | 465 | */ |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | /** |
500 | - * @param $callable |
|
500 | + * @param callable $callable |
|
501 | 501 | * @param string $newFuncName |
502 | 502 | * @param array $extraOptions |
503 | 503 | * @param string $plainFuncName |
@@ -157,20 +157,20 @@ discard block |
||
157 | 157 | $callable = explode('::', $callable); |
158 | 158 | } |
159 | 159 | if (is_array($callable)) { |
160 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
161 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
160 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
161 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
162 | 162 | return false; |
163 | 163 | } |
164 | 164 | if (is_string($callable[0])) { |
165 | 165 | $plainFuncName = implode('::', $callable); |
166 | 166 | } elseif (is_object($callable[0])) { |
167 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
167 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
168 | 168 | } |
169 | 169 | $exists = method_exists($callable[0], $callable[1]); |
170 | 170 | } else if ($callable instanceof \Closure) { |
171 | 171 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
172 | 172 | if (!$buildIt) { |
173 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
173 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | |
184 | 184 | if (!$exists) { |
185 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
185 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | |
@@ -226,23 +226,23 @@ discard block |
||
226 | 226 | if (is_array($callable)) { |
227 | 227 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
228 | 228 | if ($func->isPrivate()) { |
229 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
229 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | if ($func->isProtected()) { |
233 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
233 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | if ($func->isConstructor()) { |
237 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
237 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | if ($func->isDestructor()) { |
241 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
241 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
242 | 242 | return false; |
243 | 243 | } |
244 | 244 | if ($func->isAbstract()) { |
245 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
245 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | /// @todo add more checks for static vs. nonstatic? |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | if ($func->isInternal()) { |
253 | 253 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
254 | 254 | // instead of getparameters to fully reflect internal php functions ? |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
256 | 256 | return false; |
257 | 257 | } |
258 | 258 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $i = 0; |
305 | 305 | foreach ($func->getParameters() as $paramObj) { |
306 | 306 | $params[$i] = array(); |
307 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
307 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
308 | 308 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
309 | 309 | $i++; |
310 | 310 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | // build a signature |
370 | 370 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
371 | 371 | $pSig = array($funcDesc['returnsDocs']); |
372 | - for ($i = 0; $i < count($pars); $i++) { |
|
372 | + for ($i = 0; $i<count($pars); $i++) { |
|
373 | 373 | $name = strtolower($funcDesc['params'][$i]['name']); |
374 | 374 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
375 | 375 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | } |
425 | 425 | } |
426 | 426 | $numPars = $req->getNumParams(); |
427 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
427 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
428 | 428 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
429 | 429 | } |
430 | 430 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | $result = call_user_func_array($callable, $params); |
439 | 439 | |
440 | - if (! is_a($result, $responseClass)) { |
|
440 | + if (!is_a($result, $responseClass)) { |
|
441 | 441 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
442 | 442 | $result = new $valueClass($result, $funcDesc['returns']); |
443 | 443 | } else { |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | if ($newFuncName == '') { |
473 | 473 | if (is_array($callable)) { |
474 | 474 | if (is_string($callable[0])) { |
475 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
475 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
476 | 476 | } else { |
477 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
477 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
478 | 478 | } |
479 | 479 | } else { |
480 | 480 | if ($callable instanceof \Closure) { |
@@ -510,8 +510,8 @@ discard block |
||
510 | 510 | { |
511 | 511 | $namespace = '\\PhpXmlRpc\\'; |
512 | 512 | |
513 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
514 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
513 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
514 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
515 | 515 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
516 | 516 | |
517 | 517 | $i = 0; |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | // build body of new function |
547 | 547 | |
548 | 548 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
549 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
549 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
550 | 550 | |
551 | 551 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
552 | 552 | if ($decodePhpObjects) { |
@@ -560,13 +560,13 @@ discard block |
||
560 | 560 | if (is_array($callable) && is_object($callable[0])) { |
561 | 561 | self::$objHolder[$newFuncName] = $callable[0]; |
562 | 562 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
563 | - $realFuncName = '$obj->' . $callable[1]; |
|
563 | + $realFuncName = '$obj->'.$callable[1]; |
|
564 | 564 | } else { |
565 | 565 | $realFuncName = $plainFuncName; |
566 | 566 | } |
567 | 567 | foreach ($parsVariations as $i => $pars) { |
568 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
569 | - if ($i < (count($parsVariations) - 1)) |
|
568 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
569 | + if ($i<(count($parsVariations)-1)) |
|
570 | 570 | $innerCode .= "else\n"; |
571 | 571 | } |
572 | 572 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // if($func->returnsReference()) |
584 | 584 | // return false; |
585 | 585 | |
586 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
586 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
587 | 587 | |
588 | 588 | return $code; |
589 | 589 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | if ($methodWrap) { |
621 | 621 | if (is_object($className)) { |
622 | 622 | $realClassName = get_class($className); |
623 | - }else { |
|
623 | + } else { |
|
624 | 624 | $realClassName = $className; |
625 | 625 | } |
626 | 626 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -721,21 +721,21 @@ discard block |
||
721 | 721 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
722 | 722 | { |
723 | 723 | $namespace = '\\PhpXmlRpc\\'; |
724 | - $reqClass = $namespace . 'Request'; |
|
725 | - $valClass = $namespace . 'Value'; |
|
726 | - $decoderClass = $namespace . 'Encoder'; |
|
724 | + $reqClass = $namespace.'Request'; |
|
725 | + $valClass = $namespace.'Value'; |
|
726 | + $decoderClass = $namespace.'Encoder'; |
|
727 | 727 | |
728 | 728 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
729 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
729 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
730 | 730 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
731 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
731 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
732 | 732 | |
733 | 733 | $req = new $reqClass('system.methodSignature'); |
734 | 734 | $req->addparam(new $valClass($methodName)); |
735 | 735 | $client->setDebug($debug); |
736 | 736 | $response = $client->send($req, $timeout, $protocol); |
737 | 737 | if ($response->faultCode()) { |
738 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
738 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
739 | 739 | return false; |
740 | 740 | } |
741 | 741 | |
@@ -745,8 +745,8 @@ discard block |
||
745 | 745 | $mSig = $decoder->decode($mSig); |
746 | 746 | } |
747 | 747 | |
748 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
749 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
748 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
749 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
750 | 750 | return false; |
751 | 751 | } |
752 | 752 | |
@@ -762,11 +762,11 @@ discard block |
||
762 | 762 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
763 | 763 | { |
764 | 764 | $namespace = '\\PhpXmlRpc\\'; |
765 | - $reqClass = $namespace . 'Request'; |
|
766 | - $valClass = $namespace . 'Value'; |
|
765 | + $reqClass = $namespace.'Request'; |
|
766 | + $valClass = $namespace.'Value'; |
|
767 | 767 | |
768 | 768 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
769 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
769 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
770 | 770 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
771 | 771 | |
772 | 772 | $mDesc = ''; |
@@ -800,10 +800,10 @@ discard block |
||
800 | 800 | $clientClone = clone $client; |
801 | 801 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
802 | 802 | { |
803 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
803 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
804 | 804 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
805 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
806 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
805 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
806 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
807 | 807 | if (isset($extraOptions['return_on_fault'])) { |
808 | 808 | $decodeFault = true; |
809 | 809 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -812,9 +812,9 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | $namespace = '\\PhpXmlRpc\\'; |
815 | - $reqClass = $namespace . 'Request'; |
|
816 | - $encoderClass = $namespace . 'Encoder'; |
|
817 | - $valueClass = $namespace . 'Value'; |
|
815 | + $reqClass = $namespace.'Request'; |
|
816 | + $encoderClass = $namespace.'Encoder'; |
|
817 | + $valueClass = $namespace.'Value'; |
|
818 | 818 | |
819 | 819 | $encoder = new $encoderClass(); |
820 | 820 | $encodeOptions = array(); |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | } |
838 | 838 | |
839 | 839 | $xmlrpcArgs = array(); |
840 | - foreach($currentArgs as $i => $arg) { |
|
840 | + foreach ($currentArgs as $i => $arg) { |
|
841 | 841 | if ($i == $maxArgs) { |
842 | 842 | break; |
843 | 843 | } |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | * @param string $mDesc |
886 | 886 | * @return array |
887 | 887 | */ |
888 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
888 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
889 | 889 | { |
890 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
890 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
891 | 891 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
892 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
893 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
894 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
892 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
893 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
894 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
895 | 895 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
896 | 896 | if (isset($extraOptions['return_on_fault'])) { |
897 | 897 | $decodeFault = true; |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | $namespace = '\\PhpXmlRpc\\'; |
905 | 905 | |
906 | 906 | $code = "function $newFuncName ("; |
907 | - if ($clientCopyMode < 2) { |
|
907 | + if ($clientCopyMode<2) { |
|
908 | 908 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
909 | 909 | $verbatimClientCopy = !$clientCopyMode; |
910 | 910 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | |
920 | 920 | if ($mDesc != '') { |
921 | 921 | // take care that PHP comment is not terminated unwillingly by method description |
922 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
922 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
923 | 923 | } else { |
924 | 924 | $mDesc = "/**\nFunction $newFuncName\n"; |
925 | 925 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
929 | 929 | $plist = array(); |
930 | 930 | $pCount = count($mSig); |
931 | - for ($i = 1; $i < $pCount; $i++) { |
|
931 | + for ($i = 1; $i<$pCount; $i++) { |
|
932 | 932 | $plist[] = "\$p$i"; |
933 | 933 | $pType = $mSig[$i]; |
934 | 934 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -944,19 +944,19 @@ discard block |
||
944 | 944 | } |
945 | 945 | } |
946 | 946 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
947 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
947 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
948 | 948 | } |
949 | - if ($clientCopyMode < 2) { |
|
949 | + if ($clientCopyMode<2) { |
|
950 | 950 | $plist[] = '$debug=0'; |
951 | 951 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
952 | 952 | } |
953 | 953 | $plist = implode(', ', $plist); |
954 | - $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
954 | + $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
955 | 955 | |
956 | 956 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
957 | 957 | if ($decodeFault) { |
958 | 958 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
959 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
959 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
960 | 960 | } else { |
961 | 961 | $respCode = var_export($faultResponse, true); |
962 | 962 | } |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
970 | 970 | } |
971 | 971 | |
972 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
972 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
973 | 973 | |
974 | 974 | return array('source' => $code, 'docstring' => $mDesc); |
975 | 975 | } |
@@ -995,23 +995,23 @@ discard block |
||
995 | 995 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
996 | 996 | { |
997 | 997 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
998 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
998 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
999 | 999 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1000 | 1000 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1001 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1002 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1001 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1002 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1003 | 1003 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1004 | 1004 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1005 | 1005 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1006 | 1006 | $namespace = '\\PhpXmlRpc\\'; |
1007 | 1007 | |
1008 | - $reqClass = $namespace . 'Request'; |
|
1009 | - $decoderClass = $namespace . 'Encoder'; |
|
1008 | + $reqClass = $namespace.'Request'; |
|
1009 | + $decoderClass = $namespace.'Encoder'; |
|
1010 | 1010 | |
1011 | 1011 | $req = new $reqClass('system.listMethods'); |
1012 | 1012 | $response = $client->send($req, $timeout, $protocol); |
1013 | 1013 | if ($response->faultCode()) { |
1014 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1014 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1015 | 1015 | |
1016 | 1016 | return false; |
1017 | 1017 | } else { |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | $mList = $decoder->decode($mList); |
1022 | 1022 | } |
1023 | 1023 | if (!is_array($mList) || !count($mList)) { |
1024 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1024 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1025 | 1025 | |
1026 | 1026 | return false; |
1027 | 1027 | } else { |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | if ($newClassName != '') { |
1030 | 1030 | $xmlrpcClassName = $newClassName; |
1031 | 1031 | } else { |
1032 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1033 | - array('_', ''), $client->server) . '_client'; |
|
1032 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1033 | + array('_', ''), $client->server).'_client'; |
|
1034 | 1034 | } |
1035 | 1035 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1036 | 1036 | $xmlrpcClassName .= 'x'; |
@@ -1061,20 +1061,20 @@ discard block |
||
1061 | 1061 | if (!$buildIt) { |
1062 | 1062 | $source .= $methodWrap['docstring']; |
1063 | 1063 | } |
1064 | - $source .= $methodWrap['source'] . "\n"; |
|
1064 | + $source .= $methodWrap['source']."\n"; |
|
1065 | 1065 | } else { |
1066 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1066 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | $source .= "}\n"; |
1071 | 1071 | if ($buildIt) { |
1072 | 1072 | $allOK = 0; |
1073 | - eval($source . '$allOK=1;'); |
|
1073 | + eval($source.'$allOK=1;'); |
|
1074 | 1074 | if ($allOK) { |
1075 | 1075 | return $xmlrpcClassName; |
1076 | 1076 | } else { |
1077 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1077 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1078 | 1078 | return false; |
1079 | 1079 | } |
1080 | 1080 | } else { |
@@ -1095,10 +1095,10 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return string |
1097 | 1097 | */ |
1098 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1098 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1099 | 1099 | { |
1100 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1101 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1100 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1101 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1102 | 1102 | |
1103 | 1103 | // copy all client fields to the client that will be generated runtime |
1104 | 1104 | // (this provides for future expansion or subclassing of client obj) |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - if (is_file($file = __DIR__ . str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
32 | + if (is_file($file = __DIR__.str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
33 | 33 | require $file; |
34 | 34 | } |
35 | 35 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | // of PHP |
33 | 33 | $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet); |
34 | 34 | } else { |
35 | - $t = strftime("%Y%m%dT%H:%M:%S", $timet - date('Z')); |
|
35 | + $t = strftime("%Y%m%dT%H:%M:%S", $timet-date('Z')); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 |
@@ -26,10 +26,10 @@ |
||
26 | 26 | { |
27 | 27 | // construct a latin string with all chars (except control ones) |
28 | 28 | $this->latinString = "\n\r\t"; |
29 | - for($i = 32; $i < 127; $i++) { |
|
29 | + for ($i = 32; $i<127; $i++) { |
|
30 | 30 | $this->latinString .= chr($i); |
31 | 31 | } |
32 | - for($i = 160; $i < 256; $i++) { |
|
32 | + for ($i = 160; $i<256; $i++) { |
|
33 | 33 | $this->latinString .= chr($i); |
34 | 34 | } |
35 | 35 | } |
@@ -141,9 +141,9 @@ |
||
141 | 141 | * @deprecated |
142 | 142 | */ |
143 | 143 | function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, |
144 | - $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
145 | - $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
146 | - $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
144 | + $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
145 | + $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
146 | + $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
147 | 147 | { |
148 | 148 | $code = "function $xmlrpcFuncName ("; |
149 | 149 | if ($clientCopyMode < 2) { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @see PhpXmlRpc\Wrapper::wrapXmlrpcMethod |
88 | 88 | * @param xmlrpc_client $client |
89 | 89 | * @param string $methodName |
90 | - * @param int|array $extraOptions the usage of an int as signature number is deprecated, use an option in $extraOptions |
|
90 | + * @param integer $extraOptions the usage of an int as signature number is deprecated, use an option in $extraOptions |
|
91 | 91 | * @param int $timeout deprecated, use an option in $extraOptions |
92 | 92 | * @param string $protocol deprecated, use an option in $extraOptions |
93 | 93 | * @param string $newFuncName deprecated, use an option in $extraOptions |
@@ -217,6 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | /** |
219 | 219 | * @deprecated |
220 | + * @param integer $verbatim_client_copy |
|
220 | 221 | */ |
221 | 222 | function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
222 | 223 | { |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | * @param array $extraOptions |
42 | 42 | * @return array|false |
43 | 43 | */ |
44 | -function wrap_php_function($funcName, $newFuncName='', $extraOptions=array()) |
|
44 | +function wrap_php_function($funcName, $newFuncName = '', $extraOptions = array()) |
|
45 | 45 | { |
46 | 46 | $wrapper = new PhpXmlRpc\Wrapper(); |
47 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
47 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
48 | 48 | // backwards compat: return string instead of callable |
49 | 49 | $extraOptions['return_source'] = true; |
50 | 50 | $wrapped = $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions); |
@@ -64,17 +64,17 @@ discard block |
||
64 | 64 | * @param array $extraOptions |
65 | 65 | * @return array|false |
66 | 66 | */ |
67 | -function wrap_php_class($className, $extraOptions=array()) |
|
67 | +function wrap_php_class($className, $extraOptions = array()) |
|
68 | 68 | { |
69 | 69 | $wrapper = new PhpXmlRpc\Wrapper(); |
70 | 70 | $fix = false; |
71 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
71 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
72 | 72 | // backwards compat: return string instead of callable |
73 | 73 | $extraOptions['return_source'] = true; |
74 | 74 | $fix = true; |
75 | 75 | } |
76 | 76 | $wrapped = $wrapper->wrapPhpClass($className, $extraOptions); |
77 | - foreach($wrapped as $name => $value) { |
|
77 | + foreach ($wrapped as $name => $value) { |
|
78 | 78 | if ($fix) { |
79 | 79 | eval($value['source']); |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param string $newFuncName deprecated, use an option in $extraOptions |
94 | 94 | * @return array|callable|false |
95 | 95 | */ |
96 | -function wrap_xmlrpc_method($client, $methodName, $extraOptions=0, $timeout=0, $protocol='', $newFuncName='') |
|
96 | +function wrap_xmlrpc_method($client, $methodName, $extraOptions = 0, $timeout = 0, $protocol = '', $newFuncName = '') |
|
97 | 97 | { |
98 | 98 | if (!is_array($extraOptions)) |
99 | 99 | { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $wrapper = new PhpXmlRpc\Wrapper(); |
110 | 110 | |
111 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
111 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
112 | 112 | // backwards compat: return string instead of callable |
113 | 113 | $extraOptions['return_source'] = true; |
114 | 114 | $wrapped = $wrapper->wrapXmlrpcMethod($client, $methodName, $extraOptions); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param array $extraOptions |
127 | 127 | * @return mixed |
128 | 128 | */ |
129 | -function wrap_xmlrpc_server($client, $extraOptions=array()) |
|
129 | +function wrap_xmlrpc_server($client, $extraOptions = array()) |
|
130 | 130 | { |
131 | 131 | $wrapper = new PhpXmlRpc\Wrapper(); |
132 | 132 | return $wrapper->wrapXmlrpcServer($client, $extraOptions); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
147 | 147 | { |
148 | 148 | $code = "function $xmlrpcFuncName ("; |
149 | - if ($clientCopyMode < 2) { |
|
149 | + if ($clientCopyMode<2) { |
|
150 | 150 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
151 | 151 | $innerCode = build_client_wrapper_code($client, $clientCopyMode, $prefix, $namespace); |
152 | 152 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | if ($mDesc != '') { |
162 | 162 | // take care that PHP comment is not terminated unwillingly by method description |
163 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
163 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
164 | 164 | } else { |
165 | 165 | $mDesc = "/**\nFunction $xmlrpcFuncName\n"; |
166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
170 | 170 | $plist = array(); |
171 | 171 | $pCount = count($mSig); |
172 | - for ($i = 1; $i < $pCount; $i++) { |
|
172 | + for ($i = 1; $i<$pCount; $i++) { |
|
173 | 173 | $plist[] = "\$p$i"; |
174 | 174 | $pType = $mSig[$i]; |
175 | 175 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
188 | - $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; |
|
188 | + $mDesc .= '* @param '.xmlrpc_2_php_type($pType)." \$p$i\n"; |
|
189 | 189 | } |
190 | - if ($clientCopyMode < 2) { |
|
190 | + if ($clientCopyMode<2) { |
|
191 | 191 | $plist[] = '$debug=0'; |
192 | 192 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
193 | 193 | } |
194 | 194 | $plist = implode(', ', $plist); |
195 | - $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
195 | + $mDesc .= '* @return '.xmlrpc_2_php_type($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
196 | 196 | |
197 | 197 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
198 | 198 | if ($decodeFault) { |
199 | 199 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
200 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
200 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
201 | 201 | } else { |
202 | 202 | $respCode = var_export($faultResponse, true); |
203 | 203 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
211 | 211 | } |
212 | 212 | |
213 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
213 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
214 | 214 | |
215 | 215 | return array('source' => $code, 'docstring' => $mDesc); |
216 | 216 | } |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @deprecated |
220 | 220 | */ |
221 | -function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
221 | +function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
222 | 222 | { |
223 | 223 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
224 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
224 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
225 | 225 | |
226 | 226 | // copy all client fields to the client that will be generated runtime |
227 | 227 | // (this provides for future expansion or subclassing of client obj) |
228 | 228 | if ($verbatim_client_copy) |
229 | 229 | { |
230 | - foreach($client as $fld => $val) |
|
230 | + foreach ($client as $fld => $val) |
|
231 | 231 | { |
232 | - if($fld != 'debug' && $fld != 'return_type') |
|
232 | + if ($fld != 'debug' && $fld != 'return_type') |
|
233 | 233 | { |
234 | 234 | $val = var_export($val, true); |
235 | 235 | $code .= "\$client->$fld = $val;\n"; |
@@ -168,6 +168,9 @@ discard block |
||
168 | 168 | return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding); |
169 | 169 | } |
170 | 170 | |
171 | +/** |
|
172 | + * @param integer $timeT |
|
173 | + */ |
|
171 | 174 | function iso8601_encode($timeT, $utc=0) |
172 | 175 | { |
173 | 176 | return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc); |
@@ -195,6 +198,9 @@ discard block |
||
195 | 198 | return $encoder->encode($phpVal, $options); |
196 | 199 | } |
197 | 200 | |
201 | +/** |
|
202 | + * @param string $xmlVal |
|
203 | + */ |
|
198 | 204 | function php_xmlrpc_decode_xml($xmlVal, $options=array()) |
199 | 205 | { |
200 | 206 | $encoder = new PhpXmlRpc\Encoder(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $val = reset($ar); |
96 | 96 | $typ = key($ar); |
97 | 97 | |
98 | - return '<value>' . $this->serializedata($typ, $val) . "</value>\n"; |
|
98 | + return '<value>'.$this->serializedata($typ, $val)."</value>\n"; |
|
99 | 99 | //} |
100 | 100 | } |
101 | 101 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // preserve back compatibility |
115 | 115 | |
116 | 116 | if (is_array($b)) { |
117 | - foreach($b as $id => $cont) { |
|
117 | + foreach ($b as $id => $cont) { |
|
118 | 118 | $b[$id] = $cont->scalarval(); |
119 | 119 | } |
120 | 120 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | // add support for structures directly encoding php objects |
123 | 123 | if (is_object($b)) { |
124 | 124 | $t = get_object_vars($b); |
125 | - foreach($t as $id => $cont) { |
|
125 | + foreach ($t as $id => $cont) { |
|
126 | 126 | $t[$id] = $cont->scalarval(); |
127 | 127 | } |
128 | - foreach($t as $id => $cont) { |
|
128 | + foreach ($t as $id => $cont) { |
|
129 | 129 | @$b->$id = $cont; |
130 | 130 | } |
131 | 131 | } |
@@ -160,17 +160,17 @@ discard block |
||
160 | 160 | /* Expose as global functions the ones which are now class methods */ |
161 | 161 | |
162 | 162 | /// Wrong speling, but we are adamant on backwards compatibility! |
163 | -function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='') |
|
163 | +function xmlrpc_encode_entitites($data, $srcEncoding = '', $destEncoding = '') |
|
164 | 164 | { |
165 | 165 | return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding); |
166 | 166 | } |
167 | 167 | |
168 | -function iso8601_encode($timeT, $utc=0) |
|
168 | +function iso8601_encode($timeT, $utc = 0) |
|
169 | 169 | { |
170 | 170 | return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc); |
171 | 171 | } |
172 | 172 | |
173 | -function iso8601_decode($iDate, $utc=0) |
|
173 | +function iso8601_decode($iDate, $utc = 0) |
|
174 | 174 | { |
175 | 175 | return PhpXmlRpc\Helper\Date::iso8601Decode($iDate, $utc); |
176 | 176 | } |
@@ -180,25 +180,25 @@ discard block |
||
180 | 180 | return PhpXmlRpc\Helper\Http::decodeChunked($buffer); |
181 | 181 | } |
182 | 182 | |
183 | -function php_xmlrpc_decode($xmlrpcVal, $options=array()) |
|
183 | +function php_xmlrpc_decode($xmlrpcVal, $options = array()) |
|
184 | 184 | { |
185 | 185 | $encoder = new PhpXmlRpc\Encoder(); |
186 | 186 | return $encoder->decode($xmlrpcVal, $options); |
187 | 187 | } |
188 | 188 | |
189 | -function php_xmlrpc_encode($phpVal, $options=array()) |
|
189 | +function php_xmlrpc_encode($phpVal, $options = array()) |
|
190 | 190 | { |
191 | 191 | $encoder = new PhpXmlRpc\Encoder(); |
192 | 192 | return $encoder->encode($phpVal, $options); |
193 | 193 | } |
194 | 194 | |
195 | -function php_xmlrpc_decode_xml($xmlVal, $options=array()) |
|
195 | +function php_xmlrpc_decode_xml($xmlVal, $options = array()) |
|
196 | 196 | { |
197 | 197 | $encoder = new PhpXmlRpc\Encoder(); |
198 | 198 | return $encoder->decodeXml($xmlVal, $options); |
199 | 199 | } |
200 | 200 | |
201 | -function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null) |
|
201 | +function guess_encoding($httpHeader = '', $xmlChunk = '', $encodingPrefs = null) |
|
202 | 202 | { |
203 | 203 | return PhpXmlRpc\Helper\XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs); |
204 | 204 | } |