Passed
Push — master ( 1e905b...cb7629 )
by Gaetano
16:14 queued 06:16
created
demo/client/introspect.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Introspect demo</title></head>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 function display_error($r)
19 19
 {
20 20
     output("An error occurred: ");
21
-    output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>");
21
+    output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>");
22 22
 }
23 23
 
24 24
 $client = new Client(XMLRPCSERVER);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 $client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP);
27 27
 
28 28
 // First off, let's retrieve the list of methods available on the remote server
29
-output("<h3>methods available at http://" . $client->getUrl(PHP_URL_HOST) . $client->getUrl(PHP_URL_PATH) . "</h3>\n");
29
+output("<h3>methods available at http://".$client->getUrl(PHP_URL_HOST).$client->getUrl(PHP_URL_PATH)."</h3>\n");
30 30
 $req = new Request('system.listMethods');
31 31
 $resp = $client->send($req);
32 32
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     // Then, retrieve the signature and help text of each available method
50 50
     foreach ($v as $methodName) {
51
-        output("<h4>" . htmlspecialchars($methodName) . "</h4>\n");
51
+        output("<h4>".htmlspecialchars($methodName)."</h4>\n");
52 52
         // build requests first, add params later
53 53
         $r1 = new Request('system.methodHelp');
54 54
         $r2 = new Request('system.methodSignature');
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
                         continue;
85 85
                     }
86 86
                     $ret = $sig[0];
