Passed
Push — master ( 8ff19d...02b7f4 )
by Gaetano
05:49
created
src/Server.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public static function xmlrpc_debugmsg($msg)
193 193
     {
194
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
194
+        static::$_xmlrpc_debuginfo .= $msg."\n";
195 195
     }
196 196
 
197 197
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public static function error_occurred($msg)
205 205
     {
206
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
206
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
207 207
     }
208 208
 
209 209
     /**
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
225 225
         $out = '';
226 226
         if ($this->debug_info != '') {
227
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
227
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
228 228
         }
229 229
         if (static::$_xmlrpc_debuginfo != '') {
230
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
230
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
231 231
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
232 232
             // into return payload AFTER the beginning tag
233 233
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
         $this->debug_info = '';
257 257
 
258 258
         // Save what we received, before parsing it
259
-        if ($this->debug > 1) {
260
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
259
+        if ($this->debug>1) {
260
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
261 261
         }
262 262
 
263 263
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
             $resp->raw_data = $rawData;
275 275
         }
276 276
 
277
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
278
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
279
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
277
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
278
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
279
+                static::$_xmlrpcs_occurred_errors."+++END+++");
280 280
         }
281 281
 
282 282
         $payload = $this->xml_header($respCharset);
283
-        if ($this->debug > 0) {
284
-            $payload = $payload . $this->serializeDebug($respCharset);
283
+        if ($this->debug>0) {
284
+            $payload = $payload.$this->serializeDebug($respCharset);
285 285
         }
286 286
 
287 287
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         if (empty($resp->payload)) {
290 290
             $resp->serialize($respCharset);
291 291
         }
292
-        $payload = $payload . $resp->payload;
292
+        $payload = $payload.$resp->payload;
293 293
 
294 294
         if ($returnPayload) {
295 295
             return $payload;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // if we get a warning/error that has output some text before here, then we cannot
299 299
         // add a new header. We cannot say we are sending xml, either...
300 300
         if (!headers_sent()) {
301
-            header('Content-Type: ' . $resp->content_type);
301
+            header('Content-Type: '.$resp->content_type);
302 302
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
303 303
             header("Vary: Accept-Charset");
304 304
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
322 322
             // responses up to 8000 bytes
323 323
             if ($phpNoSelfCompress) {
324
-                header('Content-Length: ' . (int)strlen($payload));
324
+                header('Content-Length: '.(int) strlen($payload));
325 325
             }
326 326
         } else {
327
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
327
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
328 328
         }
329 329
 
330 330
         print $payload;
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
             $numParams = count($in);
383 383
         }
384 384
         foreach ($sigs as $curSig) {
385
-            if (count($curSig) == $numParams + 1) {
385
+            if (count($curSig) == $numParams+1) {
386 386
                 $itsOK = 1;
387
-                for ($n = 0; $n < $numParams; $n++) {
387
+                for ($n = 0; $n<$numParams; $n++) {
388 388
                     if (is_object($in)) {
389 389
                         $p = $in->getParam($n);
390 390
                         if ($p->kindOf() == 'scalar') {
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
                     }
398 398
 
399 399
                     // param index is $n+1, as first member of sig is return type
400
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
400
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
401 401
                         $itsOK = 0;
402
-                        $pno = $n + 1;
403
-                        $wanted = $curSig[$n + 1];
402
+                        $pno = $n+1;
403
+                        $wanted = $curSig[$n+1];
404 404
                         $got = $pt;
405 405
                         break;
406 406
                     }
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
         // check if $_SERVER is populated: it might have been disabled via ini file
428 428
         // (this is true even when in CLI mode)
429 429
         if (count($_SERVER) == 0) {
430
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
430
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
431 431
         }
432 432
 
433
-        if ($this->debug > 1) {
433
+        if ($this->debug>1) {
434 434
             if (function_exists('getallheaders')) {
435 435
                 $this->debugmsg(''); // empty line
436 436
                 foreach (getallheaders() as $name => $val) {
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
456 456
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
457 457
                         $data = $degzdata;
458
-                        if ($this->debug > 1) {
459
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
458
+                        if ($this->debug>1) {
459
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
460 460
                         }
461 461
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
462 462
                         $data = $degzdata;
463
-                        if ($this->debug > 1) {
464
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
463
+                        if ($this->debug>1) {
464
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
465 465
                         }
466 466
                     } else {
467 467
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
                     if ($reqEncoding == 'ISO-8859-1') {
549 549
                         $data = utf8_encode($data);
550 550
                     } else {
551
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
551
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
552 552
                     }
553 553
                 }
554 554
             }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
576 576
             return new Response(
577 577
                 0,
578
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
578
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
579 579
                 $xmlRpcParser->_xh['isf_reason']);
580 580
         } elseif ($xmlRpcParser->_xh['isf']) {
581 581
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc vs.
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             return new Response(
584 584
                 0,
585 585
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
586
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
586
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
587 587
         } else {
588 588
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
589 589
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -593,20 +593,20 @@  discard block
 block discarded – undo
593 593
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
594 594
                 )
595 595
             ) {
596
-                if ($this->debug > 1) {
597
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
596
+                if ($this->debug>1) {
597
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
598 598
                 }
599 599
 
600 600
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
601 601
             } else {
602 602
                 // build a Request object with data parsed from xml and add parameters in
603 603
                 $req = new Request($xmlRpcParser->_xh['method']);
604
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
604
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
605 605
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
606 606
                 }
607 607
 
608
-                if ($this->debug > 1) {
609
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
608
+                if ($this->debug>1) {
609
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
610 610
                 }
611 611
 
612 612
                 return $this->execute($req);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                 return new Response(
659 659
                     0,
660 660
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
661
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
661
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
662 662
                 );
663 663
             }
664 664
         }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         // build string representation of function 'name'
674 674
         if (is_array($func)) {
675 675
             if (is_object($func[0])) {
676
-                $funcName = get_class($func[0]) . '->' . $func[1];
676
+                $funcName = get_class($func[0]).'->'.$func[1];
677 677
             } else {
678 678
                 $funcName = implode('::', $func);
679 679
             }
@@ -685,17 +685,17 @@  discard block
 block discarded – undo
685 685
 
686 686
         // verify that function to be invoked is in fact callable
687 687
         if (!is_callable($func)) {
688
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
688
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
689 689
             return new Response(
690 690
                 0,
691 691
                 PhpXmlRpc::$xmlrpcerr['server_error'],
692
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
692
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
693 693
             );
694 694
         }
695 695
 
696 696
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
697 697
         // as part of response
698
-        if ($this->debug > 2) {
698
+        if ($this->debug>2) {
699 699
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
700 700
         }
701 701
 
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
                     $r = call_user_func($func, $req);
710 710
                 }
711 711
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
712
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
712
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
713 713
                     if (is_a($r, 'PhpXmlRpc\Value')) {
714 714
                         $r = new Response($r);
715 715
                     } else {
716 716
                         $r = new Response(
717 717
                             0,
718 718
                             PhpXmlRpc::$xmlrpcerr['server_error'],
719
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
719
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
720 720
                         );
721 721
                     }
722 722
                 }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
732 732
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
733 733
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
734
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
734
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
735 735
                         } else {
736 736
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
737 737
                             // return type correctly
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             // proper error-response
756 756
             switch ($this->exception_handling) {
757 757
                 case 2:
758
-                    if ($this->debug > 2) {
758
+                    if ($this->debug>2) {
759 759
                         if (self::$_xmlrpcs_prev_ehandler) {
760 760
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
761 761
                         } else {
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
             // proper error-response
779 779
             switch ($this->exception_handling) {
780 780
                 case 2:
781
-                    if ($this->debug > 2) {
781
+                    if ($this->debug>2) {
782 782
                         if (self::$_xmlrpcs_prev_ehandler) {
783 783
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
784 784
                         } else {
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             }
799 799
         }
800 800
 
801
-        if ($this->debug > 2) {
801
+        if ($this->debug>2) {
802 802
             // note: restore the error handler we found before calling the user func, even if it has been changed
803 803
             // inside the func itself
804 804
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
      */
