@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LocalFileTestCase.php'; |
|
3 | +include_once __DIR__.'/LocalFileTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests for php files in the 'demo' directory |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | { |
12 | 12 | $this->args = argParser::getArgs(); |
13 | 13 | |
14 | - $this->baseUrl = $this->args['LOCALSERVER'] . str_replace( '/demo/server/server.php', '/demo/', $this->args['URI'] ); |
|
14 | + $this->baseUrl = $this->args['LOCALSERVER'].str_replace('/demo/server/server.php', '/demo/', $this->args['URI']); |
|
15 | 15 | |
16 | - $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); |
|
16 | + $this->coverageScriptUrl = 'http://'.$this->args['LOCALSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testAgeSort() |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . "/../../vendor/autoload.php"; |
|
3 | +include_once __DIR__."/../../vendor/autoload.php"; |
|
4 | 4 | |
5 | 5 | use PhpXmlRpc\Value; |
6 | 6 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | $count = 0; |
32 | 32 | } |
33 | 33 | // add the new comment in |
34 | - dba_insert($msgID . "_comment_${count}", $comment, $dbh); |
|
35 | - dba_insert($msgID . "_name_${count}", $name, $dbh); |
|
34 | + dba_insert($msgID."_comment_${count}", $comment, $dbh); |
|
35 | + dba_insert($msgID."_name_${count}", $name, $dbh); |
|
36 | 36 | $count++; |
37 | 37 | dba_replace($countID, $count, $dbh); |
38 | 38 | dba_close($dbh); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $countID = "${msgID}_count"; |
66 | 66 | if (dba_exists($countID, $dbh)) { |
67 | 67 | $count = dba_fetch($countID, $dbh); |
68 | - for ($i = 0; $i < $count; $i++) { |
|
68 | + for ($i = 0; $i<$count; $i++) { |
|
69 | 69 | $name = dba_fetch("${msgID}_name_${i}", $dbh); |
70 | 70 | $comment = dba_fetch("${msgID}_comment_${i}", $dbh); |
71 | 71 | // push a new struct onto the return array |
@@ -209,11 +209,12 @@ |
||
209 | 209 | $a = $req->getParam(0); |
210 | 210 | $b = $req->getParam(1); |
211 | 211 | |
212 | - if ($a->scalartyp() == Value::$xmlrpcNull) |
|
213 | - return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval()))); |
|
214 | - else |
|
215 | - return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval()))); |
|
216 | -} |
|
212 | + if ($a->scalartyp() == Value::$xmlrpcNull) { |
|
213 | + return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval()))); |
|
214 | + } else { |
|
215 | + return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval()))); |
|
216 | + } |
|
217 | + } |
|
217 | 218 | |
218 | 219 | $addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt)); |
219 | 220 | $addtwo_doc = 'Add two integers together and return the result'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | die(); |
16 | 16 | } |
17 | 17 | |
18 | -include_once __DIR__ . "/../../vendor/autoload.php"; |
|
18 | +include_once __DIR__."/../../vendor/autoload.php"; |
|
19 | 19 | |
20 | 20 | // out-of-band information: let the client manipulate the server operations. |
21 | 21 | // we do this to help the testsuite script: do not reproduce in production! |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']); |
26 | 26 | } |
27 | 27 | |
28 | - include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
28 | + include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | use PhpXmlRpc\Value; |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | // extract the value of the state number |
123 | 123 | $snv = $sno->scalarval(); |
124 | 124 | // look it up in our array (zero-based) |
125 | - if (isset($stateNames[$snv - 1])) { |
|
126 | - $stateName = $stateNames[$snv - 1]; |
|
125 | + if (isset($stateNames[$snv-1])) { |
|
126 | + $stateName = $stateNames[$snv-1]; |
|
127 | 127 | } else { |
128 | 128 | // not there, so complain |
129 | - $err = "I don't have a state for the index '" . $snv . "'"; |
|
129 | + $err = "I don't have a state for the index '".$snv."'"; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // if we generated an error, create an error return response |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | { |
153 | 153 | global $stateNames; |
154 | 154 | |
155 | - if (isset($stateNames[$stateNo - 1])) { |
|
156 | - return $stateNames[$stateNo - 1]; |
|
155 | + if (isset($stateNames[$stateNo-1])) { |
|
156 | + return $stateNames[$stateNo-1]; |
|
157 | 157 | } else { |
158 | 158 | // not, there so complain |
159 | - throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
159 | + throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | eval($findstate9_sig['source']); |
187 | 187 | |
188 | 188 | $findstate10_sig = array( |
189 | - "function" => function ($req) { return findState($req); }, |
|
189 | + "function" => function($req) { return findState($req); }, |
|
190 | 190 | "signature" => $findstate_sig, |
191 | 191 | "docstring" => $findstate_doc, |
192 | 192 | ); |
193 | 193 | |
194 | -$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return inner_findstate($stateNo); }); |
|
194 | +$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return inner_findstate($stateNo); }); |
|
195 | 195 | |
196 | 196 | $c = new xmlrpcServerMethodsContainer; |
197 | 197 | $moreSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'tests.', 'method_type' => 'all')); |
198 | 198 | |
199 | -$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
199 | +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
200 | 200 | |
201 | 201 | // used to test signatures with NULL params |
202 | 202 | $findstate12_sig = array( |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $s = $req->getParam(0); |
223 | 223 | $t = $req->getParam(1); |
224 | 224 | |
225 | - return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt)); |
|
225 | + return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | $addtwodouble_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble, Value::$xmlrpcDouble)); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $s = $req->getParam(0); |
233 | 233 | $t = $req->getParam(1); |
234 | 234 | |
235 | - return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble)); |
|
235 | + return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble)); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $stringecho_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString)); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | function echoBack($req) |
249 | 249 | { |
250 | 250 | // just sends back a string with what i got sent to me, just escaped, that's all |
251 | - $s = "I got the following message:\n" . $req->serialize(); |
|
251 | + $s = "I got the following message:\n".$req->serialize(); |
|
252 | 252 | |
253 | 253 | return new PhpXmlRpc\Response(new Value($s)); |
254 | 254 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | return 0; |
306 | 306 | } |
307 | 307 | |
308 | - return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1; |
|
308 | + return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $agesorter_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | // hack, must make global as uksort() won't |
352 | 352 | // allow us to pass any other auxiliary information |
353 | 353 | uksort($agesorter_arr, 'agesorter_compare'); |
354 | - foreach($agesorter_arr as $key => $val) { |
|
354 | + foreach ($agesorter_arr as $key => $val) { |
|
355 | 355 | // recreate each struct element |
356 | 356 | $v[] = new Value( |
357 | 357 | array( |
@@ -406,17 +406,17 @@ discard block |
||
406 | 406 | $err = "Error, no 'From' field specified"; |
407 | 407 | } |
408 | 408 | |
409 | - $msgHdr = "From: " . $mFrom->scalarval() . "\n"; |
|
410 | - $msgHdr .= "To: " . $mTo->scalarval() . "\n"; |
|
409 | + $msgHdr = "From: ".$mFrom->scalarval()."\n"; |
|
410 | + $msgHdr .= "To: ".$mTo->scalarval()."\n"; |
|
411 | 411 | |
412 | 412 | if ($mCc->scalarval() != "") { |
413 | - $msgHdr .= "Cc: " . $mCc->scalarval() . "\n"; |
|
413 | + $msgHdr .= "Cc: ".$mCc->scalarval()."\n"; |
|
414 | 414 | } |
415 | 415 | if ($mBcc->scalarval() != "") { |
416 | - $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n"; |
|
416 | + $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n"; |
|
417 | 417 | } |
418 | 418 | if ($mMime->scalarval() != "") { |
419 | - $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n"; |
|
419 | + $msgHdr .= "Content-type: ".$mMime->scalarval()."\n"; |
|
420 | 420 | } |
421 | 421 | $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0"; |
422 | 422 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | $moe = $sno["moe"]; |
507 | 507 | $larry = $sno["larry"]; |
508 | 508 | $curly = $sno["curly"]; |
509 | - $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval(); |
|
509 | + $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval(); |
|
510 | 510 | |
511 | 511 | return new PhpXmlRpc\Response(new Value($num, Value::$xmlrpcInt)); |
512 | 512 | } |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | $ar = $req->getParam(0); |
549 | 549 | $sz = $ar->count(); |
550 | 550 | $first = $ar[0]; |
551 | - $last = $ar[$sz - 1]; |
|
551 | + $last = $ar[$sz-1]; |
|
552 | 552 | |
553 | - return new PhpXmlRpc\Response(new Value($first->scalarval() . |
|
553 | + return new PhpXmlRpc\Response(new Value($first->scalarval(). |
|
554 | 554 | $last->scalarval(), Value::$xmlrpcString)); |
555 | 555 | } |
556 | 556 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $larry = $fools["larry"]; |
585 | 585 | $moe = $fools["moe"]; |
586 | 586 | |
587 | - return new PhpXmlRpc\Response(new Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), Value::$xmlrpcInt)); |
|
587 | + return new PhpXmlRpc\Response(new Value($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), Value::$xmlrpcInt)); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | $v1_countTheEntities_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcString)); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $ap = 0; |
599 | 599 | $qu = 0; |
600 | 600 | $amp = 0; |
601 | - for ($i = 0; $i < strlen($str); $i++) { |
|
601 | + for ($i = 0; $i<strlen($str); $i++) { |
|
602 | 602 | $c = substr($str, $i, 1); |
603 | 603 | switch ($c) { |
604 | 604 | case ">": |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | // Greek word 'kosme'. NB: NOT a valid ISO8859 string! |
802 | 802 | // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods |
803 | - "tests.utf8methodname." . 'κόσμε' => array( |
|
803 | + "tests.utf8methodname.".'κόσμε' => array( |
|
804 | 804 | "function" => "stringEcho", |
805 | 805 | "signature" => $stringecho_sig, |
806 | 806 | "docstring" => $stringecho_doc, |
@@ -996,5 +996,5 @@ discard block |
||
996 | 996 | // Out-of-band information: let the client manipulate the server operations. |
997 | 997 | // We do this to help the testsuite script: do not reproduce in production! |
998 | 998 | if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) { |
999 | - include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
999 | + include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
1000 | 1000 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @license code licensed under the BSD License: see file license.txt |
10 | 10 | */ |
11 | 11 | |
12 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
12 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
13 | 13 | PhpXmlRpc\Autoloader::register(); |
14 | 14 | |
15 | 15 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $url = $encoder->decode($req->getParam(0)); |
31 | 31 | $client = new PhpXmlRpc\Client($url); |
32 | 32 | |
33 | - if ($req->getNumParams() > 3) { |
|
33 | + if ($req->getNumParams()>3) { |
|
34 | 34 | // we have to set some options onto the client. |
35 | 35 | // Note that if we do not untaint the received values, warnings might be generated... |
36 | 36 | $options = $encoder->decode($req->getParam(3)); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $client->setSSLVerifyPeer($val); |
51 | 51 | break; |
52 | 52 | case 'Timeout': |
53 | - $timeout = (integer)$val; |
|
53 | + $timeout = (integer) $val; |
|
54 | 54 | break; |
55 | 55 | } // switch |
56 | 56 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | // add debug info into response we give back to caller |
71 | - PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
71 | + PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
72 | 72 | |
73 | 73 | return $client->send($req, $timeout); |
74 | 74 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | </h3> |
13 | 13 | <?php |
14 | 14 | |
15 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
15 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
16 | 16 | PhpXmlRpc\Autoloader::register(); |
17 | 17 | |
18 | 18 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
19 | 19 | $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals |
20 | 20 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
21 | 21 | if ($resp->faultCode()) { |
22 | - echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"; |
|
22 | + echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"; |
|
23 | 23 | } else { |
24 | 24 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
25 | 25 | flush(); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | if ($methodName == 'examples.getStateName') { |
32 | 32 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
33 | 33 | if ($callable) { |
34 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"; |
|
34 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"; |
|
35 | 35 | } else { |
36 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"; |
|
36 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"; |
|
37 | 37 | } |
38 | 38 | break; |
39 | 39 | } |
@@ -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; |
@@ -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) |