87
-                    output("<code>" . htmlspecialchars($ret) . " "
88
-                        . htmlspecialchars($methodName) . "(");
89
-                    if (count($sig) > 1) {
90
-                        for ($k = 1; $k < count($sig); $k++) {
87
+                    output("<code>".htmlspecialchars($ret)." "
88
+                        . htmlspecialchars($methodName)."(");
89
+                    if (count($sig)>1) {
90
+                        for ($k = 1; $k<count($sig); $k++) {
91 91
                             output(htmlspecialchars($sig[$k]));
92
-                            if ($k < count($sig) - 1) {
92
+                            if ($k<count($sig)-1) {
93 93
                                 output(", ");
94 94
                             }
95 95
                         }
Please login to merge, or discard this patch.
demo/client/which.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 output('<html lang="en">
5 5
 <head><title>phpxmlrpc - Which toolkit demo</title></head>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     <methodName>interopEchoTests.whichToolkit</methodName>
20 20
     <params/>
21 21
 </methodCall>';
22
-output("XML custom request:<br/><pre>" . htmlspecialchars($payload) . "</pre>\n");
22
+output("XML custom request:<br/><pre>".htmlspecialchars($payload)."</pre>\n");
23 23
 
24 24
 $client = new Client(XMLRPCSERVER);
25 25
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 if (!$resp->faultCode()) {
41 41
 
42 42
     $xml = $resp->value();
43
-    output("XML response:<br/><pre>" . htmlspecialchars($xml) . "</pre>\n");
43
+    output("XML response:<br/><pre>".htmlspecialchars($xml)."</pre>\n");
44 44
 
45 45
     $encoder = new Encoder();
46 46
     // from xml to xml-rpc Response
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 
54 54
         output("Toolkit info:<br/>\n");
55 55
         output("<pre>");
56
-        output("name: " . htmlspecialchars($value["toolkitName"]) . "\n");
57
-        output("version: " . htmlspecialchars($value["toolkitVersion"]) . "\n");
58
-        output("docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n");
59
-        output("os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n");
56
+        output("name: ".htmlspecialchars($value["toolkitName"])."\n");
57
+        output("version: ".htmlspecialchars($value["toolkitVersion"])."\n");
58
+        output("docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n");
59
+        output("os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n");
60 60
         output("</pre>");
61 61
     } else {
62 62
         output("An xml-rpc error occurred");
63 63
     }
64 64
 } else {
65 65
     output("An http error occurred: ");
66
-    output("Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n");
66
+    output("Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n");
67 67
 }
68 68
 
69 69
 output("</body></html>\n");
Please login to merge, or discard this patch.
demo/client/parallel.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 use PhpXmlRpc\Encoder;
5 5
 use PhpXmlRpc\Client;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $handles = array();
36 36
         $curl = curl_multi_init();
37 37
 
38
-        foreach($requests as $k => $req) {
38
+        foreach ($requests as $k => $req) {
39 39
             $req->setDebug($this->debug);
40 40
             $handle = $this->createCurlHandle($req, $method, $this->server, $this->port, $this->path, $opts);
41 41
             if (($error = curl_multi_add_handle($curl, $handle)) !== 0) {
@@ -60,27 +60,27 @@  discard block
 block discarded – undo
60 60
                     }
61 61
                 }
62 62
             }
63
-            if ($running > 0) {
63
+            if ($running>0) {
64 64
                 if (curl_multi_select($curl) === -1) {
65 65
                     throw new \Exception("Curl multi error");
66 66
                 }
67 67
             }
68
-        } while ($running > 0);
68
+        } while ($running>0);
69 69
 
70 70
         curl_multi_close($curl);
71 71
 
72 72
         $responses = array();
73 73
         $errors = array();
74
-        foreach($handles as $k => $h) {
74
+        foreach ($handles as $k => $h) {
75 75
             $responses[$k] = curl_multi_getcontent($h);
76 76
 
77
-            if ($this->debug > 1) {
77
+            if ($this->debug>1) {
78 78
                 $message = "---CURL INFO---\n";
79 79
                 foreach (curl_getinfo($h) as $name => $val) {
80 80
                     if (is_array($val)) {
81 81
                         $val = implode("\n", $val);
82 82
                     }
83
-                    $message .= $name . ': ' . $val . "\n";
83
+                    $message .= $name.': '.$val."\n";
84 84
                 }
85 85
                 $message .= '---END---';
86 86
                 $this->getLogger()->debugMessage($message);
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
             }
92 92
         }
93 93
 
94
-        foreach($responses as $k => $resp) {
94
+        foreach ($responses as $k => $resp) {
95 95
             if (!$resp) {
96
-                $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . $errors[$k]);
96
+                $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.$errors[$k]);
97 97
             } else {
98 98
                 $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type);
99 99
             }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 $encoder = new Encoder();
112 112
 $reqs = array();
113
-for ($i = 0; $i < $num_tests; $i++) {
113
+for ($i = 0; $i<$num_tests; $i++) {
114 114
     $data = array($i, 1.0, 'hello world', true, '20051021T23:43:00', -1, 11.0, '~!@#$%^&*()_+|', false, '20051021T23:43:00');
115 115
     $value = $encoder->encode($data, array('auto_dates'));
116 116
     $req = new Request('interopEchoTests.echoValue', array($value));
@@ -122,40 +122,40 @@  discard block
 block discarded – undo
122 122
 // avoid storing http info in the responses, to make the checksums comparable
123 123
 $client->setDebug(-1);
124 124
 
125
-echo "Making $num_tests calls to method interopEchoTests.echoValue on server " . XMLRPCSERVER . " ...\n";
125
+echo "Making $num_tests calls to method interopEchoTests.echoValue on server ".XMLRPCSERVER." ...\n";
126 126
 flush();
127 127
 
128
-$client->setOption(Client::OPT_NO_MULTICALL,  true);
128
+$client->setOption(Client::OPT_NO_MULTICALL, true);
129 129
 $t = microtime(true);
130 130
 $resp = $client->send($reqs);
131
-$t = microtime(true) - $t;
132
-echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n";
133
-echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
131
+$t = microtime(true)-$t;
132
+echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n";
133
+echo "Response checksum: ".md5(var_export($resp, true))."\n";
134 134
 flush();
135 135
 
136 136
 if (strpos(XMLRPCSERVER, 'http://') === 0) {
137
-    $client->setOption(Client::OPT_USE_CURL,  Client::USE_CURL_ALWAYS);
137
+    $client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_ALWAYS);
138 138
     $t = microtime(true);
139 139
     $resp = $client->send($reqs);
140
-    $t = microtime(true) - $t;
141
-    echo "Sequential send, curl (w. keepalive): " . sprintf('%.3f', $t) . " secs.\n";
142
-    echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
140
+    $t = microtime(true)-$t;
141
+    echo "Sequential send, curl (w. keepalive): ".sprintf('%.3f', $t)." secs.\n";
142
+    echo "Response checksum: ".md5(var_export($resp, true))."\n";
143 143
     flush();
144 144
 }
145 145
 
146 146
 $t = microtime(true);
147 147
 $resp = $client->sendParallel($reqs);
148
-$t = microtime(true) - $t;
149
-echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n";
150
-echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
148
+$t = microtime(true)-$t;
149
+echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n";
150
+echo "Response checksum: ".md5(var_export($resp, true))."\n";
151 151
 flush();
152 152
 
153 153
 $client->setOption(Client::OPT_NO_MULTICALL, false);
154 154
 // make sure we don't reuse the keepalive handle
155
-$client->setOption(Client::OPT_USE_CURL,  Client::USE_CURL_NEVER);
155
+$client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_NEVER);
156 156
 $t = microtime(true);
157 157
 $resp = $client->send($reqs);
158
-$t = microtime(true) - $t;
159
-echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n";
160
-echo "Response checksum: " . md5(var_export($resp, true)) . "\n";
158
+$t = microtime(true)-$t;
159
+echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n";
160
+echo "Response checksum: ".md5(var_export($resp, true))."\n";
161 161
 flush();
Please login to merge, or discard this patch.
tests/10DemofilesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 use PhpXmlRpc\Request;
6 6
 use PhpXmlRpc\Value;
Please login to merge, or discard this patch.
src/Wrapper.php 2 patches
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -179,20 +179,20 @@  discard block
 block discarded – undo
179 179
             $callable = explode('::', $callable);
180 180
         }
181 181
         if (is_array($callable)) {
182
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
183
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
182
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
183
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
184 184
                 return false;
185 185
             }
186 186
             if (is_string($callable[0])) {
187 187
                 $plainFuncName = implode('::', $callable);
188 188
             } elseif (is_object($callable[0])) {
189
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
189
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
190 190
             }
191 191
             $exists = method_exists($callable[0], $callable[1]);
192 192
         } else if ($callable instanceof \Closure) {
193 193
             // we do not support creating code which wraps closures, as php does not allow to serialize them
194 194
             if (!$buildIt) {
195
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
195
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
196 196
                 return false;
197 197
             }
198 198
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         }
205 205
 
206 206
         if (!$exists) {
207
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
207
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
208 208
             return false;
209 209
         }
210 210
 
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
         if (is_array($callable)) {
249 249
             $func = new \ReflectionMethod($callable[0], $callable[1]);
250 250
             if ($func->isPrivate()) {
251
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
251
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
252 252
                 return false;
253 253
             }
254 254
             if ($func->isProtected()) {
255
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
255
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
256 256
                 return false;
257 257
             }
258 258
             if ($func->isConstructor()) {
259
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
259
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
260 260
                 return false;
261 261
             }
262 262
             if ($func->isDestructor()) {
263
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
263
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
264 264
                 return false;
265 265
             }
266 266
             if ($func->isAbstract()) {
267
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
267
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
268 268
                 return false;
269 269
             }
270 270
             /// @todo add more checks for static vs. nonstatic?
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         if ($func->isInternal()) {
275 275
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
276 276
             ///       reflect internal php functions
277
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
277
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
278 278
             return false;
279 279
         }
280 280
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         $i = 0;
335 335
         foreach ($func->getParameters() as $paramObj) {
336 336
             $params[$i] = array();
337
-            $params[$i]['name'] = '$' . $paramObj->getName();
337
+            $params[$i]['name'] = '$'.$paramObj->getName();
338 338
             $params[$i]['isoptional'] = $paramObj->isOptional();
339 339
             if (method_exists($paramObj, 'getType')) {
340 340
                 $paramType = $paramObj->getType();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
             // build a signature
406 406
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
407 407
             $pSig = array($funcDesc['returnsDocs']);
408
-            for ($i = 0; $i < count($pars); $i++) {
408
+            for ($i = 0; $i<count($pars); $i++) {
409 409
                 $name = strtolower($funcDesc['params'][$i]['name']);
410 410
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
411 411
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                 }
463 463
             }
464 464
             $numPars = $req->getNumParams();
465
-            if ($numPars < $minPars || $numPars > $maxPars) {
465
+            if ($numPars<$minPars || $numPars>$maxPars) {
466 466
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
467 467
             }
468 468
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 
476 476
             $result = call_user_func_array($callable, $params);
477 477
 
478
-            if (! is_a($result, $allowedResponseClass)) {
478
+            if (!is_a($result, $allowedResponseClass)) {
479 479
                 // q: why not do the same for int, float, bool, string?
480 480
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
481 481
                     $result = new $valueClass($result, $funcDesc['returns']);
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
         if ($newFuncName == '') {
515 515
             if (is_array($callable)) {
516 516
                 if (is_string($callable[0])) {
517
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
517
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
518 518
                 } else {
519
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
519
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
520 520
                 }
521 521
             } else {
522 522
                 if ($callable instanceof \Closure) {
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
      */
549 549
     protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc)
550 550
     {
551
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
552
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
553
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
551
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
552
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
553
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
554 554
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
555 555
 
556 556
         $i = 0;
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
         // build body of new function
586 586
 
587 587
         $innerCode = "  \$paramCount = \$req->getNumParams();\n";
588
-        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
588
+        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
589 589
 
590
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
590
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
591 591
         if ($decodePhpObjects) {
592 592
             $innerCode .= "  \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n";
593 593
         } else {
@@ -601,24 +601,24 @@  discard block
 block discarded – undo
601 601
             static::holdObject($newFuncName, $callable[0]);
602 602
             $class = get_class($callable[0]);
603 603
             if ($class[0] !== '\\') {
604
-                $class = '\\' . $class;
604
+                $class = '\\'.$class;
605 605
             }
606 606
             $innerCode .= "  /// @var $class \$obj\n";
607
-            $innerCode .= "  \$obj = " . static::$namespace . "Wrapper::getHeldObject('$newFuncName');\n";
608
-            $realFuncName = '$obj->' . $callable[1];
607
+            $innerCode .= "  \$obj = ".static::$namespace."Wrapper::getHeldObject('$newFuncName');\n";
608
+            $realFuncName = '$obj->'.$callable[1];
609 609
         } else {
610 610
             $realFuncName = $plainFuncName;
611 611
         }
612 612
         foreach ($parsVariations as $i => $pars) {
613
-            $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
614
-            if ($i < (count($parsVariations) - 1))
613
+            $innerCode .= "  if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
614
+            if ($i<(count($parsVariations)-1))
615 615
                 $innerCode .= "  else\n";
616 616
         }
617
-        $allowedResponseClass = static::$allowedResponseClass != '' ? static::$allowedResponseClass : static::$namespace . 'Response';
618
-        $innerCode .= "  if (is_a(\$retVal, '" . $allowedResponseClass . "'))\n    return \$retVal;\n  else\n";
617
+        $allowedResponseClass = static::$allowedResponseClass != '' ? static::$allowedResponseClass : static::$namespace.'Response';
618
+        $innerCode .= "  if (is_a(\$retVal, '".$allowedResponseClass."'))\n    return \$retVal;\n  else\n";
619 619
         /// q: why not do the same for int, float, bool, string?
620 620
         if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
621
-            $innerCode .= "    return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));";
621
+            $innerCode .= "    return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));";
622 622
         } else {
623 623
             $encodeOptions = array();
624 624
             if ($encodeNulls) {
@@ -629,18 +629,18 @@  discard block
 block discarded – undo
629 629
             }
630 630
 
631 631
             if ($encodeOptions) {
632
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" .
633
-                    implode("', '", $encodeOptions) . "')));";
632
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('".
633
+                    implode("', '", $encodeOptions)."')));";
634 634
             } else {
635
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));";
635
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal));";
636 636
             }
637 637
         }
638 638
         // shall we exclude functions returning by ref?
639 639
         // if ($func->returnsReference())
640 640
         //     return false;
641 641
 
642
-        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" .
643
-            "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}";
642
+        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n".
643
+            "function $newFuncName(\$req)\n{\n".$innerCode."\n}";
644 644
 
645 645
         return $code;
646 646
     }
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
701 701
     {
702 702
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
703
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
703
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
704 704
         }
705 705
 
706 706
         if (is_object($className)) {
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
         } else {
709 709
             $realClassName = $className;
710 710
         }
711
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
711
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
712 712
     }
713 713
 
714 714
     /**
@@ -804,14 +804,14 @@  discard block
 block discarded – undo
804 804
      */
805 805
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
806 806
     {
807
-        $reqClass = static::$namespace . 'Request';
808
-        $valClass = static::$namespace . 'Value';
809
-        $decoderClass = static::$namespace . 'Encoder';
807
+        $reqClass = static::$namespace.'Request';
808
+        $valClass = static::$namespace.'Value';
809
+        $decoderClass = static::$namespace.'Encoder';
810 810
 
811 811
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
812
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
812
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
813 813
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
814
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
814
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
815 815
 
816 816
         $req = new $reqClass('system.methodSignature');
817 817
         $req->addParam(new $valClass($methodName));
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
         $response = $client->send($req, $timeout, $protocol);
822 822
         $client->setDebug($origDebug);
823 823
         if ($response->faultCode()) {
824
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
824
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
825 825
             return false;
826 826
         }
827 827
 
@@ -832,8 +832,8 @@  discard block
 block discarded – undo
832 832
             $mSig = $decoder->decode($mSig);
833 833
         }
834 834
 
835
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
836
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
835
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
836
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
837 837
             return false;
838 838
         }
839 839
 
@@ -848,11 +848,11 @@  discard block
 block discarded – undo
848 848
      */
849 849
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
850 850
     {
851
-        $reqClass = static::$namespace . 'Request';
852
-        $valClass = static::$namespace . 'Value';
851
+        $reqClass = static::$namespace.'Request';
852
+        $valClass = static::$namespace.'Value';
853 853
 
854 854
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
855
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
855
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
856 856
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
857 857
 
858 858
         $mDesc = '';
@@ -889,11 +889,11 @@  discard block
 block discarded – undo
889 889
         $clientClone = $this->cloneClientForClosure($client);
890 890
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
891 891
         {
892
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
892
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
893 893
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
894
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
895
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
896
-            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
894
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
895
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
896
+            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
897 897
             $throwFault = false;
898 898
             $decodeFault = false;
899 899
             $faultResponse = null;
@@ -904,9 +904,9 @@  discard block
 block discarded – undo
904 904
                 $faultResponse = $extraOptions['return_on_fault'];
905 905
             }
906 906
 
907
-            $reqClass = static::$namespace . 'Request';
908
-            $encoderClass = static::$namespace . 'Encoder';
909
-            $valueClass = static::$namespace . 'Value';
907
+            $reqClass = static::$namespace.'Request';
908
+            $encoderClass = static::$namespace.'Encoder';
909
+            $valueClass = static::$namespace.'Value';
910 910
 
911 911
             $encoder = new $encoderClass();
912 912
             $encodeOptions = array();
@@ -988,14 +988,14 @@  discard block
 block discarded – undo
988 988
      * @param string $mDesc
989 989
      * @return string[] keys: source, docstring
990 990
      */
991
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
991
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
992 992
     {
993
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
993
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
994 994
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
995
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
996
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
997
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
998
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
995
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
996
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
997
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
998
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
999 999
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : static::$prefix;
1000 1000
         $clientReturnType = isset($extraOptions['client_return_type']) ? $extraOptions['client_return_type'] : $prefix;
1001 1001
         $throwFault = false;
@@ -1009,10 +1009,10 @@  discard block
 block discarded – undo
1009 1009
         }
1010 1010
 
1011 1011
         $code = "function $newFuncName(";
1012
-        if ($clientCopyMode < 2) {
1012
+        if ($clientCopyMode<2) {
1013 1013
             // client copy mode 0 or 1 == full / partial client copy in emitted code
1014 1014
             $verbatimClientCopy = !$clientCopyMode;
1015
-            $innerCode = '  ' . str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1015
+            $innerCode = '  '.str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1016 1016
             $innerCode .= "\$client->setDebug(\$debug);\n";
1017 1017
             $this_ = '';
1018 1018
         } else {
@@ -1020,28 +1020,28 @@  discard block
 block discarded – undo
1020 1020
             $innerCode = '';
1021 1021
             $this_ = 'this->';
1022 1022
         }
1023
-        $innerCode .= "  \$req = new " . static::$namespace . "Request('$methodName');\n";
1023
+        $innerCode .= "  \$req = new ".static::$namespace."Request('$methodName');\n";
1024 1024
 
1025 1025
         if ($mDesc != '') {
1026 1026
             // take care that PHP comment is not terminated unwillingly by method description
1027 1027
             /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags...
1028
-            $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n";
1028
+            $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n";
1029 1029
         } else {
1030 1030
             $mDesc = "/**\n * Function $newFuncName.\n";
1031 1031
         }
1032 1032
 
1033 1033
         // param parsing
1034
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
1034
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
1035 1035
         $plist = array();
1036 1036
         $pCount = count($mSig);
1037
-        for ($i = 1; $i < $pCount; $i++) {
1037
+        for ($i = 1; $i<$pCount; $i++) {
1038 1038
             $plist[] = "\$p$i";
1039 1039
             $pType = $mSig[$i];
1040 1040
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
1041 1041
                 $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null'
1042 1042
             ) {
1043 1043
                 // only build directly xml-rpc values when type is known and scalar
1044
-                $innerCode .= "  \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n";
1044
+                $innerCode .= "  \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n";
1045 1045
             } else {
1046 1046
                 if ($encodePhpObjects || $encodeNulls) {
1047 1047
                     $encOpts = array();
@@ -1052,26 +1052,26 @@  discard block
 block discarded – undo
1052 1052
                         $encOpts[] = 'null_extension';
1053 1053
                     }
1054 1054
 
1055
-                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n";
1055
+                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n";
1056 1056
                 } else {
1057 1057
                     $innerCode .= "  \$p$i = \$encoder->encode(\$p$i);\n";
1058 1058
                 }
1059 1059
             }
1060 1060
             $innerCode .= "  \$req->addParam(\$p$i);\n";
1061
-            $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
1061
+            $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n";
1062 1062
         }
1063
-        if ($clientCopyMode < 2) {
1063
+        if ($clientCopyMode<2) {
1064 1064
             $plist[] = '$debug = 0';
1065 1065
             $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
1066 1066
         }
1067 1067
         $plist = implode(', ', $plist);
1068
-        $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]);
1068
+        $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]);
1069 1069
         if ($throwFault) {
1070
-            $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1070
+            $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1071 1071
         } else if ($decodeFault) {
1072
-            $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)";
1072
+            $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)";
1073 1073
         } else {
1074
-            $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)";
1074
+            $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)";
1075 1075
         }