865 865
     protected function debugmsg($string)
866 866
     {
867
-        $this->debug_info .= $string . "\n";
867
+        $this->debug_info .= $string."\n";
868 868
     }
869 869
 
870 870
     /**
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
     protected function xml_header($charsetEncoding = '')
875 875
     {
876 876
         if ($charsetEncoding != '') {
877
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
877
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
878 878
         } else {
879
-            return "<?xml version=\"1.0\"?" . ">\n";
879
+            return "<?xml version=\"1.0\"?".">\n";
880 880
         }
881 881
     }
882 882
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                 $i++; // for error message, we count params from 1
1170 1170
                 return static::_xmlrpcs_multicall_error(new Response(0,
1171 1171
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1172
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1172
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1173 1173
             }
1174 1174
         }
1175 1175
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
             }
1251 1251
         } else {
1252 1252
             $numCalls = count($req);
1253
-            for ($i = 0; $i < $numCalls; $i++) {
1253
+            for ($i = 0; $i<$numCalls; $i++) {
1254 1254
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1255 1255
             }
1256 1256
         }
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
             // q: can php be built without ctype? should we use a regexp?
186 186
             if (is_string($key) && !ctype_digit($key)) {
187 187
                 /// @todo on invalid options, throw/error-out instead of logging an error message?
188
-                switch($key) {
188
+                switch ($key) {
189 189
                     case 'target_charset':
190 190
                         if (function_exists('mb_convert_encoding')) {
191 191
                             $this->current_parsing_options['target_charset'] = $val;
192 192
                         } else {
193
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
193
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
194 194
                         }
195 195
                         break;
196 196
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                         if (is_callable($val)) {
199 199
                             $this->current_parsing_options['methodname_callback'] = $val;
200 200
                         } else {
201
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
201
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
202 202
                         }
203 203
                         break;
204 204
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                         break;
210 210
 
211 211
                     default:
212
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
212
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key");
213 213
                 }
214 214
                 unset($mergedOptions[$key]);
215 215
             }
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
 
256 256
         try {
257 257
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
258
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
258
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
259 259
                 $chunk = substr($data, $offset, $this->maxChunkLength);
260 260
                 // error handling: xml not well formed
261
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
261
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
262 262
                     $errCode = xml_get_error_code($parser);
263 263
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
264 264
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     break;
269 269
                 }
270 270
                 // no need to parse further if we already have a fatal error
271
-                if ($this->_xh['isf'] >= 2) {
271
+                if ($this->_xh['isf']>=2) {
272 272
                     break;
273 273
                 }
274 274
             }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
302 302
     {
303 303
         // if invalid xml-rpc already detected, skip all processing
304
-        if ($this->_xh['isf'] >= 2) {
304
+        if ($this->_xh['isf']>=2) {
305 305
             return;
306 306
         }
307 307
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                 $this->_xh['rt'] = strtolower($name);
326 326
             } else {
327 327
                 $this->_xh['isf'] = 2;
328
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
328
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
329 329
 
330 330
                 return;
331 331
             }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
             case 'MEMBER':
429 429
                 // set member name to null, in case we do not find in the xml later on
430
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
430
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
431 431
                 //$this->_xh['ac']='';
432 432
                 // Drop trough intentionally
433 433
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      */
508 508
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
509 509
     {
510
-        if ($this->_xh['isf'] >= 2) {
510
+        if ($this->_xh['isf']>=2) {
511 511
             return;
512 512
         }
513 513
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
530 530
                 }
531 531
 
532
-                if ($rebuildXmlrpcvals > 0) {
532
+                if ($rebuildXmlrpcvals>0) {
533 533
                     // build the xml-rpc val out of the data received, and substitute it
534 534
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
535 535
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -537,15 +537,15 @@  discard block
 block discarded – undo
537 537
                         $temp->_php_class = $this->_xh['php_class'];
538 538
                     }
539 539
                     $this->_xh['value'] = $temp;
540
-                } elseif ($rebuildXmlrpcvals < 0) {
540
+                } elseif ($rebuildXmlrpcvals<0) {
541 541
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
542
-                        $this->_xh['value'] = (object)array(
542
+                        $this->_xh['value'] = (object) array(
543 543
                             'xmlrpc_type' => 'datetime',
544 544
                             'scalar' => $this->_xh['value'],
545 545
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
546 546
                         );
547 547
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
548
-                        $this->_xh['value'] = (object)array(
548
+                        $this->_xh['value'] = (object) array(
549 549
                             'xmlrpc_type' => 'base64',
550 550
                             'scalar' => $this->_xh['value']
551 551
                         );
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
                 // check if we are inside an array or struct:
561 561
                 // if value just built is inside an array, let's move it into array on the stack
562 562
                 $vscount = count($this->_xh['valuestack']);
563
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
564
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
563
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
564
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
565 565
                 }
566 566
                 break;
567 567
 
@@ -590,10 +590,10 @@  discard block
 block discarded – undo
590 590
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
591 591
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
592 592
                             $this->_xh['isf'] = 2;
593
-                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->truncateValueForLog($this->_xh['ac']);
593
+                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateValueForLog($this->_xh['ac']);
594 594
                             return;
595 595
                         } else {
596
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' .
596
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.
597 597
                                 $this->truncateValueForLog($this->_xh['ac']));
598 598
                         }
599 599
                     }
