Passed
Pull Request — master (#109)
by
unknown
12:15
created
src/Request.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     public function xml_header($charsetEncoding = '')
58 58
     {
59 59
         if ($charsetEncoding != '') {
60
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
60
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
61 61
         } else {
62
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
62
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
63 63
         }
64 64
     }
65 65
 
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     public function createPayload($charsetEncoding = '')
83 83
     {
84 84
         if ($charsetEncoding != '') {
85
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
85
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
86 86
         } else {
87 87
             $this->content_type = 'text/xml';
88 88
         }
89 89
         $this->payload = $this->xml_header($charsetEncoding);
90
-        $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
91
-            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
90
+        $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
91
+            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
92 92
         $this->payload .= "<params>\n";
93 93
         foreach ($this->params as $p) {
94
-            $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) .
94
+            $this->payload .= "<param>\n".$p->serialize($charsetEncoding).
95 95
                 "</param>\n";
96 96
         }
97 97
         $this->payload .= "</params>\n";
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
             return true;
143 143
         } else {
144
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value');
144
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value');
145 145
             return false;
146 146
         }
147 147
     }
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
215 215
     {
216
-        if ($this->debug > 0) {
216
+        if ($this->debug>0) {
217 217
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
218 218
         }
219 219
 
220 220
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
221 221
 
222 222
         if ($data == '') {
223
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
223
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
224 224
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
225 225
         }
226 226
 
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
         if (substr($data, 0, 4) == 'HTTP') {
229 229
             $httpParser = new Http();
230 230
             try {
231
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
231
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
232 232
             } catch (HttpException $e) {
233 233
                 // failed processing of HTTP response headers
234 234
                 // save into response obj the full payload received, for debugging
235 235
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode()));
236
-            } catch(\Exception $e) {
236
+            } catch (\Exception $e) {
237 237
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
238 238
             }
239 239
         } else {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
250 250
         $pos = strrpos($data, '</methodResponse>');
251 251
         if ($pos !== false) {
252
-            $data = substr($data, 0, $pos + 17);
252
+            $data = substr($data, 0, $pos+17);
253 253
         }
254 254
 
255 255
         // try to 'guestimate' the character encoding of the received response
@@ -258,21 +258,21 @@  discard block
 block discarded – undo
258 258
             $data
259 259
         );
260 260
 
261
-        if ($this->debug >= 0) {
261
+        if ($this->debug>=0) {
262 262
             $this->httpResponse = $httpResponse;
263 263
         } else {
264 264
             $httpResponse = null;
265 265
         }
266 266
 
267
-        if ($this->debug > 0) {
267
+        if ($this->debug>0) {
268 268
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
269 269
             if ($start) {
270 270
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
271 271
                 /// @todo what if there is no end tag?
272 272
                 $end = strpos($data, '-->', $start);
273
-                $comments = substr($data, $start, $end - $start);
274
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t" .
275
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
273
+                $comments = substr($data, $start, $end-$start);
274
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t".
275
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
276 276
             }
277 277
         }
278 278
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 if (function_exists('mb_convert_encoding')) {
292 292
                     $data = mb_convert_encoding($data, 'UTF-8', $respEncoding);
293 293
                 } else {
294
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
294
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
295 295
                 }
296 296
             }
297 297
         }
@@ -316,16 +316,16 @@  discard block
 block discarded – undo
316 316
             //    there could be proxies meddling with the request, or network data corruption...
317 317
 
318 318
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
319
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
319
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
320 320
 
321
-            if ($this->debug > 0) {
321
+            if ($this->debug>0) {
322 322
                 $this->getLogger()->debug($xmlRpcParser->_xh['isf_reason']);
323 323
             }
324 324
         }
325 325
         // second error check: xml well-formed but not xml-rpc compliant