1076 1076
         $mDesc .= "\n */\n";
1077 1077
 
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
             $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())";
1085 1085
         } else if ($decodeFault) {
1086 1086
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1087
-                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1087
+                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1088 1088
             } else {
1089
-                $respCode = 'return ' . var_export($faultResponse, true);
1089
+                $respCode = 'return '.var_export($faultResponse, true);
1090 1090
             }
1091 1091
         } else {
1092 1092
             $respCode = 'return $res';
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
             $innerCode .= "  if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());";
1098 1098
         }
1099 1099
 
1100
-        $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n";
1100
+        $code = $code.$plist.")\n{\n".$innerCode."\n}\n";
1101 1101
 
1102 1102
         return array('source' => $code, 'docstring' => $mDesc);
1103 1103
     }
@@ -1127,27 +1127,27 @@  discard block
 block discarded – undo
1127 1127
     public function wrapXmlrpcServer($client, $extraOptions = array())
1128 1128
     {
1129 1129
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1130
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1130
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1131 1131
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1132 1132
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1133
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
1134
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1135
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1133
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
1134
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1135
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1136 1136
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1137
-        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false;
1137
+        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false;
1138 1138
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1139 1139
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : static::$prefix;
1140 1140
         $clientReturnType = isset($extraOptions['client_return_type']) ? $extraOptions['client_return_type'] : $prefix;
1141 1141
 
1142
-        $reqClass = static::$namespace . 'Request';
1143
-        $decoderClass = static::$namespace . 'Encoder';
1142
+        $reqClass = static::$namespace.'Request';
1143
+        $decoderClass = static::$namespace.'Encoder';
1144 1144
 
1145 1145
         // retrieve the list of methods
1146 1146
         $req = new $reqClass('system.listMethods');
1147 1147
         /// @todo move setting of timeout, protocol to outside the send() call
1148 1148
         $response = $client->send($req, $timeout, $protocol);
1149 1149
         if ($response->faultCode()) {
1150
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1150
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1151 1151
 
1152 1152
             return false;
1153 1153
         }
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
             $mList = $decoder->decode($mList);
1159 1159
         }