@@ -615,17 +615,17 @@  discard block
 block discarded – undo
615 615
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
616 616
                     {
617 617
                         $this->_xh['isf'] = 2;
618
-                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->truncateValueForLog($this->_xh['ac']);
618
+                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateValueForLog($this->_xh['ac']);
619 619
                         return;
620 620
                     } else {
621
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' .
621
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.
622 622
                             $this->truncateValueForLog($this->_xh['ac']));
623 623
                     }
624 624
                     /// @todo: find a better way of reporting an error value than this! Use NaN?
625 625
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
626 626
                 } else {
627 627
                     // it's ok, add it on
628
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
628
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
629 629
                 }
630 630
                 break;
631 631
 
@@ -635,18 +635,18 @@  discard block
 block discarded – undo
635 635
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
636 636
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
637 637
                         $this->_xh['isf'] = 2;
638
-                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' .
638
+                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.
639 639
                             $this->truncateValueForLog($this->_xh['ac']);
640 640
                         return;
641 641
                     } else {
642
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' .
642
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.
643 643
                             $this->truncateValueForLog($this->_xh['ac']));
644 644
                     }
645 645
 
646 646
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
647 647
                 } else {
648 648
                     // it's ok, add it on
649
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
649
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
650 650
                 }
651 651
                 break;
652 652
 
@@ -656,19 +656,19 @@  discard block
 block discarded – undo
656 656
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
657 657
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
658 658
                         $this->_xh['isf'] = 2;
659
-                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->truncateValueForLog($this->_xh['ac']);
659
+                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateValueForLog($this->_xh['ac']);
660 660
                         return;
661 661
                     } else {
662
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' .
662
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.
663 663
                             $this->truncateValueForLog($this->_xh['ac']));
664 664
                     }
665 665
                 }
666 666
                 if ($this->current_parsing_options['xmlrpc_return_datetimes']) {
667 667
                     try {
668 668
                         $this->_xh['value'] = new \DateTime($this->_xh['ac']);
669
-                    } catch(\Exception $e) {
669
+                    } catch (\Exception $e) {
670 670
                         // q: what to do? we can not guarantee that a valid date can be created. Return null or throw?
671
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage());
671
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': '.$e->getMessage());
672 672
                         $this->_xh['value'] = null;
673 673
                     }
674 674
                 } else {
@@ -683,14 +683,14 @@  discard block
 block discarded – undo
683 683
                     $v = base64_decode($this->_xh['ac'], true);
684 684
                     if ($v === false) {
685 685
                         $this->_xh['isf'] = 2;
686
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']);
686
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']);
687 687
                         return;
688 688
                     }
689 689
                 } else {
690 690
                     $v = base64_decode($this->_xh['ac']);
691 691
                     if ($v === '' && $this->_xh['ac'] !== '') {
692 692
                         // only the empty string should decode to the empty string
693
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
693
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
694 694
                             $this->truncateValueForLog($this->_xh['ac']));
695 695
                     }
696 696
                 }
@@ -698,31 +698,31 @@  discard block
 block discarded – undo
698 698
                 break;
699 699
 
700 700
             case 'NAME':
701
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
701
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
702 702
                 break;
703 703
 
704 704
             case 'MEMBER':
705 705
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
706 706
                 if ($this->_xh['vt']) {
707 707
                     $vscount = count($this->_xh['valuestack']);
708
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
708
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
709 709
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
710 710
                             $this->_xh['isf'] = 2;
711 711
                             $this->_xh['isf_reason'] = 'Missing NAME inside STRUCT in received xml';
712 712
                             return;
713 713
                         } else {
714
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml');
714
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml');
715 715
                         }
716
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
716
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
717 717
                     }
718
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
718
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
719 719
                 } else {
720 720
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
721 721
                         $this->_xh['isf'] = 2;
722 722
                         $this->_xh['isf_reason'] = 'Missing VALUE inside STRUCT in received xml';
723 723
                         return;
724 724
                     } else {
725
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
725
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
726 726
                     }
727 727
                 }
728 728
                 break;
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                         $this->_xh['isf_reason'] = 'Missing VALUE inside PARAM in received xml';
755 755
                         return;
756 756
                     } else {
757
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
757
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml');
758 758
                     }
759 759
                 }
760 760
                 break;
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
                 if (!preg_match(PhpXmlRpc::$xmlrpc_methodname_format, $this->_xh['ac'])) {
764 764
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
765 765
                         $this->_xh['isf'] = 2;
766
-                        $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '. $this->truncateValueForLog($this->_xh['ac']);
766
+                        $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateValueForLog($this->_xh['ac']);
767 767
                         return;
768 768
                     } else {
769
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in METHODNAME: '.
769
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in METHODNAME: '.
770 770
                             $this->truncateValueForLog($this->_xh['ac']));
771 771
                     }
772 772
                 }
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
     public function xmlrpc_cd($parser, $data)
844 844
     {
845 845
         // skip processing if xml fault already detected
846
-        if ($this->_xh['isf'] >= 2) {
846
+        if ($this->_xh['isf']>=2) {
847 847
             return;
848 848
         }
849 849
 
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
     public function xmlrpc_dh($parser, $data)
866 866
     {
867 867
         // skip processing if xml fault already detected
868
-        if ($this->_xh['isf'] >= 2) {
868
+        if ($this->_xh['isf']>=2) {
869 869
             return;
870 870
         }
871 871
 
@@ -939,8 +939,8 @@  discard block
 block discarded – undo
939 939
         // Details:
940 940
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
941 941
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
942
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
943
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
942
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
943
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
944 944
             $xmlChunk, $matches)) {
945 945
             return strtoupper(substr($matches[2], 1, -1));
946 946
         }
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
959 959
             // IANA also likes better US-ASCII, so go with it
960 960
             if ($enc == 'ASCII') {
961
-                $enc = 'US-' . $enc;
961
+                $enc = 'US-'.$enc;
962 962
             }
963 963
 
964 964
             return $enc;
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
         // Details:
996 996
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
997 997
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
998
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
999
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
998
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
999
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
1000 1000
             $xmlChunk)) {
1001 1001
             return true;
1002 1002
         }
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
      */
1012 1012
     protected function truncateValueForLog($data)
1013 1013
     {
1014
-        if (strlen($data) > $this->maxLogValueLength) {
1015
-            return substr($data, 0, $this->maxLogValueLength - 3) . '...';
1014
+        if (strlen($data)>$this->maxLogValueLength) {
1015
+            return substr($data, 0, $this->maxLogValueLength-3).'...';
1016 1016
         }
1017 1017
 
1018 1018
         return $data;
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                 break;
1032 1032
             default:
1033 1033
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1034
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1034
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1035 1035
         }
1036 1036
     }