326 326
         elseif ($xmlRpcParser->_xh['isf'] == 2) {
327 327
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
328
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
328
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
329 329
 
330 330
             /// @todo echo something for the user? check if it was already done by the parser...
331 331
             //if ($this->debug > 0) {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         }
335 335
         // third error check: parsing of the response has somehow gone boink.
336 336
         /// @todo shall we omit this check, since we trust the parsing code?
337
-        elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
337
+        elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
338 338
             // something odd has happened and it's time to generate a client side error indicating something odd went on
339 339
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
340 340
                 '', $httpResponse
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 
343 343
             /// @todo echo something for the user?
344 344
         } else {
345
-            if ($this->debug > 1) {
345
+            if ($this->debug>1) {
346 346
                 $this->getLogger()->debug(
347 347
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
348 348
                 );
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
                 if ($errNo == 0) {
367 367
                     // FAULT returned, errno needs to reflect that
368 368
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
369
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
369
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
370 370
                     $errNo = -1;
371 371
                 }
372 372
 
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public static function xmlrpc_debugmsg($msg)
313 313
     {
314
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
314
+        static::$_xmlrpc_debuginfo .= $msg."\n";
315 315
     }
316 316
 
317 317
     /**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      */
324 324
     public static function error_occurred($msg)
325 325
     {
326
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
326
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
327 327
     }
328 328
 
329 329
     /**
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
345 345
         $out = '';
346 346
         if ($this->debug_info != '') {
347
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
347
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
348 348
         }
349 349
         if (static::$_xmlrpc_debuginfo != '') {
350
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
350
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
351 351
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
352 352
             // into return payload AFTER the beginning tag
353 353
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
         $this->debug_info = '';
377 377
 
378 378
         // Save what we received, before parsing it
379
-        if ($this->debug > 1) {
380
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
379
+        if ($this->debug>1) {
380
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
381 381
         }
382 382
 
383 383
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
             $resp->raw_data = $rawData;
395 395
         }
396 396
 
397
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
398
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
399
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
397
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
398
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
399
+                static::$_xmlrpcs_occurred_errors."+++END+++");
400 400
         }
401 401
 
402 402
         $payload = $this->xml_header($respCharset);
403
-        if ($this->debug > 0) {
404
-            $payload = $payload . $this->serializeDebug($respCharset);
403
+        if ($this->debug>0) {
404
+            $payload = $payload.$this->serializeDebug($respCharset);
405 405
         }
406 406
 
407 407
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
         if (empty($resp->payload)) {
410 410
             $resp->serialize($respCharset);
411 411
         }
412
-        $payload = $payload . $resp->payload;
412
+        $payload = $payload.$resp->payload;
413 413
 
414 414
         if ($returnPayload) {
415 415
             return $payload;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         // if we get a warning/error that has output some text before here, then we cannot
419 419
         // add a new header. We cannot say we are sending xml, either...
420 420
         if (!headers_sent()) {
421
-            header('Content-Type: ' . $resp->content_type);
421
+            header('Content-Type: '.$resp->content_type);
422 422
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
423 423
             header("Vary: Accept-Charset");
424 424
 
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
442 442
             // responses up to 8000 bytes
443 443
             if ($phpNoSelfCompress) {
444
-                header('Content-Length: ' . (int)strlen($payload));
444
+                header('Content-Length: '.(int) strlen($payload));
445 445
             }
446 446
         } else {
447
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
447
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
448 448
         }
449 449
 
450 450
         print $payload;
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
             $numParams = count($in);
508 508
         }
509 509
         foreach ($sigs as $curSig) {
510
-            if (count($curSig) == $numParams + 1) {
510
+            if (count($curSig) == $numParams+1) {
511 511
                 $itsOK = 1;
512
-                for ($n = 0; $n < $numParams; $n++) {
512
+                for ($n = 0; $n<$numParams; $n++) {
513 513
                     if (is_object($in)) {
514 514
                         $p = $in->getParam($n);
515 515
                         if ($p->kindOf() == 'scalar') {
@@ -522,10 +522,10 @@  discard block
 block discarded – undo
522 522
                     }
523 523
 
524 524
                     // param index is $n+1, as first member of sig is return type
525
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
525
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
526 526
                         $itsOK = 0;
527
-                        $pno = $n + 1;
528
-                        $wanted = $curSig[$n + 1];
527
+                        $pno = $n+1;
528
+                        $wanted = $curSig[$n+1];
529 529
                         $got = $pt;
530 530
                         break;
531 531
                     }
@@ -552,10 +552,10 @@  discard block
 block discarded – undo
552 552
         // check if $_SERVER is populated: it might have been disabled via ini file
553 553
         // (this is true even when in CLI mode)
554 554
         if (count($_SERVER) == 0) {
555
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
555
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
556 556
         }
557 557
 
558
-        if ($this->debug > 1) {
558
+        if ($this->debug>1) {
559 559
             if (function_exists('getallheaders')) {
560 560
                 $this->debugmsg(''); // empty line
561 561
                 foreach (getallheaders() as $name => $val) {
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
581 581
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
582 582
                         $data = $degzdata;
583
-                        if ($this->debug > 1) {
584
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
583
+                        if ($this->debug>1) {
584
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
585 585
                         }
586 586
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
587 587
                         $data = $degzdata;
588
-                        if ($this->debug > 1) {
589
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
588
+                        if ($this->debug>1) {
589
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
590 590
                         }
591 591
                     } else {
592 592
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
                 if (function_exists('mb_convert_encoding')) {
671 671
                     $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding);
672 672
                 } else {
673
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
673
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
674 674
                 }
675 675
             }
676 676
         }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
697 697
             return new Response(
698 698
                 0,
699
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
699
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
700 700
                 $xmlRpcParser->_xh['isf_reason']);
701 701
         } elseif ($xmlRpcParser->_xh['isf']) {
702 702
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs.
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             return new Response(
705 705
                 0,
706 706
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
707
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
707
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
708 708
         } else {
709 709
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
710 710
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -714,20 +714,20 @@  discard block
 block discarded – undo
714 714
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
715 715
                 )
716 716
             ) {
717
-                if ($this->debug > 1) {
718
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
717
+                if ($this->debug>1) {
718
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
719 719
                 }
720 720
 
721 721
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
722 722
             } else {
723 723
                 // build a Request object with data parsed from xml and add parameters in
724 724
                 $req = new Request($xmlRpcParser->_xh['method']);
725
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
725
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
726 726
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
727 727
                 }
728 728
 
729
-                if ($this->debug > 1) {
730
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
729
+                if ($this->debug>1) {
730
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
731 731
                 }
732 732
 
733 733
                 return $this->execute($req);
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
                 return new Response(
780 780
                     0,
781 781
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
782
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
782
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
783 783
                 );
784 784
             }
785 785
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         // build string representation of function 'name'
795 795
         if (is_array($func)) {
796 796
             if (is_object($func[0])) {
797
-                $funcName = get_class($func[0]) . '->' . $func[1];
797
+                $funcName = get_class($func[0]).'->'.$func[1];
798 798
             } else {
799 799
                 $funcName = implode('::', $func);
800 800
             }
@@ -806,23 +806,23 @@  discard block
 block discarded – undo
806 806
 
807 807
         // verify that function to be invoked is in fact callable
808 808
         if (!is_callable($func)) {
809
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
809
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
810 810
             return new Response(
811 811
                 0,
812 812
                 PhpXmlRpc::$xmlrpcerr['server_error'],
813
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
813
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
814 814
             );
815 815
         }
816 816
 
817 817
         if (isset($dmap[$methodName]['exception_handling'])) {
818
-            $exception_handling = (int)$dmap[$methodName]['exception_handling'];
818
+            $exception_handling = (int) $dmap[$methodName]['exception_handling'];
819 819
         } else {
820 820
             $exception_handling = $this->exception_handling;
821 821
         }
822 822
 
823 823
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
824 824
         // as part of response
825
-        if ($this->debug > 2) {
825
+        if ($this->debug>2) {
826 826
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
827 827
         }
828 828
 
@@ -836,14 +836,14 @@  discard block
 block discarded – undo
836 836
                     $r = call_user_func($func, $req);
837 837
                 }
838 838
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
839
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
839
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
840 840
                     if (is_a($r, 'PhpXmlRpc\Value')) {
841 841
                         $r = new Response($r);
842 842
                     } else {
843 843
                         $r = new Response(
844 844
                             0,
845 845
                             PhpXmlRpc::$xmlrpcerr['server_error'],
846
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
846
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
847 847
                         );
848 848
                     }
849 849
                 }
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
859 859
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
860 860
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
861
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
861
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
862 862
                         } else {
863 863
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
864 864
                             // return type correctly
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
             // proper error-response
884 884
             switch ($exception_handling) {
885 885
                 case 2:
886
-                    if ($this->debug > 2) {
886
+                    if ($this->debug>2) {
887 887
                         if (self::$_xmlrpcs_prev_ehandler) {
888 888
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
889 889
                         } else {
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
             // proper error-response
907 907
             switch ($exception_handling) {
908 908
                 case 2:
909
-                    if ($this->debug > 2) {
909
+                    if ($this->debug>2) {
910 910
                         if (self::$_xmlrpcs_prev_ehandler) {
911 911
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
912 912
                         } else {
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
             }
927 927
         }
928 928
 
929
-        if ($this->debug > 2) {
929
+        if ($this->debug>2) {
930 930
             // note: restore the error handler we found before calling the user func, even if it has been changed
931 931
             // inside the func itself
932 932
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
      */
993 993
     protected function debugmsg($string)
994 994
     {
995
-        $this->debug_info .= $string . "\n";
995
+        $this->debug_info .= $string."\n";
996 996
     }
997 997
 
998 998
     /**
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
     protected function xml_header($charsetEncoding = '')
1003 1003
     {
1004 1004
         if ($charsetEncoding != '') {
1005
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
1005
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
1006 1006
         } else {
1007
-            return "<?xml version=\"1.0\"?" . ">\n";
1007
+            return "<?xml version=\"1.0\"?".">\n";
1008 1008
         }
1009 1009
     }
1010 1010
 
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
                 $i++; // for error message, we count params from 1
1298 1298
                 return static::_xmlrpcs_multicall_error(new Response(0,
1299 1299
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1300
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1300
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1301 1301
             }
1302 1302
         }
1303 1303
 
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
             }
1379 1379
         } else {
1380 1380
             $numCalls = count($req);
1381
-            for ($i = 0; $i < $numCalls; $i++) {
1381
+            for ($i = 0; $i<$numCalls; $i++) {
1382 1382
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1383 1383
             }
1384 1384
         }
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
                                 'scalar' => $val,
58 58
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
59 59
                             );
60
-                            return (object)$xmlrpcVal;
60
+                            return (object) $xmlrpcVal;
61 61
                         case 'base64':
62 62
                             $xmlrpcVal = array(
63 63
                                 'xmlrpc_type' => 'base64',
64 64
                                 'scalar' => $val
65 65
                             );
66
-                            return (object)$xmlrpcVal;
66
+                            return (object) $xmlrpcVal;
67 67
                         case 'string':
68 68
                             if (isset($options['extension_api_encoding'])) {
69 69
                                 // if iconv is not available, we use mb_convert_encoding
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 'msg':
137 137
                 $paramCount = $xmlrpcVal->getNumParams();
138 138
                 $arr = array();
139
-                for ($i = 0; $i < $paramCount; $i++) {
139
+                for ($i = 0; $i<$paramCount; $i++) {
140 140
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
141 141
                 }
142 142
                 return $arr;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             case 'resource':
263 263
                 if (in_array('extension_api', $options)) {
264
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
264
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
265 265
                 } else {
266 266
                     $xmlrpcVal = new Value();
267 267
                 }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 if (function_exists('mb_convert_encoding')) {
308 308
                     $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding);
309 309
                 } else {
310
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
310
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
311 311
                 }
312 312
             }
313 313
         }
@@ -328,10 +328,10 @@  discard block
 block discarded – undo
328 328
             $parserOptions
329 329
         );
330 330
 
331
-        if ($xmlRpcParser->_xh['isf'] > 1) {
331
+        if ($xmlRpcParser->_xh['isf']>1) {
332 332
             // test that $xmlrpc->_xh['value'] is an obj, too???
333 333
 
334
-            $this->getLogger()->error('XML-RPC: ' . $xmlRpcParser->_xh['isf_reason']);
334
+            $this->getLogger()->error('XML-RPC: '.$xmlRpcParser->_xh['isf_reason']);
335 335
 
336 336
             return false;
337 337
         }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
             case 'methodcall':
354 354
                 $req = new Request($xmlRpcParser->_xh['method']);
355
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
355
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
356 356
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
357 357
                 }
358 358
                 return $req;
Please login to merge, or discard this patch.