Passed
Push — master ( 2a0134...2b7078 )
by Gaetano
05:26
created
extras/benchmark.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 use PhpXmlRpc\Encoder;
20 20
 
21 21
 /// @todo allow autoloading when the library is installed as dependency
22
-include_once __DIR__ . '/../vendor/autoload.php';
22
+include_once __DIR__.'/../vendor/autoload.php';
23 23
 
24
-include __DIR__ . '/../tests/parse_args.php';
24
+include __DIR__.'/../tests/parse_args.php';
25 25
 $args = argParser::getArgs();
26 26
 
27 27
 function begin_test($test_name, $test_case)
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     if (!isset($test_results[$test_name][$test_case])) {
42 42
         trigger_error('ending test that was not started');
43 43
     }
44
-    $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
44
+    $test_results[$test_name][$test_case]['time'] = $end-$test_results[$test_name][$test_case]['time'];
45 45
     $test_results[$test_name][$test_case]['result'] = $test_result;
46 46
     echo '.';
47 47
     flush();
@@ -75,24 +75,24 @@  discard block
 block discarded – undo
75 75
 }
76 76
 
77 77
 if ($is_web) {
78
-    echo "<h3>Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "</h3>\n";
78
+    echo "<h3>Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."</h3>\n";
79 79
     if ($xd) {
80
-        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: " . htmlspecialchars(xdebug_get_profiler_filename()) . "</h4>\n";
80
+        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
81 81
     }
82 82
     flush();
83 83
     ob_flush();
84 84
 } else {
85
-    echo "Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "\n";
85
+    echo "Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."\n";
86 86
     if ($xd) {
87
-        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: " . xdebug_get_profiler_filename() . "\n";
87
+        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
88 88
     }
89 89
 }
90 90
 
91 91
 // test 'manual style' data encoding vs. 'automatic style' encoding
92 92
 begin_test('Data encoding (large array)', 'manual encoding');