1037 1037
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
                 break;
1057 1057
             default:
1058 1058
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1059
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1059
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1060 1060
         }
1061 1061
     }
1062 1062
 }
Please login to merge, or discard this patch.
tests/04ParsingTest.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpcs.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpcs.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 use PHPUnit\Runner\BaseTestRunner;
11 11
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
     {
23 23
         $this->args = argParser::getArgs();
24 24
         // hide parsing errors unless in debug mode
25
-        if ($this->args['DEBUG'] < 1)
25
+        if ($this->args['DEBUG']<1)
26 26
             ob_start();
27 27
     }
28 28
 
29 29
     protected function tear_down()
30 30
     {
31
-        if ($this->args['DEBUG'] >= 1)
31
+        if ($this->args['DEBUG']>=1)
32 32
             return;
33 33
         $out = ob_get_clean();
34 34
         $status = $this->getStatus();
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
     public function testI8()
132 132
     {
133
-        if (PHP_INT_SIZE == 4 ) {
133
+        if (PHP_INT_SIZE == 4) {
134 134
             $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode');
135 135
             return;
136 136
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
     public function testUnicodeInMemberName()
207 207
     {
208
-        $str = "G" . chr(252) . "nter, El" . chr(232) . "ne";
208
+        $str = "G".chr(252)."nter, El".chr(232)."ne";
209 209
         $v = array($str => new xmlrpcval(1));
210 210
         $r = new xmlrpcresp(new xmlrpcval($v, 'struct'));
211 211
         $r = $r->serialize();
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $response = @utf8_encode(
222 222
             '<?xml version="1.0"?>
223 223
 <!-- covers what happens when lib receives UTF8 chars in response text and comments -->
224
-<!-- ' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232; -->
224
+<!-- ' . chr(224).chr(252).chr(232).'&#224;&#252;&#232; -->
225 225
 <methodResponse>
226 226
 <fault>
227 227
 <value>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 </member>
233 233
 <member>
234 234
 <name>faultString</name>
235
-<value><string>' . chr(224) . chr(252) . chr(232) . '&#224;&#252;&#232;</string></value>
235
+<value><string>' . chr(224).chr(252).chr(232).'&#224;&#252;&#232;</string></value>
236 236
 </member>
237 237
 </struct>
238 238
 </value>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         $m = $this->newRequest('dummy');
242 242
         $r = $m->parseResponse($response);
243 243
         $v = $r->faultString();
244
-        $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v);
244
+        $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v);
245 245
     }
246 246
 
247 247
     public function testBrokenRequests()
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
         $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values;
449 449
         \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true;
450 450
 
451
-        foreach($values as $value) {
452
-            $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> ';
451
+        foreach ($values as $value) {
452
+            $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> ';
453 453
             $r = $s->parseResponse($f);
454 454
             $v = $r->faultCode();
455 455
             $this->assertEquals(2, $v, "Testing $value");
@@ -553,11 +553,11 @@  discard block
 block discarded – undo
553 553
 
554 554
     public function testUTF8Response()
555 555
     {
556
-        $string = chr(224) . chr(252) . chr(232);
556
+        $string = chr(224).chr(252).chr(232);
557 557
 
558 558
         $s = $this->newRequest('dummy');
559
-        $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>
560
-<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>
559
+        $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>
560
+<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>
561 561
 ';
562 562
         $r = $s->parseResponse($f, false, 'phpvals');
563 563
         $v = $r->value();
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         $this->assertEquals($string, $v);
566 566
 
567 567
         $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
568
-<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>
568
+<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>
569 569
 ';
570 570
         $r = $s->parseResponse($f, false, 'phpvals');
571 571
         $v = $r->value();
@@ -581,11 +581,11 @@  discard block
 block discarded – undo
581 581
 
582 582
     public function testLatin1Response()
583 583
     {
584
-        $string = chr(224) . chr(252) . chr(232);
584
+        $string = chr(224).chr(252).chr(232);
585 585
 
586 586
         $s = $this->newRequest('dummy');
587
-        $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>
588
-<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>
587
+        $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>
588
+<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>
589 589
 ';
590 590
         $r = $s->parseResponse($f, false, 'phpvals');
591 591
         $v = $r->value();
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         $this->assertEquals($string, $v);
594 594
 
595 595
         $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member>
596
-<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>
596
+<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>
597 597
 ';
598 598
         $r = $s->parseResponse($f, false, 'phpvals');
599 599
         $v = $r->value();
Please login to merge, or discard this patch.
tests/05LoggerTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/PolyfillTestCase.php';
3
+include_once __DIR__.'/PolyfillTestCase.php';
4 4
 
5 5
 use PhpXmlRpc\Helper\Charset;
6 6
 use PhpXmlRpc\Helper\Http;
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         $l = $h->getLogger();
39 39
         Http::setLogger($this);
40 40
 
41
-        $s = "HTTP/1.0 200 OK\r\n" .
42
-            "Content-Type: unknown\r\n" .
43
-            "\r\n" .
41
+        $s = "HTTP/1.0 200 OK\r\n".
42
+            "Content-Type: unknown\r\n".
43
+            "\r\n".
44 44
             "body";
45 45
         ob_start();
46 46
         $h->parseResponseHeaders($s, false, 1);
Please login to merge, or discard this patch.
tests/03MessagesTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpcs.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpcs.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 use PHPUnit\Runner\BaseTestRunner;
11 11
 
Please login to merge, or discard this patch.
src/Response.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                 // user declares the type of resp value: we "almost" trust it... but log errors just in case
74 74
                 if (($this->valtyp == 'xmlrpcvals' && (!is_a($this->val, 'PhpXmlRpc\Value'))) ||
75 75
                     ($this->valtyp == 'xml' && (!is_string($this->val)))) {
76
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in does not match type ' . $valType);
76
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in does not match type '.$valType);
77 77
                 }
78 78
             }
79 79
         }
@@ -152,33 +152,33 @@  discard block
 block discarded – undo
152 152
     public function serialize($charsetEncoding = '')
153 153
     {
154 154
         if ($charsetEncoding != '') {
155
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
155
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
156 156
         } else {
157 157
             $this->content_type = 'text/xml';
158 158
         }
159 159
         if (PhpXmlRpc::$xmlrpc_null_apache_encoding) {
160
-            $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n";
160
+            $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n";
161 161
         } else {
162 162
             $result = "<methodResponse>\n";
163 163
         }
164 164
         if ($this->errno) {
165 165
             // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars
166
-            $result .= "<fault>\n" .
167
-                "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
168
-                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
169
-                $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) .
166
+            $result .= "<fault>\n".
167
+                "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno.
168
+                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>".
169
+                $this->getCharsetEncoder()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding).
170 170
                 "</string></value>\n</member>\n</struct>\n</value>\n</fault>";
171 171
         } else {
172 172
             if (is_object($this->val) && is_a($this->val, 'PhpXmlRpc\Value')) {
173
-                $result .= "<params>\n<param>\n" . $this->val->serialize($charsetEncoding) . "</param>\n</params>";
173
+                $result .= "<params>\n<param>\n".$this->val->serialize($charsetEncoding)."</param>\n</params>";
174 174
             } else if (is_string($this->val) && $this->valtyp == 'xml') {
175
-                $result .= "<params>\n<param>\n" .
176
-                    $this->val .
175
+                $result .= "<params>\n<param>\n".
176
+                    $this->val.
177 177
                     "</param>\n</params>";
178 178
             } else if ($this->valtyp == 'phpvals') {
179 179
                     $encoder = new Encoder();
180 180
                     $val = $encoder->encode($this->val);
181
-                    $result .= "<params>\n<param>\n" . $val->serialize($charsetEncoding) . "</param>\n</params>";
181
+                    $result .= "<params>\n<param>\n".$val->serialize($charsetEncoding)."</param>\n</params>";
182 182
             } else {
183 183
                 throw new StateErrorException('cannot serialize xmlrpc response objects whose content is native php values');
184 184
             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 return $this->httpResponse['raw_data'];
205 205
             default:
206 206
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
207
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
207
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
208 208
                 return null;
209 209
         }
210 210
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 break;
226 226
             default:
227 227
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
228
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
228
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
229 229
         }
230 230
     }
231 231
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                 break;
260 260
             default:
261 261
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
262
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
262
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
263 263
         }
264 264
     }
265 265
 }