1160 1160
         if (!is_array($mList) || !count($mList)) {
1161
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1161
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1162 1162
 
1163 1163
             return false;
1164 1164
         }
@@ -1168,8 +1168,8 @@  discard block
 block discarded – undo
1168 1168
             $xmlrpcClassName = $newClassName;
1169 1169
         } else {
1170 1170
             /// @todo direct access to $client->server is now deprecated
1171
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), array('_', ''),
1172
-                $client->server) . '_client';
1171
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), array('_', ''),
1172
+                $client->server).'_client';
1173 1173
         }
1174 1174
         while ($buildIt && class_exists($xmlrpcClassName)) {
1175 1175
             $xmlrpcClassName .= 'x';
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 
1178 1178
         $source = "class $xmlrpcClassName\n{\n  public \$client;\n\n";
1179 1179
         $source .= "  function __construct()\n  {\n";
1180
-        $source .= '    ' . str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1180
+        $source .= '    '.str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1181 1181
         $source .= "\$this->client = \$client;\n  }\n\n";
1182 1182
         $opts = array(
1183 1183
             'return_source' => true,
@@ -1200,28 +1200,28 @@  discard block
 block discarded – undo
1200 1200
                 $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts);
1201 1201
                 if ($methodWrap) {
1202 1202
                     if ($buildIt) {
1203
-                        $source .= $methodWrap['source'] . "\n";
1203
+                        $source .= $methodWrap['source']."\n";
1204 1204
 
1205 1205
                     } else {
1206
-                        $source .= '  ' . str_replace("\n", "\n  ", $methodWrap['docstring']);
1207
-                        $source .= str_replace("\n", "\n  ", $methodWrap['source']). "\n";
1206
+                        $source .= '  '.str_replace("\n", "\n  ", $methodWrap['docstring']);
1207
+                        $source .= str_replace("\n", "\n  ", $methodWrap['source'])."\n";
1208 1208
                     }
1209 1209
 
1210 1210
                 } else {
1211
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1211
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1212 1212
                 }
1213 1213
             }
