@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests involving the Client class (and no server). |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $this->client->server .= 'XXX'; |
36 | 36 | $dnsinfo = @dns_get_record($this->client->server); |
37 | 37 | if ($dnsinfo) { |
38 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
38 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
39 | 39 | } else { |
40 | 40 | $r = $this->client->send($m, 5); |
41 | 41 | // make sure there's no freaking catchall DNS in effect |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // now test a successful connection |
64 | 64 | $server = explode(':', $this->args['HTTPSERVER']); |
65 | - if (count($server) > 1) { |
|
65 | + if (count($server)>1) { |
|
66 | 66 | $this->client->port = $server[1]; |
67 | 67 | } |
68 | 68 | $this->client->server = $server[0]; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests involving the Value class. |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->assertequals(1, count($v1)); |
156 | 156 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
157 | 157 | |
158 | - foreach($v1 as $key => $val) |
|
158 | + foreach ($v1 as $key => $val) |
|
159 | 159 | { |
160 | 160 | $this->assertArrayHasKey($key, $out); |
161 | 161 | $expected = $out[$key]; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $this->assertequals(2, count($v2)); |
171 | 171 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
172 | 172 | $i = 0; |
173 | - foreach($v2 as $key => $val) |
|
173 | + foreach ($v2 as $key => $val) |
|
174 | 174 | { |
175 | 175 | $expected = $out[$i]; |
176 | 176 | $this->assertequals($expected['key'], $key); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
186 | 186 | $data = array(); |
187 | - for ($i = 0; $i < 500000; $i++ ) { |
|
187 | + for ($i = 0; $i<500000; $i++) { |
|
188 | 188 | $data[] = 'hello world'; |
189 | 189 | } |
190 | 190 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function testI8() |
103 | 103 | { |
104 | - if (PHP_INT_SIZE == 4 ) { |
|
104 | + if (PHP_INT_SIZE == 4) { |
|
105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
106 | 106 | return; |
107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | public function testUnicodeInMemberName() |
178 | 178 | { |
179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
180 | 180 | $v = array($str => new xmlrpcval(1)); |
181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $response = @utf8_encode( |
193 | 193 | '<?xml version="1.0"?> |
194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
196 | 196 | <methodResponse> |
197 | 197 | <fault> |
198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | </member> |
204 | 204 | <member> |
205 | 205 | <name>faultString</name> |
206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
207 | 207 | </member> |
208 | 208 | </struct> |
209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $m = $this->newRequest('dummy'); |
213 | 213 | $r = $m->parseResponse($response); |
214 | 214 | $v = $r->faultString(); |
215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
421 | 421 | |
422 | - foreach($values as $value) { |
|
423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
422 | + foreach ($values as $value) { |
|
423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
424 | 424 | $r = $s->parseResponse($f); |
425 | 425 | $v = $r->faultCode(); |
426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
524 | 524 | |
525 | 525 | public function testUTF8Response() |
526 | 526 | { |
527 | - $string = chr(224) . chr(252) . chr(232); |
|
527 | + $string = chr(224).chr(252).chr(232); |
|
528 | 528 | |
529 | 529 | $s = $this->newRequest('dummy'); |
530 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
531 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
530 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
531 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
532 | 532 | '; |
533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $this->assertEquals($string, $v); |
537 | 537 | |
538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
539 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
539 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
540 | 540 | '; |
541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | |
553 | 553 | public function testLatin1Response() |
554 | 554 | { |
555 | - $string = chr(224) . chr(252) . chr(232); |
|
555 | + $string = chr(224).chr(252).chr(232); |
|
556 | 556 | |
557 | 557 | $s = $this->newRequest('dummy'); |
558 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
559 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
558 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
559 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
560 | 560 | '; |
561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $this->assertEquals($string, $v); |
565 | 565 | |
566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
567 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
567 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
568 | 568 | '; |
569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
570 | 570 | $v = $r->value(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
4 | 4 | |
5 | 5 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
6 | 6 | use PHPUnit\Framework\TestResult; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public function _run($result = NULL) |
30 | 30 | { |
31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
32 | 32 | |
33 | 33 | if ($result === NULL) { |
34 | 34 | $result = $this->createResult(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | parent::set_up(); |
60 | 60 | |
61 | 61 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
62 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
63 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
62 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
63 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
64 | 64 | } |
65 | 65 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function getOptions() |
261 | 261 | { |
262 | 262 | $values = array(); |
263 | - foreach($this->options as $opt) { |
|
263 | + foreach ($this->options as $opt) { |
|
264 | 264 | $values[$opt] = $this->getOption($opt); |
265 | 265 | } |
266 | 266 | return $values; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function setOptions($options) |
275 | 275 | { |
276 | - foreach($options as $name => $value) { |
|
276 | + foreach ($options as $name => $value) { |
|
277 | 277 | $this->setOption($name, $value); |
278 | 278 | } |
279 | 279 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public static function xmlrpc_debugmsg($msg) |
314 | 314 | { |
315 | - static::$_xmlrpc_debuginfo .= $msg . "\n"; |
|
315 | + static::$_xmlrpc_debuginfo .= $msg."\n"; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public static function error_occurred($msg) |
326 | 326 | { |
327 | - static::$_xmlrpcs_occurred_errors .= $msg . "\n"; |
|
327 | + static::$_xmlrpcs_occurred_errors .= $msg."\n"; |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | // user debug info should be encoded by the end user using the INTERNAL_ENCODING |
346 | 346 | $out = ''; |
347 | 347 | if ($this->debug_info != '') { |
348 | - $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n"; |
|
348 | + $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n"; |
|
349 | 349 | } |
350 | 350 | if (static::$_xmlrpc_debuginfo != '') { |
351 | - $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n"; |
|
351 | + $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n"; |
|
352 | 352 | // NB: a better solution MIGHT be to use CDATA, but we need to insert it |
353 | 353 | // into return payload AFTER the beginning tag |
354 | 354 | //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n"; |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | $this->debug_info = ''; |
378 | 378 | |
379 | 379 | // Save what we received, before parsing it |
380 | - if ($this->debug > 1) { |
|
381 | - $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++"); |
|
380 | + if ($this->debug>1) { |
|
381 | + $this->debugmsg("+++GOT+++\n".$data."\n+++END+++"); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding); |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | $resp->raw_data = $rawData; |
396 | 396 | } |
397 | 397 | |
398 | - if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') { |
|
399 | - $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" . |
|
400 | - static::$_xmlrpcs_occurred_errors . "+++END+++"); |
|
398 | + if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') { |
|
399 | + $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n". |
|
400 | + static::$_xmlrpcs_occurred_errors."+++END+++"); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $payload = $this->xml_header($respCharset); |
404 | - if ($this->debug > 0) { |
|
405 | - $payload = $payload . $this->serializeDebug($respCharset); |
|
404 | + if ($this->debug>0) { |
|
405 | + $payload = $payload.$this->serializeDebug($respCharset); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | // Do not create response serialization if it has already happened. Helps to build json magic |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if (empty($resp->payload)) { |
411 | 411 | $resp->serialize($respCharset); |
412 | 412 | } |
413 | - $payload = $payload . $resp->payload; |
|
413 | + $payload = $payload.$resp->payload; |
|
414 | 414 | |
415 | 415 | if ($returnPayload) { |
416 | 416 | return $payload; |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | // if we get a warning/error that has output some text before here, then we cannot |
420 | 420 | // add a new header. We cannot say we are sending xml, either... |
421 | 421 | if (!headers_sent()) { |
422 | - header('Content-Type: ' . $resp->content_type); |
|
422 | + header('Content-Type: '.$resp->content_type); |
|
423 | 423 | // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did |
424 | 424 | header("Vary: Accept-Charset"); |
425 | 425 | |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for |
443 | 443 | // responses up to 8000 bytes |
444 | 444 | if ($phpNoSelfCompress) { |
445 | - header('Content-Length: ' . (int)strlen($payload)); |
|
445 | + header('Content-Length: '.(int) strlen($payload)); |
|
446 | 446 | } |
447 | 447 | } else { |
448 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
448 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages'); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | print $payload; |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | $numParams = count($in); |
509 | 509 | } |
510 | 510 | foreach ($sigs as $curSig) { |
511 | - if (count($curSig) == $numParams + 1) { |
|
511 | + if (count($curSig) == $numParams+1) { |
|
512 | 512 | $itsOK = 1; |
513 | - for ($n = 0; $n < $numParams; $n++) { |
|
513 | + for ($n = 0; $n<$numParams; $n++) { |
|
514 | 514 | if (is_object($in)) { |
515 | 515 | $p = $in->getParam($n); |
516 | 516 | if ($p->kindOf() == 'scalar') { |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | } |
524 | 524 | |
525 | 525 | // param index is $n+1, as first member of sig is return type |
526 | - if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) { |
|
526 | + if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) { |
|
527 | 527 | $itsOK = 0; |
528 | - $pno = $n + 1; |
|
529 | - $wanted = $curSig[$n + 1]; |
|
528 | + $pno = $n+1; |
|
529 | + $wanted = $curSig[$n+1]; |
|
530 | 530 | $got = $pt; |
531 | 531 | break; |
532 | 532 | } |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | // check if $_SERVER is populated: it might have been disabled via ini file |
554 | 554 | // (this is true even when in CLI mode) |
555 | 555 | if (count($_SERVER) == 0) { |
556 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated'); |
|
556 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated'); |
|
557 | 557 | } |
558 | 558 | |
559 | - if ($this->debug > 1) { |
|
559 | + if ($this->debug>1) { |
|
560 | 560 | if (function_exists('getallheaders')) { |
561 | 561 | $this->debugmsg(''); // empty line |
562 | 562 | foreach (getallheaders() as $name => $val) { |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) { |
582 | 582 | if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) { |
583 | 583 | $data = $degzdata; |
584 | - if ($this->debug > 1) { |
|
585 | - $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
584 | + if ($this->debug>1) { |
|
585 | + $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
586 | 586 | } |
587 | 587 | } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
588 | 588 | $data = $degzdata; |
589 | - if ($this->debug > 1) { |
|
590 | - $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++"); |
|
589 | + if ($this->debug>1) { |
|
590 | + $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++"); |
|
591 | 591 | } |
592 | 592 | } else { |
593 | 593 | $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | if ($reqEncoding == 'ISO-8859-1') { |
675 | 675 | $data = utf8_encode($data); |
676 | 676 | } else { |
677 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding); |
|
677 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding); |
|
678 | 678 | } |
679 | 679 | } |
680 | 680 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches); |
702 | 702 | return new Response( |
703 | 703 | 0, |
704 | - PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1], |
|
704 | + PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1], |
|
705 | 705 | $xmlRpcParser->_xh['isf_reason']); |
706 | 706 | } elseif ($xmlRpcParser->_xh['isf']) { |
707 | 707 | /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs. |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | return new Response( |
710 | 710 | 0, |
711 | 711 | PhpXmlRpc::$xmlrpcerr['invalid_request'], |
712 | - PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']); |
|
712 | + PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']); |
|
713 | 713 | } else { |
714 | 714 | // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle |
715 | 715 | // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals) |
@@ -719,20 +719,20 @@ discard block |
||
719 | 719 | ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals') |
720 | 720 | ) |
721 | 721 | ) { |
722 | - if ($this->debug > 1) { |
|
723 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++"); |
|
722 | + if ($this->debug>1) { |
|
723 | + $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++"); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']); |
727 | 727 | } else { |
728 | 728 | // build a Request object with data parsed from xml and add parameters in |
729 | 729 | $req = new Request($xmlRpcParser->_xh['method']); |
730 | - for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) { |
|
730 | + for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) { |
|
731 | 731 | $req->addParam($xmlRpcParser->_xh['params'][$i]); |
732 | 732 | } |
733 | 733 | |
734 | - if ($this->debug > 1) { |
|
735 | - $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++"); |
|
734 | + if ($this->debug>1) { |
|
735 | + $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++"); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | return $this->execute($req); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | return new Response( |
785 | 785 | 0, |
786 | 786 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
787 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}" |
|
787 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}" |
|
788 | 788 | ); |
789 | 789 | } |
790 | 790 | } |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | // build string representation of function 'name' |
800 | 800 | if (is_array($func)) { |
801 | 801 | if (is_object($func[0])) { |
802 | - $funcName = get_class($func[0]) . '->' . $func[1]; |
|
802 | + $funcName = get_class($func[0]).'->'.$func[1]; |
|
803 | 803 | } else { |
804 | 804 | $funcName = implode('::', $func); |
805 | 805 | } |
@@ -811,23 +811,23 @@ discard block |
||
811 | 811 | |
812 | 812 | // verify that function to be invoked is in fact callable |
813 | 813 | if (!is_callable($func)) { |
814 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable"); |
|
814 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable"); |
|
815 | 815 | return new Response( |
816 | 816 | 0, |
817 | 817 | PhpXmlRpc::$xmlrpcerr['server_error'], |
818 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method" |
|
818 | + PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method" |
|
819 | 819 | ); |
820 | 820 | } |
821 | 821 | |
822 | 822 | if (isset($dmap[$methodName]['exception_handling'])) { |
823 | - $exception_handling = (int)$dmap[$methodName]['exception_handling']; |
|
823 | + $exception_handling = (int) $dmap[$methodName]['exception_handling']; |
|
824 | 824 | } else { |
825 | 825 | $exception_handling = $this->exception_handling; |
826 | 826 | } |
827 | 827 | |
828 | 828 | // If debug level is 3, we should catch all errors generated during processing of user function, and log them |
829 | 829 | // as part of response |
830 | - if ($this->debug > 2) { |
|
830 | + if ($this->debug>2) { |
|
831 | 831 | self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler')); |
832 | 832 | } |
833 | 833 | |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | $r = call_user_func($func, $req); |
842 | 842 | } |
843 | 843 | if (!is_a($r, 'PhpXmlRpc\Response')) { |
844 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r)); |
|
844 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r)); |
|
845 | 845 | if (is_a($r, 'PhpXmlRpc\Value')) { |
846 | 846 | $r = new Response($r); |
847 | 847 | } else { |
848 | 848 | $r = new Response( |
849 | 849 | 0, |
850 | 850 | PhpXmlRpc::$xmlrpcerr['server_error'], |
851 | - PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object" |
|
851 | + PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object" |
|
852 | 852 | ); |
853 | 853 | } |
854 | 854 | } |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | $r = call_user_func_array($func, array($methodName, $params, $this->user_data)); |
864 | 864 | // mimic EPI behaviour: if we get an array that looks like an error, make it an error response |
865 | 865 | if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) { |
866 | - $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']); |
|
866 | + $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']); |
|
867 | 867 | } else { |
868 | 868 | // functions using EPI api should NOT return resp objects, so make sure we encode the |
869 | 869 | // return type correctly |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | // proper error-response |
889 | 889 | switch ($exception_handling) { |
890 | 890 | case 2: |
891 | - if ($this->debug > 2) { |
|
891 | + if ($this->debug>2) { |
|
892 | 892 | if (self::$_xmlrpcs_prev_ehandler) { |
893 | 893 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
894 | 894 | } else { |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | // proper error-response |
912 | 912 | switch ($exception_handling) { |
913 | 913 | case 2: |
914 | - if ($this->debug > 2) { |
|
914 | + if ($this->debug>2) { |
|
915 | 915 | if (self::$_xmlrpcs_prev_ehandler) { |
916 | 916 | set_error_handler(self::$_xmlrpcs_prev_ehandler); |
917 | 917 | } else { |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | } |
932 | 932 | } |
933 | 933 | |
934 | - if ($this->debug > 2) { |
|
934 | + if ($this->debug>2) { |
|
935 | 935 | // note: restore the error handler we found before calling the user func, even if it has been changed |
936 | 936 | // inside the func itself |
937 | 937 | if (self::$_xmlrpcs_prev_ehandler) { |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | */ |
998 | 998 | protected function debugmsg($string) |
999 | 999 | { |
1000 | - $this->debug_info .= $string . "\n"; |
|
1000 | + $this->debug_info .= $string."\n"; |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | /** |
@@ -1007,9 +1007,9 @@ discard block |
||
1007 | 1007 | protected function xml_header($charsetEncoding = '') |
1008 | 1008 | { |
1009 | 1009 | if ($charsetEncoding != '') { |
1010 | - return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n"; |
|
1010 | + return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n"; |
|
1011 | 1011 | } else { |
1012 | - return "<?xml version=\"1.0\"?" . ">\n"; |
|
1012 | + return "<?xml version=\"1.0\"?".">\n"; |
|
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | $i++; // for error message, we count params from 1 |
1303 | 1303 | return static::_xmlrpcs_multicall_error(new Response(0, |
1304 | 1304 | PhpXmlRpc::$xmlrpcerr['incorrect_params'], |
1305 | - PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i)); |
|
1305 | + PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i)); |
|
1306 | 1306 | } |
1307 | 1307 | } |
1308 | 1308 | |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | } |
1384 | 1384 | } else { |
1385 | 1385 | $numCalls = count($req); |
1386 | - for ($i = 0; $i < $numCalls; $i++) { |
|
1386 | + for ($i = 0; $i<$numCalls; $i++) { |
|
1387 | 1387 | $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]); |
1388 | 1388 | } |
1389 | 1389 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->me['struct'] = $val; |
97 | 97 | break; |
98 | 98 | default: |
99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($typeOf !== 1) { |
129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
143 | 143 | |
144 | 144 | switch ($this->mytype) { |
145 | 145 | case 1: |
146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
147 | 147 | return 0; |
148 | 148 | case 3: |
149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
150 | 150 | return 0; |
151 | 151 | case 2: |
152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | return 1; |
192 | 192 | } else { |
193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
194 | 194 | return 0; |
195 | 195 | } |
196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | return 1; |
223 | 223 | } else { |
224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
225 | 225 | return 0; |
226 | 226 | } |
227 | 227 | } |
@@ -265,19 +265,19 @@ discard block |
||
265 | 265 | case 1: |
266 | 266 | switch ($typ) { |
267 | 267 | case static::$xmlrpcBase64: |
268 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
268 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
269 | 269 | break; |
270 | 270 | case static::$xmlrpcBoolean: |
271 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
271 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
272 | 272 | break; |
273 | 273 | case static::$xmlrpcString: |
274 | 274 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
275 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
275 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
276 | 276 | break; |
277 | 277 | case static::$xmlrpcInt: |
278 | 278 | case static::$xmlrpcI4: |
279 | 279 | case static::$xmlrpcI8: |
280 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
280 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
281 | 281 | break; |
282 | 282 | case static::$xmlrpcDouble: |
283 | 283 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -285,16 +285,16 @@ discard block |
||
285 | 285 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
286 | 286 | // The code below tries its best at keeping max precision while avoiding exp notation, |
287 | 287 | // but there is of course no limit in the number of decimal places to be used... |
288 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
288 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
289 | 289 | break; |
290 | 290 | case static::$xmlrpcDateTime: |
291 | 291 | if (is_string($val)) { |
292 | 292 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
293 | 293 | // DateTimeInterface is not present in php 5.4... |
294 | 294 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
295 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
295 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
296 | 296 | } elseif (is_int($val)) { |
297 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
297 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
298 | 298 | } else { |
299 | 299 | // not really a good idea here: but what should we output anyway? left for backward compat... |
300 | 300 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -316,14 +316,14 @@ discard block |
||
316 | 316 | case 3: |
317 | 317 | // struct |
318 | 318 | if ($this->_php_class) { |
319 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
319 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
320 | 320 | } else { |
321 | 321 | $rs .= "<struct>\n"; |
322 | 322 | } |
323 | 323 | $charsetEncoder = $this->getCharsetEncoder(); |
324 | 324 | /** @var Value $val2 */ |
325 | 325 | foreach ($val as $key2 => $val2) { |
326 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
326 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
327 | 327 | //$rs.=$this->serializeval($val2); |
328 | 328 | $rs .= $val2->serialize($charsetEncoding); |
329 | 329 | $rs .= "</member>\n"; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $val = reset($this->me); |
359 | 359 | $typ = key($this->me); |
360 | 360 | |
361 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
361 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -1,5 +1,5 @@ discard block |
||
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; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $handles = array(); |
27 | 27 | $curl = curl_multi_init(); |
28 | 28 | |
29 | - foreach($requests as $k => $req) { |
|
29 | + foreach ($requests as $k => $req) { |
|
30 | 30 | $req->setDebug($this->debug); |
31 | 31 | |
32 | 32 | $handle = $this->prepareCurlHandle( |
@@ -59,19 +59,19 @@ discard block |
||
59 | 59 | $running = 0; |
60 | 60 | do { |
61 | 61 | curl_multi_exec($curl, $running); |
62 | - } while($running > 0); |
|
62 | + } while ($running>0); |
|
63 | 63 | |
64 | 64 | $responses = array(); |
65 | - foreach($handles as $k => $h) { |
|
65 | + foreach ($handles as $k => $h) { |
|
66 | 66 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
67 | 67 | |
68 | - if ($this->debug > 1) { |
|
68 | + if ($this->debug>1) { |
|
69 | 69 | $message = "---CURL INFO---\n"; |
70 | 70 | foreach (curl_getinfo($h) as $name => $val) { |
71 | 71 | if (is_array($val)) { |
72 | 72 | $val = implode("\n", $val); |
73 | 73 | } |
74 | - $message .= $name . ': ' . $val . "\n"; |
|
74 | + $message .= $name.': '.$val."\n"; |
|
75 | 75 | } |
76 | 76 | $message .= '---END---'; |
77 | 77 | $this->getLogger()->debugMessage($message); |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | } |
83 | 83 | curl_multi_close($curl); |
84 | 84 | |
85 | - foreach($responses as $k => $resp) { |
|
85 | + foreach ($responses as $k => $resp) { |
|
86 | 86 | if (!$resp) { |
87 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
87 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
88 | 88 | } else { |
89 | 89 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
90 | 90 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | $value = $encoder->encode($data, array('auto_dates')); |
102 | 102 | $req = new Request('interopEchoTests.echoValue', array($value)); |
103 | 103 | $reqs = array(); |
104 | -for ($i = 0; $i < $num_tests; $i++) { |
|
104 | +for ($i = 0; $i<$num_tests; $i++) { |
|
105 | 105 | $reqs[] = $req; |
106 | 106 | } |
107 | 107 | |
108 | 108 | $client = new ParallelClient(XMLRPCSERVER); |
109 | -$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
109 | +$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
110 | 110 | |
111 | 111 | // a minimal benchmark - use 3 strategies to execute the same 25 calls: sequentially, using parallel http requests, and |
112 | 112 | // using a single system.multiCall request |
@@ -116,18 +116,18 @@ discard block |
||
116 | 116 | |
117 | 117 | $t = microtime(true); |
118 | 118 | $resp = $client->send($reqs); |
119 | -$t = microtime(true) - $t; |
|
120 | -echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
119 | +$t = microtime(true)-$t; |
|
120 | +echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n"; |
|
121 | 121 | flush(); |
122 | 122 | |
123 | 123 | $t = microtime(true); |
124 | 124 | $resp = $client->sendParallel($reqs); |
125 | -$t = microtime(true) - $t; |
|
126 | -echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
125 | +$t = microtime(true)-$t; |
|
126 | +echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n"; |
|
127 | 127 | flush(); |
128 | 128 | |
129 | 129 | $client->setOption(Client::OPT_NO_MULTICALL, false); |
130 | 130 | $t = microtime(true); |
131 | 131 | $resp = $client->send($reqs); |
132 | -$t = microtime(true) - $t; |
|
133 | -echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
132 | +$t = microtime(true)-$t; |
|
133 | +echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n"; |
@@ -1,5 +1,5 @@ discard block |
||
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> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function display_error($r) |
18 | 18 | { |
19 | 19 | output("An error occurred: "); |
20 | - output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>"); |
|
20 | + output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | $client = new Client(XMLRPCSERVER); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP); |
26 | 26 | |
27 | 27 | // First off, let's retrieve the list of methods available on the remote server |
28 | -output("<h3>methods available at http://" . $client->server . $client->path . "</h3>\n"); |
|
28 | +output("<h3>methods available at http://".$client->server.$client->path."</h3>\n"); |
|
29 | 29 | $req = new Request('system.listMethods'); |
30 | 30 | $resp = $client->send($req); |
31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | // Then, retrieve the signature and help text of each available method |
49 | 49 | foreach ($v as $methodName) { |
50 | - output("<h4>" . htmlspecialchars($methodName) . "</h4>\n"); |
|
50 | + output("<h4>".htmlspecialchars($methodName)."</h4>\n"); |
|
51 | 51 | // build requests first, add params later |
52 | 52 | $r1 = new PhpXmlRpc\Request('system.methodHelp'); |
53 | 53 | $r2 = new PhpXmlRpc\Request('system.methodSignature'); |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | $ret = $sig[0]; |
86 | - output("<code>" . htmlspecialchars($ret) . " " |
|
87 | - . htmlspecialchars($methodName) . "("); |
|
88 | - if (count($sig) > 1) { |
|
89 | - for ($k = 1; $k < count($sig); $k++) { |
|
86 | + output("<code>".htmlspecialchars($ret)." " |
|
87 | + . htmlspecialchars($methodName)."("); |
|
88 | + if (count($sig)>1) { |
|
89 | + for ($k = 1; $k<count($sig); $k++) { |
|
90 | 90 | output(htmlspecialchars($sig[$k])); |
91 | - if ($k < count($sig) - 1) { |
|
91 | + if ($k<count($sig)-1) { |
|
92 | 92 | output(", "); |
93 | 93 | } |
94 | 94 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 - Getstatename demo</title></head> |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | $stateNo = ""; |
18 | 18 | |
19 | 19 | if (isset($_POST['stateno']) && $_POST['stateno'] != "") { |
20 | - $stateNo = (integer)$_POST['stateno']; |
|
20 | + $stateNo = (integer) $_POST['stateno']; |
|
21 | 21 | $method = 'examples.getStateName'; |
22 | 22 | $arguments = array( |
23 | 23 | new Value($stateNo, Value::$xmlrpcInt), |
24 | 24 | ); |
25 | 25 | $req = new Request($method, $arguments); |
26 | - output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . |
|
26 | + output("Sending the following request:<pre>\n\n".htmlentities($req->serialize()). |
|
27 | 27 | "\n\n</pre>Debug info of server data follows...\n\n"); |
28 | 28 | $client = new Client(XMLRPCSERVER); |
29 | 29 | $client->setOption(Client::OPT_DEBUG, 1); |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | $val = $resp->value(); |
33 | 33 | // NB: we are _assuming_ that the server did return a scalar xml-rpc value here. |
34 | 34 | // If the server is not trusted, we might check that via `$val->kindOf() == 'scalar'` |
35 | - output('<br/>State number <b>' . $stateNo . '</b> is <b>' |
|
36 | - . htmlspecialchars($val->scalarval()) . '</b><br/><br/>'); |
|
35 | + output('<br/>State number <b>'.$stateNo.'</b> is <b>' |
|
36 | + . htmlspecialchars($val->scalarval()).'</b><br/><br/>'); |
|
37 | 37 | } else { |
38 | 38 | output('An error occurred: '); |
39 | - output('<pre>Code: ' . htmlspecialchars($resp->faultCode()) |
|
40 | - . " Reason: '" . htmlspecialchars($resp->faultString()) . "'</pre>"); |
|
39 | + output('<pre>Code: '.htmlspecialchars($resp->faultCode()) |
|
40 | + . " Reason: '".htmlspecialchars($resp->faultString())."'</pre>"); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 |