Please login to merge, or discard this patch.
src/Helper/Charset.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
                 if (count($this->xml_iso88591_Entities['in'])) {
77 77
                     return;
78 78
                 }
79
-                for ($i = 0; $i < 32; $i++) {
79
+                for ($i = 0; $i<32; $i++) {
80 80
                     $this->xml_iso88591_Entities["in"][] = chr($i);
81 81
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
82 82
                 }
83 83
 
84 84
                 /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
85 85
 
86
-                for ($i = 160; $i < 256; $i++) {
86
+                for ($i = 160; $i<256; $i++) {
87 87
                     $this->xml_iso88591_Entities["in"][] = chr($i);
88 88
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
89 89
                 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 break;*/
112 112
 
113 113
             default:
114
-                throw new ValueErrorException('Unsupported table: ' . $tableName);
114
+                throw new ValueErrorException('Unsupported table: '.$tableName);
115 115
         }
116 116
     }
117 117
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $srcEncoding = 'UTF-8';
164 164
         }
165 165
 
166
-        $conversion = strtoupper($srcEncoding . '_' . $destEncoding);
166
+        $conversion = strtoupper($srcEncoding.'_'.$destEncoding);
167 167
 
168 168
         // list ordered with (expected) most common scenarios first
169 169
         switch ($conversion) {
@@ -181,20 +181,20 @@  discard block
 block discarded – undo
181 181
                 // NB: this will choke on invalid UTF-8, going most likely beyond EOF
182 182
                 $escapedData = '';
183 183
                 // be kind to users creating string xml-rpc values out of different php types
184
-                $data = (string)$data;
184
+                $data = (string) $data;
185 185
                 $ns = strlen($data);
186
-                for ($nn = 0; $nn < $ns; $nn++) {
186
+                for ($nn = 0; $nn<$ns; $nn++) {
187 187
                     $ch = $data[$nn];
188 188
                     $ii = ord($ch);
189 189
                     // 7 bits in 1 byte: 0bbbbbbb (127)
190
-                    if ($ii < 32) {
190
+                    if ($ii<32) {
191 191
                         if ($conversion == 'UTF-8_US-ASCII') {
192 192
                             $escapedData .= sprintf('&#%d;', $ii);
193 193
                         } else {
194 194
                             $escapedData .= $ch;
195 195
                         }
196 196
                     }
197
-                    else if ($ii < 128) {
197
+                    else if ($ii<128) {
198 198
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
199 199
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
200 200
                         switch ($ii) {
@@ -219,25 +219,25 @@  discard block
 block discarded – undo
219 219
                     } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047)
220 220
                     elseif ($ii >> 5 == 6) {
221 221
                         $b1 = ($ii & 31);
222
-                        $b2 = (ord($data[$nn + 1]) & 63);
223
-                        $ii = ($b1 * 64) + $b2;
222
+                        $b2 = (ord($data[$nn+1]) & 63);
223
+                        $ii = ($b1 * 64)+$b2;
224 224
                         $escapedData .= sprintf('&#%d;', $ii);
225 225
                         $nn += 1;
226 226
                     } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb
227 227
                     elseif ($ii >> 4 == 14) {
228 228
                         $b1 = ($ii & 15);
229
-                        $b2 = (ord($data[$nn + 1]) & 63);
230
-                        $b3 = (ord($data[$nn + 2]) & 63);
231
-                        $ii = ((($b1 * 64) + $b2) * 64) + $b3;
229
+                        $b2 = (ord($data[$nn+1]) & 63);
230
+                        $b3 = (ord($data[$nn+2]) & 63);
231
+                        $ii = ((($b1 * 64)+$b2) * 64)+$b3;
232 232
                         $escapedData .= sprintf('&#%d;', $ii);
233 233
                         $nn += 2;
234 234
                     } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
235 235
                     elseif ($ii >> 3 == 30) {
236 236
                         $b1 = ($ii & 7);
237
-                        $b2 = (ord($data[$nn + 1]) & 63);
238
-                        $b3 = (ord($data[$nn + 2]) & 63);
239
-                        $b4 = (ord($data[$nn + 3]) & 63);
240
-                        $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
237
+                        $b2 = (ord($data[$nn+1]) & 63);
238
+                        $b3 = (ord($data[$nn+2]) & 63);
239
+                        $b4 = (ord($data[$nn+3]) & 63);
240
+                        $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4;
241 241
                         $escapedData .= sprintf('&#%d;', $ii);
242 242
                         $nn += 3;
243 243
                     }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                     // If src is UTF8, we run htmlspecialchars before converting to the target charset, as
291 291
                     // htmlspecialchars has limited charset support, but it groks utf8
292 292
                     if ($srcEncoding === 'UTF-8') {
293
-                        $data = htmlspecialchars($data,  defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
293
+                        $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
294 294
                     }
295 295
                     if ($srcEncoding !== $destEncoding) {
296 296
                         try {
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                     }
303 303
                     if ($data === false) {
304 304
                         $escapedData = '';
305
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
305
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
306 306
                     } else {
307 307
                         if ($srcEncoding === 'UTF-8') {
308 308
                             $escapedData = $data;
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     }
313 313
                 } else {
314 314
                     $escapedData = '';
315
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported...");
315
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported...");
316 316
                 }
317 317
         }
318 318
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
         if (function_exists('mb_list_encodings')) {
331 331
             $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array(
332 332
                 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable',
333
-                '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
333
+                '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
334 334
             ))));
335 335
         }
336 336
         return $knownCharsets;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             case 'iso88591':
385 385
                 return $this->xml_iso88591_Entities;
386 386
             default:
387
-                throw new ValueErrorException('Unsupported charset: ' . $charset);
387
+                throw new ValueErrorException('Unsupported charset: '.$charset);
388 388
         }
389 389
     }
390 390
 }