1214 1214
         }
1215 1215
         $source .= "}\n";
1216 1216
         if ($buildIt) {
1217 1217
             $allOK = 0;
1218
-            eval($source . '$allOK=1;');
1218
+            eval($source.'$allOK=1;');
1219 1219
             if ($allOK) {
1220 1220
                 return $xmlrpcClassName;
1221 1221
             } else {
1222 1222
                 /// @todo direct access to $client->server is now deprecated
1223
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName .
1224
-                    ' to wrap remote server ' . $client->server);
1223
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.
1224
+                    ' to wrap remote server '.$client->server);
1225 1225
                 return false;
1226 1226
             }
1227 1227
         } else {
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
      */
1241 1241
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1242 1242
     {
1243
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->getUrl()) .
1243
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->getUrl()).
1244 1244
             "');\n";
1245 1245
 
1246 1246
         // copy all client fields to the client that will be generated runtime
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -611,8 +611,9 @@
 block discarded – undo
611 611
         }
612 612
         foreach ($parsVariations as $i => $pars) {
613 613
             $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
614
-            if ($i < (count($parsVariations) - 1))
615
-                $innerCode .= "  else\n";
614
+            if ($i < (count($parsVariations) - 1)) {
615
+                            $innerCode .= "  else\n";
616
+            }
616 617
         }