93
-for ($i = 0; $i < $num_tests; $i++) {
93
+for ($i = 0; $i<$num_tests; $i++) {
94 94
     $vals = array();
95
-    for ($j = 0; $j < 10; $j++) {
95
+    for ($j = 0; $j<10; $j++) {
96 96
         $valArray = array();
97 97
         foreach ($data[$j] as $key => $val) {
98 98
             $values = array();
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 begin_test('Data encoding (large array)', 'automatic encoding');
119 119
 $encoder = new Encoder();
120
-for ($i = 0; $i < $num_tests; $i++) {
120
+for ($i = 0; $i<$num_tests; $i++) {
121 121
     $value = $encoder->encode($data, array('auto_dates'));
122 122
     $out = $value->serialize();
123 123
 }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 if (function_exists('xmlrpc_set_type')) {
127 127
     begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
128
-    for ($i = 0; $i < $num_tests; $i++) {
129
-        for ($j = 0; $j < 10; $j++) {
128
+    for ($i = 0; $i<$num_tests; $i++) {
129
+        for ($j = 0; $j<10; $j++) {
130 130
             foreach ($keys as $k) {
131 131
                 xmlrpc_set_type($data[$j][$k][4], 'datetime');
132 132
                 xmlrpc_set_type($data[$j][$k][8], 'datetime');
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 // test 'old style' data decoding vs. 'automatic style' decoding
141 141
 $dummy = new Request('');
142 142
 $out = new Response($value);
143
-$in = '<?xml version="1.0" ?>' . "\n" . $out->serialize();
143
+$in = '<?xml version="1.0" ?>'."\n".$out->serialize();
144 144
 
145 145
 begin_test('Data decoding (large array)', 'manual decoding');
146
-for ($i = 0; $i < $num_tests; $i++) {
146
+for ($i = 0; $i<$num_tests; $i++) {
147 147
     $response = $dummy->parseResponse($in, true);
148 148
     $value = $response->value();
149 149
     $result = array();
150
-    foreach($value as $val1) {
150
+    foreach ($value as $val1) {
151 151
         $out = array();
152
-        foreach($val1 as $name => $val) {
152
+        foreach ($val1 as $name => $val) {
153 153
             $out[$name] = array();
154
-            foreach($val as $data) {
154
+            foreach ($val as $data) {
155 155
                 $out[$name][] = $data->scalarVal();
156 156
             }
157 157
         }
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 end_test('Data decoding (large array)', 'manual decoding', $result);
162 162
 
163 163
 begin_test('Data decoding (large array)', 'manual decoding deprecated');
164
-for ($i = 0; $i < $num_tests; $i++) {
164
+for ($i = 0; $i<$num_tests; $i++) {
165 165
     $response = $dummy->ParseResponse($in, true);
166 166
     $value = $response->value();
167 167
     $result = array();
168 168
     $l = $value->arraySize();
169
-    for ($k = 0; $k < $l; $k++) {
169
+    for ($k = 0; $k<$l; $k++) {
170 170
         $val1 = $value->arrayMem($k);
171 171
         $out = array();
172
-        foreach($val1 as $name => $val) {
172
+        foreach ($val1 as $name => $val) {
173 173
             $out[$name] = array();
174 174
             $m = $val->arraySize();
175
-            for ($j = 0; $j < $m; $j++) {
175
+            for ($j = 0; $j<$m; $j++) {
176 176
                 $data = $val->arrayMem($j);
177 177
                 $out[$name][] = $data->scalarVal();
178 178
             }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 end_test('Data decoding (large array)', 'manual decoding deprecated', $result);
184 184
 
185 185
 begin_test('Data decoding (large array)', 'automatic decoding');
186
-for ($i = 0; $i < $num_tests; $i++) {
186
+for ($i = 0; $i<$num_tests; $i++) {
187 187
     $response = $dummy->parseResponse($in, true, 'phpvals');
188 188
     $value = $response->value();
189 189
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 if (function_exists('xmlrpc_decode')) {
193 193
     begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
194
-    for ($i = 0; $i < $num_tests; $i++) {
194
+    for ($i = 0; $i<$num_tests; $i++) {
195 195
         $response = $dummy->parseResponse($in, true, 'xml');
196 196
         $value = xmlrpc_decode($response->value());
197 197
     }
@@ -208,16 +208,16 @@  discard block
 block discarded – undo
208 208
     $value = $encoder->encode($data1, array('auto_dates'));
209 209
     $req = new Request('interopEchoTests.echoValue', array($value));
210 210
     $reqs = array();
211
-    for ($i = 0; $i < $num_tests; $i++) {
211
+    for ($i = 0; $i<$num_tests; $i++) {
212 212
         $reqs[] = $req;
213 213
     }
214 214
 
215 215
     $server = explode(':', $args['HTTPSERVER']);
216
-    if (count($server) > 1) {
217
-        $srv = 'http://' . $server[0] . '://' . $server[1] . $args['HTTPURI'];
216
+    if (count($server)>1) {
217
+        $srv = 'http://'.$server[0].'://'.$server[1].$args['HTTPURI'];
218 218
         $c = new Client($args['HTTPURI'], $server[0], $server[1]);
219 219
     } else {
220
-        $srv = 'http://' . $args['HTTPSERVER'] . $args['HTTPURI'];
220
+        $srv = 'http://'.$args['HTTPSERVER'].$args['HTTPURI'];
221 221
         $c = new Client($args['HTTPURI'], $args['HTTPSERVER']);
222 222
     }
223 223
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
     begin_test($testName, 'http 10');
231 231
     $response = array();
232
-    for ($i = 0; $i < $num_tests; $i++) {
232
+    for ($i = 0; $i<$num_tests; $i++) {
233 233
         $resp = $c->send($req);
234 234
         $response[] = $resp->value();
235 235
     }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         $c->setOption(Client::OPT_KEEPALIVE, false);
240 240
         begin_test($testName, 'http 11 no keepalive');
241 241
         $response = array();
242
-        for ($i = 0; $i < $num_tests; $i++) {
242
+        for ($i = 0; $i<$num_tests; $i++) {
243 243
             $resp = $c->send($req, 10, 'http11');
244 244
             $response[] = $resp->value();
245 245
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
         begin_test($testName, 'http 11 w. keep-alive');
249 249
         $response = array();
250
-        for ($i = 0; $i < $num_tests; $i++) {
250
+        for ($i = 0; $i<$num_tests; $i++) {
251 251
             $resp = $c->send($req, 10, 'http11');
252 252
             $response[] = $resp->value();
253 253
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
         begin_test($testName, 'http 10 w. compression');
271 271
         $response = array();
272
-        for ($i = 0; $i < $num_tests; $i++) {
272
+        for ($i = 0; $i<$num_tests; $i++) {
273 273
             $resp = $c->send($req);
274 274
             $response[] = $resp->value();
275 275
         }
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $c->setOption(Client::OPT_KEEPALIVE, false);
280 280
             begin_test($testName, 'http 11 w. compression and no keepalive');
281 281
             $response = array();
282
-            for ($i = 0; $i < $num_tests; $i++) {
282
+            for ($i = 0; $i<$num_tests; $i++) {
283 283
                 $resp = $c->send($req, 10, 'http11');
284 284
                 $response[] = $resp->value();
285 285
             }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
             $c->setOption(Client::OPT_KEEPALIVE, true);
289 289
             begin_test($testName, 'http 11 w. keep-alive and compression');
290 290
             $response = array();
291
-            for ($i = 0; $i < $num_tests; $i++) {
291
+            for ($i = 0; $i<$num_tests; $i++) {
292 292
                 $resp = $c->send($req, 10, 'http11');
293 293
                 $response[] = $resp->value();
294 294
             }
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
         /// test multicall vs. many calls vs. keep-alives - HTTPS
310 310
 
311 311
         $server = explode(':', $args['HTTPSSERVER']);
312
-        if (count($server) > 1) {
313
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
312
+        if (count($server)>1) {
313
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
314 314
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
315 315
         } else {
316
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
316
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
317 317
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'https');
318 318
         }
319 319
         $c->setOption(Client::OPT_VERIFY_PEER, !$args['HTTPSIGNOREPEER']);
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         $c->setOption(Client::OPT_KEEPALIVE, false);
328 328
         begin_test($testName, 'https no keep-alive');
329 329
         $response = array();
330
-        for ($i = 0; $i < $num_tests; $i++) {
330
+        for ($i = 0; $i<$num_tests; $i++) {
331 331
             $resp = $c->send($req);
332 332
             $response[] = $resp->value();
333 333
         }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         $c->setOption(Client::OPT_KEEPALIVE, true);
337 337
         begin_test($testName, 'https w. keep-alive');
338 338
         $response = array();
339
-        for ($i = 0; $i < $num_tests; $i++) {
339
+        for ($i = 0; $i<$num_tests; $i++) {
340 340
             $resp = $c->send($req, 10);
341 341
             $response[] = $resp->value();
342 342
         }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $c->setOption(Client::OPT_KEEPALIVE, false);
358 358
             begin_test($testName, 'https w. compression and no keepalive');
359 359
             $response = array();
360
-            for ($i = 0; $i < $num_tests; $i++) {
360
+            for ($i = 0; $i<$num_tests; $i++) {
361 361
                 $resp = $c->send($req);
362 362
                 $response[] = $resp->value();
363 363
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $c->setOption(Client::OPT_KEEPALIVE, true);
367 367
             begin_test($testName, 'https w. keep-alive and compression');
368 368
             $response = array();
369
-            for ($i = 0; $i < $num_tests; $i++) {
369
+            for ($i = 0; $i<$num_tests; $i++) {
370 370
                 $resp = $c->send($req, 10);
371 371
                 $response[] = $resp->value();
372 372
             }
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
         /// test multicall vs. many calls vs. keep-alives - HTTP/2
388 388
 
389 389
         $server = explode(':', $args['HTTPSSERVER']);
390
-        if (count($server) > 1) {
391
-            $srv = 'https://' . $server[0] . ':' . $server[1] . $args['HTTPSURI'];
390
+        if (count($server)>1) {
391
+            $srv = 'https://'.$server[0].':'.$server[1].$args['HTTPSURI'];
392 392
             $c = new Client($args['HTTPSURI'], $server[0], $server[1], 'https');
393 393
         } else {
394
-            $srv = 'https://' . $args['HTTPSSERVER'] . $args['HTTPSURI'];
394
+            $srv = 'https://'.$args['HTTPSSERVER'].$args['HTTPSURI'];
395 395
             $c = new Client($args['HTTPSURI'], $args['HTTPSSERVER'], 443, 'h2');
396 396
         }
397 397
         $c->setOption(Client::OPT_VERIFY_PEER, !$args['HTTPSIGNOREPEER']);
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $c->setOption(Client::OPT_KEEPALIVE, false);
406 406
         begin_test($testName, 'http2 no keep-alive');
407 407
         $response = array();
408
-        for ($i = 0; $i < $num_tests; $i++) {
408
+        for ($i = 0; $i<$num_tests; $i++) {
409 409
             $resp = $c->send($req);
410 410
             $response[] = $resp->value();
411 411
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
         $c->setOption(Client::OPT_KEEPALIVE, true);
415 415
         begin_test($testName, 'http2 w. keep-alive');
416 416
         $response = array();
417
-        for ($i = 0; $i < $num_tests; $i++) {
417
+        for ($i = 0; $i<$num_tests; $i++) {
418 418
             $resp = $c->send($req, 10);
419 419
             $response[] = $resp->value();
420 420
         }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
             $c->setOption(Client::OPT_KEEPALIVE, false);
436 436
             begin_test($testName, 'http2 w. compression and no keepalive');
437 437
             $response = array();
438
-            for ($i = 0; $i < $num_tests; $i++) {
438
+            for ($i = 0; $i<$num_tests; $i++) {
439 439
                 $resp = $c->send($req);
440 440
                 $response[] = $resp->value();
441 441
             }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             $c->setOption(Client::OPT_KEEPALIVE, true);
445 445
             begin_test($testName, 'http2 w. keep-alive and compression');
446 446
             $response = array();
447
-            for ($i = 0; $i < $num_tests; $i++) {
447
+            for ($i = 0; $i<$num_tests; $i++) {
448 448
                 $resp = $c->send($req, 10);
449 449
                 $response[] = $resp->value();
450 450
             }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 foreach ($test_results as $test => $results) {
467 467
     echo "\nTEST: $test\n";
468 468
     foreach ($results as $case => $data) {
469
-        echo "  $case: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n";
469
+        echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
470 470
     }
471 471
 }
472 472
 
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             return true;
86 86
         } else {
87
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value');
87
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value');
88 88
             return false;
89 89
         }
90 90
     }
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
         $this->logDeprecationUnlessCalledBy('serialize');
135 135
 
136 136
         if ($charsetEncoding != '') {
137
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
137
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
138 138
         } else {
139 139
             $this->content_type = 'text/xml';
140 140
         }
141 141
 
142 142
         $result = $this->xml_header($charsetEncoding);
143
-        $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
144
-                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
143
+        $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
144
+                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
145 145
         $result .= "<params>\n";
146 146
         foreach ($this->params as $p) {
147
-            $result .= "<param>\n" . $p->serialize($charsetEncoding) .
147
+            $result .= "<param>\n".$p->serialize($charsetEncoding).
148 148
                 "</param>\n";
149 149
         }
150 150
         $result .= "</params>\n";
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
         $this->logDeprecationUnlessCalledBy('createPayload');
165 165
 
166 166
         if ($charsetEncoding != '') {
167
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
167
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
168 168
         } else {
169
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
169
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
170 170
         }
171 171
     }
172 172
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
230 230
     {
231
-        if ($this->debug > 0) {
231
+        if ($this->debug>0) {
232 232
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
233 233
         }
234 234
 
235 235
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
236 236
 
237 237
         if ($data == '') {
238
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
238
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
239 239
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
240 240
         }
241 241
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         if (substr($data, 0, 4) == 'HTTP') {
244 244
             $httpParser = new Http();
245 245
             try {
246
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
246
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
247 247
             } catch (HttpException $e) {
248 248
                 // failed processing of HTTP response headers
249 249
                 // save into response obj the full payload received, for debugging
250 250
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code' => $e->statusCode()));
251
-            } catch(\Exception $e) {
251
+            } catch (\Exception $e) {
252 252
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
253 253
             }
254 254
         } else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // idea from Luca Mariano, originally in PEARified version of the lib
265 265
         $pos = strrpos($data, '</methodResponse>');
266 266
         if ($pos !== false) {
267
-            $data = substr($data, 0, $pos + 17);
267
+            $data = substr($data, 0, $pos+17);
268 268
         }
269 269
 
270 270
         // try to 'guestimate' the character encoding of the received response
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
             $data
274 274
         );
275 275
 
276
-        if ($this->debug >= 0) {
276
+        if ($this->debug>=0) {
277 277
             $this->httpResponse = $httpResponse;
278 278
         } else {
279 279
             $httpResponse = null;
280 280
         }
281 281
 
282
-        if ($this->debug > 0) {
282
+        if ($this->debug>0) {
283 283
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
284 284
             if ($start) {
285 285
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
286 286
                 /// @todo what if there is no end tag?
287 287
                 $end = strpos($data, '-->', $start);
288
-                $comments = substr($data, $start, $end - $start);
289
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" .
290
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
288
+                $comments = substr($data, $start, $end-$start);
289
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t".
290
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
291 291
             }
292 292
         }
293 293
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     if ($respEncoding == 'ISO-8859-1') {
310 310
                         $data = utf8_encode($data);
311 311
                     } else {
312
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
312
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
313 313
                     }
314 314
                 }
315 315
             }
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
             //       there could be proxies meddling with the request, or network data corruption...
340 340
 
341 341
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
342
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
342
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse);
343 343
 
344
-            if ($this->debug > 0) {
344
+            if ($this->debug>0) {
345 345
                 $this->getLogger()->debug($_xh['isf_reason']);
346 346
             }
347 347
         }
348 348
         // second error check: xml well-formed but not xml-rpc compliant
349 349
         elseif ($_xh['isf'] == 2) {
350 350
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
351
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
351
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse);
352 352
 
353 353
             /// @todo echo something for the user? check if it was already done by the parser...
354 354
             //if ($this->debug > 0) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         // third error check: parsing of the response has somehow gone boink.
359 359
         /// @todo shall we omit the 2nd part of this check, since we trust the parsing code?
360 360
         ///       Either that, or check the fault results too...
361
-        elseif ($_xh['isf'] > 3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
361
+        elseif ($_xh['isf']>3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
362 362
             // something odd has happened and it's time to generate a client side error indicating something odd went on
363 363
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
364 364
                 '', $httpResponse
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
             /// @todo echo something for the user?
368 368
         } else {
369
-            if ($this->debug > 1) {
369
+            if ($this->debug>1) {
370 370
                 $this->getLogger()->debug(
371 371
                     "---PARSED---\n".var_export($_xh['value'], true)."\n---END---"
372 372
                 );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                 if ($errNo == 0) {
391 391
                     // FAULT returned, errno needs to reflect that
392 392
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
393
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
393
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
394 394
                     /// @todo in Encoder::decodeXML, we use PhpXmlRpc::$xmlrpcerr['invalid_return'] for this case (see
395 395
                     ///       also the todo 17 lines above)
396 396
                     $errNo = -1;
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             case '_php_class':
439 439
             case 'payload':
440 440
             case 'content_type':
441
-                $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
441
+                $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
442 442
                 return $this->$name;
443 443
             case 'httpResponse':
444 444
                 // manually implement the 'protected property' behaviour
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
                     }
451 451
                 }
452 452
                 if ($canAccess) {
453
-                    $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
453
+                    $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
454 454
                     return $this->httpResponse;
455 455
                 } else {
456
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
456
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
457 457
                 }
458 458
                 break;
459 459
             default:
460 460
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
461 461
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
462
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
462
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
463 463
                 $result = null;
464 464
                 return $result;
465 465
         }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             case 'debug':
474 474
             case 'payload':
475 475
             case 'content_type':
476
-                $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
476
+                $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
477 477
                 $this->$name = $value;
478 478
                 break;
479 479
             case 'httpResponse':
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
                     }
487 487
                 }
488 488
                 if ($canAccess) {
489
-                    $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
489
+                    $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
490 490
                     $this->httpResponse = $value;
491 491
                 } else {
492
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
492
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
493 493
                 }
494 494
                 break;
495 495
             default:
496 496
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
497 497
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
498
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
498
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
499 499
         }
500 500
     }
501 501
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             case 'debug':
508 508
             case 'payload':
509 509
             case 'content_type':
510
-                $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
510
+                $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
511 511
                 return isset($this->$name);
512 512
             case 'httpResponse':
513 513
                 // manually implement the 'protected property' behaviour
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                     }
520 520
                 }
521 521
                 if ($canAccess) {
522
-                    $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
522
+                    $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
523 523
                     return isset($this->httpResponse);
524 524
                 }
525 525
                 // break through voluntarily
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
             case 'debug':
537 537
             case 'payload':
538 538
             case 'content_type':
539
-                $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
539
+                $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
540 540
                 unset($this->$name);
541 541
                 break;
542 542
             case 'httpResponse':
@@ -549,16 +549,16 @@  discard block
 block discarded – undo
549 549
                     }
550 550
                 }
551 551
                 if ($canAccess) {
552
-                    $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
552
+                    $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
553 553
                     unset($this->httpResponse);
554 554
                 } else {
555
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
555
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
556 556
                 }
557 557
                 break;
558 558
             default:
559 559
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
560 560
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
561
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
561
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
562 562
         }
563 563
     }
564 564
 }
Please login to merge, or discard this patch.
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.
src/Wrapper.php 2 patches
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
             $callable = explode('::', $callable);
177 177
         }
178 178
         if (is_array($callable)) {
179
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
180
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
179
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
180
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
181 181
                 return false;
182 182
             }
183 183
             if (is_string($callable[0])) {
184 184
                 $plainFuncName = implode('::', $callable);
185 185
             } elseif (is_object($callable[0])) {
186
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
186
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
187 187
             }
188 188
             $exists = method_exists($callable[0], $callable[1]);
189 189
         } else if ($callable instanceof \Closure) {
190 190
             // we do not support creating code which wraps closures, as php does not allow to serialize them
191 191
             if (!$buildIt) {
192
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
192
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
193 193
                 return false;
194 194
             }
195 195
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         }
202 202
 
203 203
         if (!$exists) {
204
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
204
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
205 205
             return false;
206 206
         }
207 207
 
@@ -245,23 +245,23 @@  discard block
 block discarded – undo
245 245
         if (is_array($callable)) {
246 246
             $func = new \ReflectionMethod($callable[0], $callable[1]);
247 247
             if ($func->isPrivate()) {
248
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
248
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
249 249
                 return false;
250 250
             }
251 251
             if ($func->isProtected()) {
252
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
252
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
253 253
                 return false;
254 254
             }
255 255
             if ($func->isConstructor()) {
256
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
256
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
257 257
                 return false;
258 258
             }
259 259
             if ($func->isDestructor()) {
260
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
260
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
261 261
                 return false;
262 262
             }
263 263
             if ($func->isAbstract()) {
264
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
264
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
265 265
                 return false;
266 266
             }
267 267
             /// @todo add more checks for static vs. nonstatic?
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         if ($func->isInternal()) {
272 272
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
273 273
             ///       reflect internal php functions
274
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
274
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
275 275
             return false;
276 276
         }
277 277
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $i = 0;
332 332
         foreach ($func->getParameters() as $paramObj) {
333 333
             $params[$i] = array();
334
-            $params[$i]['name'] = '$' . $paramObj->getName();
334
+            $params[$i]['name'] = '$'.$paramObj->getName();
335 335
             $params[$i]['isoptional'] = $paramObj->isOptional();
336 336
             if (method_exists($paramObj, 'getType')) {
337 337
                 $paramType = $paramObj->getType();
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
             // build a signature
403 403
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
404 404
             $pSig = array($funcDesc['returnsDocs']);
405
-            for ($i = 0; $i < count($pars); $i++) {
405
+            for ($i = 0; $i<count($pars); $i++) {
406 406
                 $name = strtolower($funcDesc['params'][$i]['name']);
407 407
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
408 408
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
                 }
459 459
             }
460 460
             $numPars = $req->getNumParams();
461
-            if ($numPars < $minPars || $numPars > $maxPars) {
461
+            if ($numPars<$minPars || $numPars>$maxPars) {
462 462
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
463 463
             }
464 464
 
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
             $result = call_user_func_array($callable, $params);
473 473
 
474 474
 /// @todo when namespaces is under PhpXmlRpc, use root-class checking
475
-            if (! is_a($result, $responseClass)) {
475
+            if (!is_a($result, $responseClass)) {
476 476
                 // q: why not do the same for int, float, bool, string?
477 477
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
478 478
                     $result = new $valueClass($result, $funcDesc['returns']);
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
         if ($newFuncName == '') {
512 512
             if (is_array($callable)) {
513 513
                 if (is_string($callable[0])) {
514
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
514
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
515 515
                 } else {
516
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
516
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
517 517
                 }
518 518
             } else {
519 519
                 if ($callable instanceof \Closure) {
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
      */
546 546
     protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc)
547 547
     {
548
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
549
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
550
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
548
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
549
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
550
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
551 551
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
552 552
 
553 553
         $i = 0;
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
         // build body of new function
583 583
 
584 584
         $innerCode = "  \$paramCount = \$req->getNumParams();\n";
585
-        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
585
+        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
586 586
 
587
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
587
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
588 588
         if ($decodePhpObjects) {
589 589
             $innerCode .= "  \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n";
590 590
         } else {
@@ -598,24 +598,24 @@  discard block
 block discarded – undo
598 598
             static::holdObject($newFuncName, $callable[0]);
599 599
             $class = get_class($callable[0]);
600 600
             if ($class[0] !== '\\') {
601
-                $class = '\\' . $class;
601
+                $class = '\\'.$class;
602 602
             }
603 603
             $innerCode .= "  /// @var $class \$obj\n";
604 604
             $innerCode .= "  \$obj = PhpXmlRpc\\Wrapper::getHeldObject('$newFuncName');\n";
605
-            $realFuncName = '$obj->' . $callable[1];
605
+            $realFuncName = '$obj->'.$callable[1];
606 606
         } else {
607 607
             $realFuncName = $plainFuncName;
608 608
         }
609 609
         foreach ($parsVariations as $i => $pars) {
610
-            $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
611
-            if ($i < (count($parsVariations) - 1))
610
+            $innerCode .= "  if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
611
+            if ($i<(count($parsVariations)-1))
612 612
                 $innerCode .= "  else\n";
613 613
         }
614 614
 /// @todo here we should (could?) check for PhpXmlRpc/Response when dealing with a subclass namespace
615
-        $innerCode .= "  if (is_a(\$retVal, '" . static::$namespace . "Response'))\n    return \$retVal;\n  else\n";
615
+        $innerCode .= "  if (is_a(\$retVal, '".static::$namespace."Response'))\n    return \$retVal;\n  else\n";
616 616
         /// q: why not do the same for int, float, bool, string?
617 617
         if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
618
-            $innerCode .= "    return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));";
618
+            $innerCode .= "    return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));";
619 619
         } else {
620 620
             $encodeOptions = array();
621 621
             if ($encodeNulls) {
@@ -626,18 +626,18 @@  discard block
 block discarded – undo
626 626
             }
627 627
 
628 628
             if ($encodeOptions) {
629
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" .
630
-                    implode("', '", $encodeOptions) . "')));";
629
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('".
630
+                    implode("', '", $encodeOptions)."')));";
631 631
             } else {
632
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));";
632
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal));";
633 633
             }
634 634
         }
635 635
         // shall we exclude functions returning by ref?
636 636
         // if ($func->returnsReference())
637 637
         //     return false;
638 638
 
639
-        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" .
640
-            "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}";
639
+        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n".
640
+            "function $newFuncName(\$req)\n{\n".$innerCode."\n}";
641 641
 
642 642
         return $code;
643 643
     }
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
698 698
     {
699 699
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
700
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
700
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
701 701
         }
702 702
 
703 703
         if (is_object($className)) {
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
         } else {
706 706
             $realClassName = $className;
707 707
         }
708
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
708
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
709 709
     }
710 710
 
711 711
     /**
@@ -801,14 +801,14 @@  discard block
 block discarded – undo
801 801
      */
802 802
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
803 803
     {
804
-        $reqClass = static::$namespace . 'Request';
805
-        $valClass = static::$namespace . 'Value';
806
-        $decoderClass = static::$namespace . 'Encoder';
804
+        $reqClass = static::$namespace.'Request';
805
+        $valClass = static::$namespace.'Value';
806
+        $decoderClass = static::$namespace.'Encoder';
807 807
 
808 808
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
809
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
809
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
810 810
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
811
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
811
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
812 812
 
813 813
         $req = new $reqClass('system.methodSignature');
814 814
         $req->addParam(new $valClass($methodName));
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
         $response = $client->send($req, $timeout, $protocol);
819 819
         $client->setDebug($origDebug);
820 820
         if ($response->faultCode()) {
821
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
821
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
822 822
             return false;
823 823
         }
824 824
 
@@ -829,8 +829,8 @@  discard block
 block discarded – undo
829 829
             $mSig = $decoder->decode($mSig);
830 830
         }
831 831
 
832
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
833
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
832
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
833
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
834 834
             return false;
835 835
         }
836 836
 
@@ -845,11 +845,11 @@  discard block
 block discarded – undo
845 845
      */
846 846
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
847 847
     {
848
-        $reqClass = static::$namespace . 'Request';
849
-        $valClass = static::$namespace . 'Value';
848
+        $reqClass = static::$namespace.'Request';
849
+        $valClass = static::$namespace.'Value';
850 850
 
851 851
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
852
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
852
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
853 853
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
854 854
 
855 855
         $mDesc = '';
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
         $clientClone = $this->cloneClientForClosure($client);
887 887
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
888 888
         {
889
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
889
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
890 890
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
891
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
892
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
893
-            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
891
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
892
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
893
+            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
894 894
             $throwFault = false;
895 895
             $decodeFault = false;
896 896
             $faultResponse = null;
@@ -901,9 +901,9 @@  discard block
 block discarded – undo
901 901
                 $faultResponse = $extraOptions['return_on_fault'];
902 902
             }
903 903
 
904
-            $reqClass = static::$namespace . 'Request';
905
-            $encoderClass = static::$namespace . 'Encoder';
906
-            $valueClass = static::$namespace . 'Value';
904
+            $reqClass = static::$namespace.'Request';
905
+            $encoderClass = static::$namespace.'Encoder';
906
+            $valueClass = static::$namespace.'Value';
907 907
 
908 908
             $encoder = new $encoderClass();
909 909
             $encodeOptions = array();
@@ -985,14 +985,14 @@  discard block
 block discarded – undo
985 985
      * @param string $mDesc
986 986
      * @return string[] keys: source, docstring
987 987
      */
988
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
988
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
989 989
     {
990
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
990
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
991 991
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
992
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
993
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
994
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
995
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
992
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
993
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
994
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
995
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
996 996
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : static::$prefix;
997 997
         $clientReturnType = isset($extraOptions['client_return_type']) ? $extraOptions['client_return_type'] : $prefix;
998 998
         $throwFault = false;
@@ -1006,10 +1006,10 @@  discard block
 block discarded – undo
1006 1006
         }
1007 1007
 
1008 1008
         $code = "function $newFuncName(";
1009
-        if ($clientCopyMode < 2) {
1009
+        if ($clientCopyMode<2) {
1010 1010
             // client copy mode 0 or 1 == full / partial client copy in emitted code
1011 1011
             $verbatimClientCopy = !$clientCopyMode;
1012
-            $innerCode = '  ' . str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1012
+            $innerCode = '  '.str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1013 1013
             $innerCode .= "\$client->setDebug(\$debug);\n";
1014 1014
             $this_ = '';
1015 1015
         } else {
@@ -1017,28 +1017,28 @@  discard block
 block discarded – undo
1017 1017
             $innerCode = '';
1018 1018
             $this_ = 'this->';
1019 1019
         }
1020
-        $innerCode .= "  \$req = new " . static::$namespace . "Request('$methodName');\n";
1020
+        $innerCode .= "  \$req = new ".static::$namespace."Request('$methodName');\n";
1021 1021
 
1022 1022
         if ($mDesc != '') {
1023 1023
             // take care that PHP comment is not terminated unwillingly by method description
1024 1024
             /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags...
1025
-            $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n";
1025
+            $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n";
1026 1026
         } else {
1027 1027
             $mDesc = "/**\n * Function $newFuncName.\n";
1028 1028
         }
1029 1029
 
1030 1030
         // param parsing
1031
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
1031
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
1032 1032
         $plist = array();
1033 1033
         $pCount = count($mSig);
1034
-        for ($i = 1; $i < $pCount; $i++) {
1034
+        for ($i = 1; $i<$pCount; $i++) {
1035 1035
             $plist[] = "\$p$i";
1036 1036
             $pType = $mSig[$i];
1037 1037
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
1038 1038
                 $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null'
1039 1039
             ) {
1040 1040
                 // only build directly xml-rpc values when type is known and scalar
1041
-                $innerCode .= "  \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n";
1041
+                $innerCode .= "  \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n";
1042 1042
             } else {
1043 1043
                 if ($encodePhpObjects || $encodeNulls) {
1044 1044
                     $encOpts = array();
@@ -1049,26 +1049,26 @@  discard block
 block discarded – undo
1049 1049
                         $encOpts[] = 'null_extension';
1050 1050
                     }
1051 1051
 
1052
-                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n";
1052
+                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n";
1053 1053
                 } else {
1054 1054
                     $innerCode .= "  \$p$i = \$encoder->encode(\$p$i);\n";
1055 1055
                 }
1056 1056
             }
1057 1057
             $innerCode .= "  \$req->addParam(\$p$i);\n";
1058
-            $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
1058
+            $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n";
1059 1059
         }
1060
-        if ($clientCopyMode < 2) {
1060
+        if ($clientCopyMode<2) {
1061 1061
             $plist[] = '$debug = 0';
1062 1062
             $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
1063 1063
         }
1064 1064
         $plist = implode(', ', $plist);
1065
-        $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]);
1065
+        $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]);
1066 1066
         if ($throwFault) {
1067
-            $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1067
+            $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1068 1068
         } else if ($decodeFault) {
1069
-            $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)";
1069
+            $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)";
1070 1070
         } else {
1071
-            $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)";
1071
+            $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)";
1072 1072
         }
1073 1073
         $mDesc .= "\n */\n";
1074 1074
 
@@ -1081,9 +1081,9 @@  discard block
 block discarded – undo
1081 1081
             $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())";
1082 1082
         } else if ($decodeFault) {
1083 1083
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1084
-                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1084
+                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1085 1085
             } else {
1086
-                $respCode = 'return ' . var_export($faultResponse, true);
1086
+                $respCode = 'return '.var_export($faultResponse, true);
1087 1087
             }
1088 1088
         } else {
1089 1089
             $respCode = 'return $res';
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
             $innerCode .= "  if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());";
1095 1095
         }
1096 1096
 
1097
-        $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n";
1097
+        $code = $code.$plist.")\n{\n".$innerCode."\n}\n";
1098 1098
 
1099 1099
         return array('source' => $code, 'docstring' => $mDesc);
1100 1100
     }
@@ -1124,27 +1124,27 @@  discard block
 block discarded – undo
1124 1124
     public function wrapXmlrpcServer($client, $extraOptions = array())
1125 1125
     {
1126 1126
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1127
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1127
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1128 1128
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1129 1129
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1130
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
1131
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1132
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1130
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
1131
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1132
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1133 1133
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1134
-        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false;
1134
+        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false;
1135 1135
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1136 1136
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : static::$prefix;
1137 1137
         $clientReturnType = isset($extraOptions['client_return_type']) ? $extraOptions['client_return_type'] : $prefix;
1138 1138
 
1139
-        $reqClass = static::$namespace . 'Request';
1140
-        $decoderClass = static::$namespace . 'Encoder';
1139
+        $reqClass = static::$namespace.'Request';
1140
+        $decoderClass = static::$namespace.'Encoder';
1141 1141
 
1142 1142
         // retrieve the list of methods
1143 1143
         $req = new $reqClass('system.listMethods');
1144 1144
         /// @todo move setting of timeout, protocol to outside the send() call
1145 1145
         $response = $client->send($req, $timeout, $protocol);
1146 1146
         if ($response->faultCode()) {
1147
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1147
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1148 1148
 
1149 1149
             return false;
1150 1150
         }
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
             $mList = $decoder->decode($mList);
1156 1156
         }
1157 1157
         if (!is_array($mList) || !count($mList)) {
1158
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1158
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1159 1159
 
1160 1160
             return false;
1161 1161
         }
@@ -1165,8 +1165,8 @@  discard block
 block discarded – undo
1165 1165
             $xmlrpcClassName = $newClassName;
1166 1166
         } else {
1167 1167
             /// @todo direct access to $client->server is now deprecated
1168
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), array('_', ''),
1169
-                $client->server) . '_client';
1168
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), array('_', ''),
1169
+                $client->server).'_client';
1170 1170
         }
1171 1171
         while ($buildIt && class_exists($xmlrpcClassName)) {
1172 1172
             $xmlrpcClassName .= 'x';
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 
1175 1175
         $source = "class $xmlrpcClassName\n{\n  public \$client;\n\n";
1176 1176
         $source .= "  function __construct()\n  {\n";
1177
-        $source .= '    ' . str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1177
+        $source .= '    '.str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $clientReturnType, static::$namespace));
1178 1178
         $source .= "\$this->client = \$client;\n  }\n\n";
1179 1179
         $opts = array(
1180 1180
             'return_source' => true,
@@ -1197,28 +1197,28 @@  discard block
 block discarded – undo
1197 1197
                 $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts);
1198 1198
                 if ($methodWrap) {
1199 1199
                     if ($buildIt) {
1200
-                        $source .= $methodWrap['source'] . "\n";
1200
+                        $source .= $methodWrap['source']."\n";
1201 1201
 
1202 1202
                     } else {
1203
-                        $source .= '  ' . str_replace("\n", "\n  ", $methodWrap['docstring']);
1204
-                        $source .= str_replace("\n", "\n  ", $methodWrap['source']). "\n";
1203
+                        $source .= '  '.str_replace("\n", "\n  ", $methodWrap['docstring']);
1204
+                        $source .= str_replace("\n", "\n  ", $methodWrap['source'])."\n";
1205 1205
                     }
1206 1206
 
1207 1207
                 } else {
1208
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1208
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1209 1209
                 }
1210 1210
             }
1211 1211
         }
1212 1212
         $source .= "}\n";
1213 1213
         if ($buildIt) {
1214 1214
             $allOK = 0;
1215
-            eval($source . '$allOK=1;');
1215
+            eval($source.'$allOK=1;');
1216 1216
             if ($allOK) {
1217 1217
                 return $xmlrpcClassName;
1218 1218
             } else {
1219 1219
                 /// @todo direct access to $client->server is now deprecated
1220
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName .
1221
-                    ' to wrap remote server ' . $client->server);
1220
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.
1221
+                    ' to wrap remote server '.$client->server);
1222 1222
                 return false;
1223 1223
             }
1224 1224
         } else {
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
      */
1238 1238
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1239 1239
     {
1240
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->getUrl()) .
1240
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->getUrl()).
1241 1241
             "');\n";
1242 1242
 
1243 1243
         // 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
@@ -608,8 +608,9 @@
 block discarded – undo
608 608
         }
609 609
         foreach ($parsVariations as $i => $pars) {
610 610
             $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
611
-            if ($i < (count($parsVariations) - 1))
612
-                $innerCode .= "  else\n";
611
+            if ($i < (count($parsVariations) - 1)) {
612
+                            $innerCode .= "  else\n";
613
+            }
613 614
         }
614 615
 /// @todo here we should (could?) check for PhpXmlRpc/Response when dealing with a subclass namespace
615 616
         $innerCode .= "  if (is_a(\$retVal, '" . static::$namespace . "Response'))\n    return \$retVal;\n  else\n";
Please login to merge, or discard this patch.