Please login to merge, or discard this patch.
src/Wrapper.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
             $callable = explode('::', $callable);
175 175
         }
176 176
         if (is_array($callable)) {
177
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
178
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
177
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
178
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
179 179
                 return false;
180 180
             }
181 181
             if (is_string($callable[0])) {
182 182
                 $plainFuncName = implode('::', $callable);
183 183
             } elseif (is_object($callable[0])) {
184
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
184
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
185 185
             }
186 186
             $exists = method_exists($callable[0], $callable[1]);
187 187
         } else if ($callable instanceof \Closure) {
188 188
             // we do not support creating code which wraps closures, as php does not allow to serialize them
189 189
             if (!$buildIt) {
190
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
190
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
191 191
                 return false;
192 192
             }
193 193
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
         if (!$exists) {
202
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
202
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
203 203
             return false;
204 204
         }
205 205
 
@@ -243,23 +243,23 @@  discard block
 block discarded – undo
243 243
         if (is_array($callable)) {
244 244
             $func = new \ReflectionMethod($callable[0], $callable[1]);
245 245
             if ($func->isPrivate()) {
246
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
246
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
247 247
                 return false;
248 248
             }
249 249
             if ($func->isProtected()) {
250
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
250
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
251 251
                 return false;
252 252
             }
253 253
             if ($func->isConstructor()) {
254
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
254
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
255 255
                 return false;
256 256
             }
257 257
             if ($func->isDestructor()) {
258
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
258
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
259 259
                 return false;
260 260
             }
261 261
             if ($func->isAbstract()) {
262
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
262
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
263 263
                 return false;
264 264
             }
265 265
             /// @todo add more checks for static vs. nonstatic?
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         if ($func->isInternal()) {
270 270
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
271 271
             ///       reflect internal php functions
272
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
272
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
273 273
             return false;
274 274
         }
275 275
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $i = 0;
322 322
         foreach ($func->getParameters() as $paramObj) {
323 323
             $params[$i] = array();
324
-            $params[$i]['name'] = '$' . $paramObj->getName();
324
+            $params[$i]['name'] = '$'.$paramObj->getName();
325 325
             $params[$i]['isoptional'] = $paramObj->isOptional();
326 326
             $i++;
327 327
         }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             // build a signature
386 386
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
387 387
             $pSig = array($funcDesc['returnsDocs']);
388
-            for ($i = 0; $i < count($pars); $i++) {
388
+            for ($i = 0; $i<count($pars); $i++) {
389 389
                 $name = strtolower($funcDesc['params'][$i]['name']);
390 390
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
391 391
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                 }
442 442
             }
443 443
             $numPars = $req->getNumParams();
444
-            if ($numPars < $minPars || $numPars > $maxPars) {
444
+            if ($numPars<$minPars || $numPars>$maxPars) {
445 445
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
446 446
             }
447 447
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
             $result = call_user_func_array($callable, $params);
456 456
 
457
-            if (! is_a($result, $responseClass)) {
457
+            if (!is_a($result, $responseClass)) {
458 458
                 // q: why not do the same for int, float, bool, string?
459 459
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
460 460
                     $result = new $valueClass($result, $funcDesc['returns']);
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
         if ($newFuncName == '') {
494 494
             if (is_array($callable)) {
495 495
                 if (is_string($callable[0])) {
496
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
496
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
497 497
                 } else {
498
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
498
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
499 499
                 }
500 500
             } else {
501 501
                 if ($callable instanceof \Closure) {
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
      */
528 528
     protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc)
529 529
     {
530
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
531
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
532
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
530
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
531
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
532
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
533 533
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
534 534
 
535 535
         $i = 0;
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
         // build body of new function
565 565
 
566 566
         $innerCode = "  \$paramCount = \$req->getNumParams();\n";
567
-        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
567
+        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
568 568
 
569
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
569
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
570 570
         if ($decodePhpObjects) {
571 571
             $innerCode .= "  \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n";
572 572
         } else {
@@ -579,23 +579,23 @@  discard block
 block discarded – undo
579 579
             static::holdObject($newFuncName, $callable[0]);
580 580
             $class = get_class($callable[0]);
581 581
             if ($class[0] !== '\\') {
582
-                $class = '\\' . $class;
582
+                $class = '\\'.$class;
583 583
             }
584 584
             $innerCode .= "  /// @var $class \$obj\n";
585 585
             $innerCode .= "  \$obj = PhpXmlRpc\\Wrapper::getHeldObject('$newFuncName');\n";
586
-            $realFuncName = '$obj->' . $callable[1];
586
+            $realFuncName = '$obj->'.$callable[1];
587 587
         } else {
588 588
             $realFuncName = $plainFuncName;
589 589
         }
590 590
         foreach ($parsVariations as $i => $pars) {
591
-            $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
592
-            if ($i < (count($parsVariations) - 1))
591
+            $innerCode .= "  if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
592
+            if ($i<(count($parsVariations)-1))
593 593
                 $innerCode .= "  else\n";
594 594
         }
595
-        $innerCode .= "  if (is_a(\$retVal, '" . static::$namespace . "Response'))\n    return \$retVal;\n  else\n";
595
+        $innerCode .= "  if (is_a(\$retVal, '".static::$namespace."Response'))\n    return \$retVal;\n  else\n";
596 596
         /// q: why not do the same for int, float, bool, string?
597 597
         if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
598
-            $innerCode .= "    return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));";
598
+            $innerCode .= "    return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));";
599 599
         } else {
600 600
             $encodeOptions = array();
601 601
             if ($encodeNulls) {
@@ -606,18 +606,18 @@  discard block
 block discarded – undo
606 606
             }
607 607
 
608 608
             if ($encodeOptions) {
609
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" .
610
-                    implode("', '", $encodeOptions) . "')));";
609
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('".
610
+                    implode("', '", $encodeOptions)."')));";
611 611
             } else {
612
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));";
612
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal));";
613 613
             }
614 614
         }
615 615
         // shall we exclude functions returning by ref?
616 616
         // if ($func->returnsReference())
617 617
         //     return false;
618 618
 
619
-        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" .
620
-            "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}";
619
+        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n".
620
+            "function $newFuncName(\$req)\n{\n".$innerCode."\n}";
621 621
 
622 622
         return $code;
623 623
     }
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
672 672
     {
673 673
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
674
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
674
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
675 675
         }
676 676
 
677 677
         if (is_object($className)) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
         } else {
680 680
             $realClassName = $className;
681 681
         }
682
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
682
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
683 683
     }
684 684
 
685 685
     /**
@@ -762,21 +762,21 @@  discard block
 block discarded – undo
762 762
      */
763 763
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
764 764
     {
765
-        $reqClass = static::$namespace . 'Request';
766
-        $valClass = static::$namespace . 'Value';
767
-        $decoderClass = static::$namespace . 'Encoder';
765
+        $reqClass = static::$namespace.'Request';
766
+        $valClass = static::$namespace.'Value';
767
+        $decoderClass = static::$namespace.'Encoder';
768 768
 
769 769
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
770
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
770
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
771 771
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
772
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
772
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
773 773
 
774 774
         $req = new $reqClass('system.methodSignature');
775 775
         $req->addparam(new $valClass($methodName));
776 776
         $client->setDebug($debug);
777 777
         $response = $client->send($req, $timeout, $protocol);
778 778
         if ($response->faultCode()) {
779
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
779
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
780 780
             return false;
781 781
         }
782 782
 
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
             $mSig = $decoder->decode($mSig);
788 788
         }
789 789
 
790
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
791
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
790
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
791
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
792 792
             return false;
793 793
         }