617 618
         $allowedResponseClass = static::$allowedResponseClass != '' ? static::$allowedResponseClass : static::$namespace . 'Response';
618 619
         $innerCode .= "  if (is_a(\$retVal, '" . $allowedResponseClass . "'))\n    return \$retVal;\n  else\n";
Please login to merge, or discard this patch.
demo/server/codegen.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 /**
5 5
  * Demoing the code-generation capabilities of the library: create all that is required to expose as xml-rpc methods
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     // *** NB do not do this in prod! The whole concept of code-generation is to do it offline using console scripts/ci/cd ***
17 17
 
18 18
     // CommentManager is the "xml-rpc-unaware" class, whose methods we want to make accessible via xml-rpc calls
19
-    $cm = new CommentManager(sys_get_temp_dir() . "/comments.db");
19
+    $cm = new CommentManager(sys_get_temp_dir()."/comments.db");
20 20
 
21 21
     // analyze the CommentManager instance and generate both code defining stub-methods and a dispatch map for the xml-rpc Server
22 22
     $w = new Wrapper();
@@ -34,59 +34,59 @@  discard block
 block discarded – undo
34 34
     // and a controller, to be accessed from the internet. This split allows to a) hand-edit the controller code if needed,
35 35
     // and b) later regenerate the stub-methods-holder and dispatch map without touching the controller.
36 36
     // NB: good security practices dictate that none of those files should be writeable by the webserver user account
37
-    $targetClassFile = sys_get_temp_dir() . '/MyServerClass.php';
38
-    $targetDispatchMapFile = sys_get_temp_dir() . '/myServerDispatchMap.php';
39
-    $targetControllerFile = sys_get_temp_dir() . '/myServerController.php';
37
+    $targetClassFile = sys_get_temp_dir().'/MyServerClass.php';
38
+    $targetDispatchMapFile = sys_get_temp_dir().'/myServerDispatchMap.php';
39
+    $targetControllerFile = sys_get_temp_dir().'/myServerController.php';
40 40
 
41 41
     // generate a file with a class definition
42 42
 
43 43
     // the generated code does not have an autoloader included - we need to add in one
44
-    $autoloader = __DIR__ . "/_prepend.php";
44
+    $autoloader = __DIR__."/_prepend.php";
45 45
 
46 46
     file_put_contents($targetClassFile,
47
-        "<?php\n\n" .
48
-        "require_once '$autoloader';\n\n" .
47
+        "<?php\n\n".
48
+        "require_once '$autoloader';\n\n".
49 49
         "class MyServerClass\n{\n\n"
50 50
     ) || die('uh oh');
51 51
 
52 52
     // we mangle a bit the code we get from wrapPhpClass to turn it into a php class definition instead of a bunch of functions
53 53
 
54 54
     foreach ($code as $methodName => $methodDef) {
55
-        file_put_contents($targetClassFile, '  ' . str_replace(array('function ', "\n"), array('public static function ', "\n  "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh');
56
-        $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function'];
55
+        file_put_contents($targetClassFile, '  '.str_replace(array('function ', "\n"), array('public static function ', "\n  "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh');
56
+        $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function'];
57 57
         unset($code[$methodName]['source']);
58 58
     }
59 59
     file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh');
60 60
 
61 61
     // generate separate files with the xml-rpc server instantiation and its dispatch map
62 62
 
63
-    file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n");
63
+    file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n");
64 64
 
65 65
     file_put_contents($targetControllerFile,
66
-        "<?php\n\n" .
66
+        "<?php\n\n".
67 67
 
68
-        "// class autoloader\n" .
69
-        "require_once '$autoloader';\n\n" .
68
+        "// class autoloader\n".
69
+        "require_once '$autoloader';\n\n".
70 70
 
71 71
         // NB: if we were running the generated code within the same script, the existing CommentManager instance would be
72 72
         // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder,
73 73
         // but since we are generating a php file for later use, it is up to us to initialize that variable with a
74 74
         // CommentManager instance
75
-        "// business logic setup\n" .
76
-        "\$cm = new CommentManager(sys_get_temp_dir() . '/comments.db');\n" .
77
-        "// save reference to the biz logic object so that it can be used by the code in the generated class\n" .
78
-        "\PhpXmlRpc\Wrapper::holdObject('*', \$cm);\n\n" .
79
-
80
-        "// the generated class implementing the json-rpc methods is not namespaced, load it explicitly\n" .
81
-        "require_once '$targetClassFile';\n\n" .
82
-
83
-        "// load the dispatch map and feed it to the json-rpc server\n" .
84
-        "\$dm = require_once '$targetDispatchMapFile';\n" .
85
-        '$s = new \PhpXmlRpc\Server($dm, false);' . "\n\n" .
86
-        '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" .
87
-        '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);' . "\n" .
88
-        '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);' . "\n\n" .
89
-        '$s->service();' . "\n"
75
+        "// business logic setup\n".
76
+        "\$cm = new CommentManager(sys_get_temp_dir() . '/comments.db');\n".
77
+        "// save reference to the biz logic object so that it can be used by the code in the generated class\n".
78
+        "\PhpXmlRpc\Wrapper::holdObject('*', \$cm);\n\n".
79
+
80
+        "// the generated class implementing the json-rpc methods is not namespaced, load it explicitly\n".
81
+        "require_once '$targetClassFile';\n\n".
82
+
83
+        "// load the dispatch map and feed it to the json-rpc server\n".
84
+        "\$dm = require_once '$targetDispatchMapFile';\n".
85
+        '$s = new \PhpXmlRpc\Server($dm, false);'."\n\n".
86
+        '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n".
87
+        '$s->setOption(\PhpXmlRpc\Server::OPT_DEBUG, 2);'."\n".
88
+        '$s->setOption(\PhpXmlRpc\Server::OPT_EXCEPTION_HANDLING, 1);'."\n\n".
89
+        '$s->service();'."\n"
90 90
     ) || die('uh oh');
91 91
 
92 92
     echo "Code generated";
@@ -94,6 +94,6 @@  discard block
 block discarded – undo
94 94
     // test that everything worked by running it in realtime (note that this script will return an xml-rpc error message if
95 95
     // run from the command line, as the server will find no xml-rpc payload to operate on)
96 96
 
97
-    $targetControllerFile = sys_get_temp_dir() . '/myServerController.php';
97
+    $targetControllerFile = sys_get_temp_dir().'/myServerController.php';
98 98
     require $targetControllerFile;
99 99
 }
Please login to merge, or discard this patch.