Passed
Push — master ( 5d18c7...8ff19d )
by Gaetano
09:55
created
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.
src/Request.php 1 patch
Spacing   +23 added lines, -23 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";
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
214 214
     {
215
-        if ($this->debug > 0) {
215
+        if ($this->debug>0) {
216 216
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
217 217
         }
218 218
 
219 219
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
220 220
 
221 221
         if ($data == '') {
222
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
222
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
223 223
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
224 224
         }
225 225
 
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
         if (substr($data, 0, 4) == 'HTTP') {
228 228
             $httpParser = new Http();
229 229
             try {
230
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
230
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
231 231
             } catch (HttpException $e) {
232 232
                 // failed processing of HTTP response headers
233 233
                 // save into response obj the full payload received, for debugging
234 234
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode()));
235
-            } catch(\Exception $e) {
235
+            } catch (\Exception $e) {
236 236
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
237 237
             }
238 238
         } else {
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
249 249
         $pos = strrpos($data, '</methodResponse>');
250 250
         if ($pos !== false) {
251
-            $data = substr($data, 0, $pos + 17);
251
+            $data = substr($data, 0, $pos+17);
252 252
         }
253 253
 
254 254
         // try to 'guestimate' the character encoding of the received response
@@ -257,21 +257,21 @@  discard block
 block discarded – undo
257 257
             $data
258 258
         );
259 259
 
260
-        if ($this->debug >= 0) {
260
+        if ($this->debug>=0) {
261 261
             $this->httpResponse = $httpResponse;
262 262
         } else {
263 263
             $httpResponse = null;
264 264
         }
265 265
 
266
-        if ($this->debug > 0) {
266
+        if ($this->debug>0) {
267 267
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
268 268
             if ($start) {
269 269
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
270 270
                 /// @todo what if there is no end tag?
271 271
                 $end = strpos($data, '-->', $start);
272
-                $comments = substr($data, $start, $end - $start);
273
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t" .
274
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
272
+                $comments = substr($data, $start, $end-$start);
273
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED) ---\n\t".
274
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
275 275
             }
276 276
         }
277 277
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
                     if ($respEncoding == 'ISO-8859-1') {
294 294
                         $data = utf8_encode($data);
295 295
                     } else {
296
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
296
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
297 297
                     }
298 298
                 }
299 299
             }
@@ -319,16 +319,16 @@  discard block
 block discarded – undo
319 319
             //    there could be proxies meddling with the request, or network data corruption...
320 320
 
321 321
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
322
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
322
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
323 323
 
324
-            if ($this->debug > 0) {
324
+            if ($this->debug>0) {
325 325
                 $this->getLogger()->debug($xmlRpcParser->_xh['isf_reason']);
326 326
             }
327 327
         }
328 328
         // second error check: xml well-formed but not xml-rpc compliant
329 329
         elseif ($xmlRpcParser->_xh['isf'] == 2) {
330 330
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
331
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
331
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$xmlRpcParser->_xh['isf_reason'], '', $httpResponse);
332 332
 
333 333
             /// @todo echo something for the user? check if it was already done by the parser...
334 334
             //if ($this->debug > 0) {
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         }
338 338
         // third error check: parsing of the response has somehow gone boink.
339 339
         /// @todo shall we omit this check, since we trust the parsing code?
340
-        elseif ($xmlRpcParser->_xh['isf'] > 3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
340
+        elseif ($xmlRpcParser->_xh['isf']>3 || $returnType == XMLParser::RETURN_XMLRPCVALS && !is_object($xmlRpcParser->_xh['value'])) {
341 341
             // something odd has happened and it's time to generate a client side error indicating something odd went on
342 342
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
343 343
                 '', $httpResponse
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 
346 346
             /// @todo echo something for the user?
347 347
         } else {
348
-            if ($this->debug > 1) {
348
+            if ($this->debug>1) {
349 349
                 $this->getLogger()->debug(
350 350
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
351 351
                 );
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                 if ($errNo == 0) {
370 370
                     // FAULT returned, errno needs to reflect that
371 371
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
372
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
372
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
373 373
                     $errNo = -1;
374 374
                 }
375 375
 
Please login to merge, or discard this patch.