794 794
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
      */
804 804
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
805 805
     {
806
-        $reqClass = static::$namespace . 'Request';
807
-        $valClass = static::$namespace . 'Value';
806
+        $reqClass = static::$namespace.'Request';
807
+        $valClass = static::$namespace.'Value';
808 808
 
809 809
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
810
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
810
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
811 811
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
812 812
 
813 813
         $mDesc = '';
@@ -841,11 +841,11 @@  discard block
 block discarded – undo
841 841
         $clientClone = clone $client;
842 842
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
843 843
         {
844
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
844
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
845 845
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
846
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
847
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
848
-            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
846
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
847
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
848
+            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
849 849
             $throwFault = false;
850 850
             $decodeFault = false;
851 851
             $faultResponse = null;
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
                 $faultResponse = $extraOptions['return_on_fault'];
857 857
             }
858 858
 
859
-            $reqClass = static::$namespace . 'Request';
860
-            $encoderClass = static::$namespace . 'Encoder';
861
-            $valueClass = static::$namespace . 'Value';
859
+            $reqClass = static::$namespace.'Request';
860
+            $encoderClass = static::$namespace.'Encoder';
861
+            $valueClass = static::$namespace.'Value';
862 862
 
863 863
             $encoder = new $encoderClass();
864 864
             $encodeOptions = array();
@@ -940,14 +940,14 @@  discard block
 block discarded – undo
940 940
      * @param string $mDesc
941 941
      * @return string[] keys: source, docstring
942 942
      */
943
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
943
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
944 944
     {
945
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
945
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
946 946
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
947
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
948
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
949
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
950
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
947
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
948
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
949
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
950
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
951 951
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
952 952
         $throwFault = false;
953 953
         $decodeFault = false;
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
         }
961 961
 
962 962
         $code = "function $newFuncName(";
963
-        if ($clientCopyMode < 2) {
963
+        if ($clientCopyMode<2) {
964 964
             // client copy mode 0 or 1 == full / partial client copy in emitted code
965 965
             $verbatimClientCopy = !$clientCopyMode;
966
-            $innerCode = '  ' . str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
966
+            $innerCode = '  '.str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
967 967
             $innerCode .= "\$client->setDebug(\$debug);\n";
968 968
             $this_ = '';
969 969
         } else {
@@ -971,28 +971,28 @@  discard block
 block discarded – undo
971 971
             $innerCode = '';
972 972
             $this_ = 'this->';
973 973
         }
974
-        $innerCode .= "  \$req = new " . static::$namespace . "Request('$methodName');\n";
974
+        $innerCode .= "  \$req = new ".static::$namespace."Request('$methodName');\n";
975 975
 
976 976
         if ($mDesc != '') {
977 977
             // take care that PHP comment is not terminated unwillingly by method description
978 978
             /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags...
979
-            $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n";
979
+            $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n";
980 980
         } else {
981 981
             $mDesc = "/**\n * Function $newFuncName.\n";
982 982
         }
983 983
 
984 984
         // param parsing
985
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
985
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
986 986
         $plist = array();
987 987
         $pCount = count($mSig);
988
-        for ($i = 1; $i < $pCount; $i++) {
988
+        for ($i = 1; $i<$pCount; $i++) {
989 989
             $plist[] = "\$p$i";
990 990
             $pType = $mSig[$i];
991 991
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
992 992
                 $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null'
993 993
             ) {
994 994
                 // only build directly xml-rpc values when type is known and scalar
995
-                $innerCode .= "  \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n";
995
+                $innerCode .= "  \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n";
996 996
             } else {
997 997
                 if ($encodePhpObjects || $encodeNulls) {
998 998
                     $encOpts = array();
@@ -1003,26 +1003,26 @@  discard block
 block discarded – undo
1003 1003
                         $encOpts[] = 'null_extension';
1004 1004
                     }
1005 1005
 
1006
-                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n";
1006
+                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n";
1007 1007
                 } else {
1008 1008
                     $innerCode .= "  \$p$i = \$encoder->encode(\$p$i);\n";
1009 1009
                 }
1010 1010
             }
1011 1011
             $innerCode .= "  \$req->addparam(\$p$i);\n";
1012
-            $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
1012
+            $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n";
1013 1013
         }
1014
-        if ($clientCopyMode < 2) {
1014
+        if ($clientCopyMode<2) {
1015 1015
             $plist[] = '$debug = 0';
1016 1016
             $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
1017 1017
         }
1018 1018
         $plist = implode(', ', $plist);
1019
-        $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]);
1019
+        $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]);
1020 1020
         if ($throwFault) {
1021
-            $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1021
+            $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1022 1022
         } else if ($decodeFault) {
1023
-            $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)";
1023
+            $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)";
1024 1024
         } else {
1025
-            $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)";
1025
+            $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)";
1026 1026
         }
1027 1027
         $mDesc .= "\n */\n";
1028 1028
 
@@ -1034,9 +1034,9 @@  discard block
 block discarded – undo
1034 1034
             $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())";
1035 1035
         } else if ($decodeFault) {
1036 1036
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1037
-                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1037
+                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1038 1038
             } else {
1039
-                $respCode = 'return ' . var_export($faultResponse, true);
1039
+                $respCode = 'return '.var_export($faultResponse, true);
1040 1040
             }
1041 1041
         } else {
1042 1042
             $respCode = 'return $res';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             $innerCode .= "  if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());";
1048 1048
         }
1049 1049
 
1050
-        $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n";
1050
+        $code = $code.$plist.")\n{\n".$innerCode."\n}\n";
1051 1051
 
1052 1052
         return array('source' => $code, 'docstring' => $mDesc);
1053 1053
     }
@@ -1074,25 +1074,25 @@  discard block
 block discarded – undo
1074 1074
     public function wrapXmlrpcServer($client, $extraOptions = array())
1075 1075
     {
1076 1076
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1077
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1077
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1078 1078
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1079 1079
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1080
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
1081
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1082
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1080
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
1081
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1082
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1083 1083
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1084
-        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false;
1084
+        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false;
1085 1085
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1086 1086
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1087 1087
 
1088
-        $reqClass = static::$namespace . 'Request';
1089
-        $decoderClass = static::$namespace . 'Encoder';
1088
+        $reqClass = static::$namespace.'Request';
1089
+        $decoderClass = static::$namespace.'Encoder';
1090 1090
 
1091 1091
         // retrieve the list of methods
1092 1092
         $req = new $reqClass('system.listMethods');
1093 1093
         $response = $client->send($req, $timeout, $protocol);
1094 1094
         if ($response->faultCode()) {
1095
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1095
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1096 1096
 
1097 1097
             return false;
1098 1098
         }
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             $mList = $decoder->decode($mList);
1104 1104
         }
1105 1105
         if (!is_array($mList) || !count($mList)) {
1106
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1106
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1107 1107
 
1108 1108
             return false;
1109 1109
         }
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
         if ($newClassName != '') {
1113 1113
             $xmlrpcClassName = $newClassName;
1114 1114
         } else {
1115
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1116
-                    array('_', ''), $client->server) . '_client';
1115
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1116
+                    array('_', ''), $client->server).'_client';
1117 1117
         }
1118 1118
         while ($buildIt && class_exists($xmlrpcClassName)) {
1119 1119
             $xmlrpcClassName .= 'x';
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
         /// @todo add method setDebug() to new class, to enable/disable debugging
1123 1123
         $source = "class $xmlrpcClassName\n{\n  public \$client;\n\n";
1124 1124
         $source .= "  function __construct()\n  {\n";
1125
-        $source .= '    ' . str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1125
+        $source .= '    '.str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1126 1126
         $source .= "\$this->client = \$client;\n  }\n\n";
1127 1127
         $opts = array(
1128 1128
             'return_source' => true,
@@ -1145,26 +1145,26 @@  discard block
 block discarded – undo
1145 1145
                 $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts);
1146 1146
                 if ($methodWrap) {
1147 1147
                     if ($buildIt) {
1148
-                        $source .= $methodWrap['source'] . "\n";
1148
+                        $source .= $methodWrap['source']."\n";
1149 1149
 
1150 1150
                     } else {
1151
-                        $source .= '  ' . str_replace("\n", "\n  ", $methodWrap['docstring']);
1152
-                        $source .= str_replace("\n", "\n  ", $methodWrap['source']). "\n";
1151
+                        $source .= '  '.str_replace("\n", "\n  ", $methodWrap['docstring']);
1152
+                        $source .= str_replace("\n", "\n  ", $methodWrap['source'])."\n";
1153 1153
                     }
1154 1154
 
1155 1155
                 } else {
1156
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1156
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1157 1157
                 }
1158 1158
             }
1159 1159
         }
1160 1160
         $source .= "}\n";
1161 1161
         if ($buildIt) {
1162 1162
             $allOK = 0;
1163
-            eval($source . '$allOK=1;');
1163
+            eval($source.'$allOK=1;');
1164 1164
             if ($allOK) {
1165 1165
                 return $xmlrpcClassName;
1166 1166
             } else {
1167
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1167
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1168 1168
                 return false;
1169 1169
             }
1170 1170
         } else {
@@ -1183,8 +1183,8 @@  discard block
 block discarded – undo
1183 1183
      */
1184 1184
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1185 1185
     {
1186
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path) .
1187
-            "', '" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server) . "', $client->port);\n";
1186
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path).
1187
+            "', '".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server)."', $client->port);\n";
1188 1188
 
1189 1189
         // copy all client fields to the client that will be generated runtime
1190 1190
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
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
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                     if ($respEncoding == 'ISO-8859-1') {
295 295
                         $data = utf8_encode($data);
296 296
                     } else {
297
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
297
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
298 298
                     }
299 299
                 }
300 300
             }
@@ -320,16 +320,16 @@  discard block
 block discarded – undo
320 320
             //    there could be proxies meddling with the request, or network data corruption...
321 321
 
322 322
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
323
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
323
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
324 324
 
325
-            if ($this->debug > 0) {
325
+            if ($this->debug>0) {
326 326
                 $this->getLogger()->debug($xmlRpcParser->_xh['isf_reason']);
327 327
             }
328 328
         }
329 329
         // second error check: xml well-formed but not xml-rpc compliant
330 330
         elseif ($xmlRpcParser->_xh['isf'] == 2) {
331 331
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
332
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
332
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
333 333
 
334 334
             /// @todo echo something for the user? check if it was already done by the parser...
335 335
             //if ($this->debug > 0) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         }
339 339
         // third error check: parsing of the response has somehow gone boink.
340 340
         /// @todo shall we omit this check, since we trust the parsing code?
341
-        elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
341
+        elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
342 342
             // something odd has happened and it's time to generate a client side error indicating something odd went on
343 343
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
344 344
                 '', $httpResponse
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
             /// @todo echo something for the user?
348 348
         } else {
349
-            if ($this->debug > 1) {
349
+            if ($this->debug>1) {
350 350
                 $this->getLogger()->debug(
351 351
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
352 352
                 );
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                 if ($errNo == 0) {
371 371
                     // FAULT returned, errno needs to reflect that
372 372
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
373
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
373
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
374 374
                     $errNo = -1;
375 375
                 }
376 376
 
Please login to merge, or discard this patch.