Passed
Push — master ( 89b8ba...1a4249 )
by Gaetano
09:50
created
src/Helper/XMLParser.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
         foreach ($mergedOptions as $key => $val) {
192 192
             // q: can php be built without ctype? should we use a regexp?
193 193
             if (is_string($key) && !ctype_digit($key)) {
194
-                switch($key) {
194
+                switch ($key) {
195 195
                     case 'target_charset':
196 196
                         if (function_exists('mb_convert_encoding')) {
197 197
                             $this->current_parsing_options['target_charset'] = $val;
198 198
                         } else {
199
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
199
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
200 200
                         }
201 201
                         break;
202 202
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                             //$this->_xh['isf'] = 4;
208 208
                             //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable";
209 209
                             //return;
210
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
210
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
211 211
                         }
212 212
                         break;
213 213
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                         break;
219 219
 
220 220
                     default:
221
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
221
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": unsupported option: $key");
222 222
                 }
223 223
                 unset($mergedOptions[$key]);
224 224
             }
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 
265 265
         try {
266 266
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
267
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
267
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
268 268
                 $chunk = substr($data, $offset, $this->maxChunkLength);
269 269
                 // error handling: xml not well formed
270
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
270
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
271 271
                     $errCode = xml_get_error_code($parser);
272 272
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
273 273
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                     break;
278 278
                 }
279 279
                 // no need to parse further if we already have a fatal error
280
-                if ($this->_xh['isf'] >= 2) {
280
+                if ($this->_xh['isf']>=2) {
281 281
                     break;
282 282
                 }
283 283
             }
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
310 310
     {
311 311
         // if invalid xml-rpc already detected, skip all processing
312
-        if ($this->_xh['isf'] >= 2) {
312
+        if ($this->_xh['isf']>=2) {
313 313
             return;
314 314
         }
315 315
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
                 $this->_xh['rt'] = strtolower($name);
333 333
             } else {
334 334
                 $this->_xh['isf'] = 2;
335
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
335
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
336 336
 
337 337
                 return;
338 338
             }
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 
435 435
             case 'MEMBER':
436 436
                 // set member name to null, in case we do not find in the xml later on
437
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
437
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
438 438
                 //$this->_xh['ac']='';
439 439
                 // Drop trough intentionally
440 440
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      */
509 509
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
510 510
     {
511
-        if ($this->_xh['isf'] >= 2) {
511
+        if ($this->_xh['isf']>=2) {
512 512
             return;
513 513
 
514 514
         }
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
531 531
                 }
532 532
 
533
-                if ($rebuildXmlrpcvals > 0) {
533
+                if ($rebuildXmlrpcvals>0) {
534 534
                     // build the xml-rpc val out of the data received, and substitute it
535 535
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
536 536
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -538,15 +538,15 @@  discard block
 block discarded – undo
538 538
                         $temp->_php_class = $this->_xh['php_class'];
539 539
                     }
540 540
                     $this->_xh['value'] = $temp;
541
-                } elseif ($rebuildXmlrpcvals < 0) {
541
+                } elseif ($rebuildXmlrpcvals<0) {
542 542
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
543
-                        $this->_xh['value'] = (object)array(
543
+                        $this->_xh['value'] = (object) array(
544 544
                             'xmlrpc_type' => 'datetime',
545 545
                             'scalar' => $this->_xh['value'],
546 546
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
547 547
                         );
548 548
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
549
-                        $this->_xh['value'] = (object)array(
549
+                        $this->_xh['value'] = (object) array(
550 550
                             'xmlrpc_type' => 'base64',
551 551
                             'scalar' => $this->_xh['value']
552 552
                         );
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
                 // check if we are inside an array or struct:
562 562
                 // if value just built is inside an array, let's move it into array on the stack
563 563
                 $vscount = count($this->_xh['valuestack']);
564
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
565
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
564
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
565
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
566 566
                 }
567 567
                 break;
568 568
 
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
592 592
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
593 593
                             $this->_xh['isf'] = 2;
594
-                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->truncateForDebug($this->_xh['ac']);
594
+                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateForDebug($this->_xh['ac']);
595 595
                             return;
596 596
                         } else {
597
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' .
597
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.
598 598
                                 $this->truncateForDebug($this->_xh['ac']));
599 599
                         }
600 600
                     }
@@ -616,17 +616,17 @@  discard block
 block discarded – undo
616 616
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
617 617
                     {
618 618
                         $this->_xh['isf'] = 2;
619
-                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->truncateForDebug($this->_xh['ac']);
619
+                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateForDebug($this->_xh['ac']);
620 620
                         return;
621 621
                     } else {
622
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' .
622
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.
623 623
                             $this->truncateForDebug($this->_xh['ac']));
624 624
                     }
625 625
                     /// @todo: find a better way of reporting an error value than this! Use NaN?
626 626
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
627 627
                 } else {
628 628
                     // it's ok, add it on
629
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
629
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
630 630
                 }
631 631
                 break;
632 632
 
@@ -636,18 +636,18 @@  discard block
 block discarded – undo
636 636
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
637 637
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
638 638
                         $this->_xh['isf'] = 2;
639
-                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' .
639
+                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.
640 640
                             $this->truncateForDebug($this->_xh['ac']);
641 641
                         return;
642 642
                     } else {
643
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' .
643
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.
644 644
                             $this->truncateForDebug($this->_xh['ac']));
645 645
                     }
646 646
 
647 647
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
648 648
                 } else {
649 649
                     // it's ok, add it on
650
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
650
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
651 651
                 }
652 652
                 break;
653 653
 
@@ -657,19 +657,19 @@  discard block
 block discarded – undo
657 657
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
658 658
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
659 659
                         $this->_xh['isf'] = 2;
660
-                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->truncateForDebug($this->_xh['ac']);
660
+                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateForDebug($this->_xh['ac']);
661 661
                         return;
662 662
                     } else {
663
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' .
663
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.
664 664
                             $this->truncateForDebug($this->_xh['ac']));
665 665
                     }
666 666
                 }
667 667
                 if ($this->current_parsing_options['xmlrpc_return_datetimes']) {
668 668
                     try {
669 669
                         $this->_xh['value'] = new \DateTime($this->_xh['ac']);
670
-                    } catch(\Exception $e) {
670
+                    } catch (\Exception $e) {
671 671
                         // q: what to do? we can not guarantee that a valid date can be created. Return null or throw?
672
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage());
672
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': '.$e->getMessage());
673 673
                         $this->_xh['value'] = null;
674 674
                     }
675 675
                 } else {
@@ -684,14 +684,14 @@  discard block
 block discarded – undo
684 684
                     $v = base64_decode($this->_xh['ac'], true);
685 685
                     if ($v === false) {
686 686
                         $this->_xh['isf'] = 2;
687
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateForDebug($this->_xh['ac']);
687
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateForDebug($this->_xh['ac']);
688 688
                         return;
689 689
                     }
690 690
                 } else {
691 691
                     $v = base64_decode($this->_xh['ac']);
692 692
                     if ($v === '' && $this->_xh['ac'] !== '') {
693 693
                         // only the empty string should decode to the empty string
694
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
694
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
695 695
                             $this->truncateForDebug($this->_xh['ac']));
696 696
                     }
697 697
                 }
@@ -699,31 +699,31 @@  discard block
 block discarded – undo
699 699
                 break;
700 700
 
701 701
             case 'NAME':
702
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
702
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
703 703
                 break;
704 704
 
705 705
             case 'MEMBER':
706 706
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
707 707
                 if ($this->_xh['vt']) {
708 708
                     $vscount = count($this->_xh['valuestack']);
709
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
709
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
710 710
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
711 711
                             $this->_xh['isf'] = 2;
712 712
                             $this->_xh['isf_reason'] = 'Missing NAME inside STRUCT in received xml';
713 713
                             return;
714 714
                         } else {
715
-                            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml');
715
+                            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml');
716 716
                         }
717
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
717
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
718 718
                     }
719
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
719
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
720 720
                 } else {
721 721
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
722 722
                         $this->_xh['isf'] = 2;
723 723
                         $this->_xh['isf_reason'] = 'Missing VALUE inside STRUCT in received xml';
724 724
                         return;
725 725
                     } else {
726
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
726
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
727 727
                     }
728 728
                 }
729 729
                 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()->errorLog('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
757
+                        $this->getLogger()->errorLog('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->truncateForDebug($this->_xh['ac']);
766
+                        $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateForDebug($this->_xh['ac']);
767 767
                         return;
768 768
                     } else {
769
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in METHODNAME: '.
769
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid data received in METHODNAME: '.
770 770
                             $this->truncateForDebug($this->_xh['ac']));
771 771
                     }
772 772
                 }
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
     public function xmlrpc_cd($parser, $data)
840 840
     {
841 841
         // skip processing if xml fault already detected
842
-        if ($this->_xh['isf'] >= 2) {
842
+        if ($this->_xh['isf']>=2) {
843 843
             return;
844 844
         }
845 845
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
     public function xmlrpc_dh($parser, $data)
862 862
     {
863 863
         // skip processing if xml fault already detected
864
-        if ($this->_xh['isf'] >= 2) {
864
+        if ($this->_xh['isf']>=2) {
865 865
             return;
866 866
         }
867 867
 
@@ -935,8 +935,8 @@  discard block
 block discarded – undo
935 935
         // Details:
936 936
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
937 937
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
938
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
939
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
938
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
939
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
940 940
             $xmlChunk, $matches)) {
941 941
             return strtoupper(substr($matches[2], 1, -1));
942 942
         }
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
955 955
             // IANA also likes better US-ASCII, so go with it
956 956
             if ($enc == 'ASCII') {
957
-                $enc = 'US-' . $enc;
957
+                $enc = 'US-'.$enc;
958 958
             }
959 959
 
960 960
             return $enc;
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
         // Details:
992 992
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
993 993
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
994
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
995
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
994
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
995
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
996 996
             $xmlChunk)) {
997 997
             return true;
998 998
         }
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                 break;
1013 1013
             default:
1014 1014
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1015
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1015
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1016 1016
         }
1017 1017
     }
1018 1018
 
@@ -1036,14 +1036,14 @@  discard block
 block discarded – undo
1036 1036
                 break;
1037 1037
             default:
1038 1038
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1039
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1039
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1040 1040
         }
1041 1041
     }
1042 1042
 
1043 1043
     protected function truncateForDebug($data)
1044 1044
     {
1045
-        if (strlen($data) > $this->maxDebugValueLength) {
1046
-            return substr($data, 0, $this->maxDebugValueLength - 3) . '...';
1045
+        if (strlen($data)>$this->maxDebugValueLength) {
1046
+            return substr($data, 0, $this->maxDebugValueLength-3).'...';
1047 1047
         }
1048 1048
 
1049 1049
         return $data;
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
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
                 if (count($this->xml_iso88591_Entities['in'])) {
92 92
                     return;
93 93
                 }
94
-                for ($i = 0; $i < 32; $i++) {
94
+                for ($i = 0; $i<32; $i++) {
95 95
                     $this->xml_iso88591_Entities["in"][] = chr($i);
96 96
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
97 97
                 }
98 98
 
99 99
                 /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
100 100
 
101
-                for ($i = 160; $i < 256; $i++) {
101
+                for ($i = 160; $i<256; $i++) {
102 102
                     $this->xml_iso88591_Entities["in"][] = chr($i);
103 103
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
104 104
                 }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 break;*/
127 127
 
128 128
             default:
129
-                throw new \Exception('Unsupported table: ' . $tableName);
129
+                throw new \Exception('Unsupported table: '.$tableName);
130 130
         }
131 131
     }
132 132
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             $srcEncoding = 'UTF-8';
179 179
         }
180 180
 
181
-        $conversion = strtoupper($srcEncoding . '_' . $destEncoding);
181
+        $conversion = strtoupper($srcEncoding.'_'.$destEncoding);
182 182
 
183 183
         // list ordered with (expected) most common scenarios first
184 184
         switch ($conversion) {
@@ -196,20 +196,20 @@  discard block
 block discarded – undo
196 196
                 // NB: this will choke on invalid UTF-8, going most likely beyond EOF
197 197
                 $escapedData = '';
198 198
                 // be kind to users creating string xml-rpc values out of different php types
199
-                $data = (string)$data;
199
+                $data = (string) $data;
200 200
                 $ns = strlen($data);
201
-                for ($nn = 0; $nn < $ns; $nn++) {
201
+                for ($nn = 0; $nn<$ns; $nn++) {
202 202
                     $ch = $data[$nn];
203 203
                     $ii = ord($ch);
204 204
                     // 7 bits in 1 byte: 0bbbbbbb (127)
205
-                    if ($ii < 32) {
205
+                    if ($ii<32) {
206 206
                         if ($conversion == 'UTF-8_US-ASCII') {
207 207
                             $escapedData .= sprintf('&#%d;', $ii);
208 208
                         } else {
209 209
                             $escapedData .= $ch;
210 210
                         }
211 211
                     }
212
-                    else if ($ii < 128) {
212
+                    else if ($ii<128) {
213 213
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
214 214
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
215 215
                         switch ($ii) {
@@ -234,25 +234,25 @@  discard block
 block discarded – undo
234 234
                     } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047)
235 235
                     elseif ($ii >> 5 == 6) {
236 236
                         $b1 = ($ii & 31);
237
-                        $b2 = (ord($data[$nn + 1]) & 63);
238
-                        $ii = ($b1 * 64) + $b2;
237
+                        $b2 = (ord($data[$nn+1]) & 63);
238
+                        $ii = ($b1 * 64)+$b2;
239 239
                         $escapedData .= sprintf('&#%d;', $ii);
240 240
                         $nn += 1;
241 241
                     } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb
242 242
                     elseif ($ii >> 4 == 14) {
243 243
                         $b1 = ($ii & 15);
244
-                        $b2 = (ord($data[$nn + 1]) & 63);
245
-                        $b3 = (ord($data[$nn + 2]) & 63);
246
-                        $ii = ((($b1 * 64) + $b2) * 64) + $b3;
244
+                        $b2 = (ord($data[$nn+1]) & 63);
245
+                        $b3 = (ord($data[$nn+2]) & 63);
246
+                        $ii = ((($b1 * 64)+$b2) * 64)+$b3;
247 247
                         $escapedData .= sprintf('&#%d;', $ii);
248 248
                         $nn += 2;
249 249
                     } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
250 250
                     elseif ($ii >> 3 == 30) {
251 251
                         $b1 = ($ii & 7);
252
-                        $b2 = (ord($data[$nn + 1]) & 63);
253
-                        $b3 = (ord($data[$nn + 2]) & 63);
254
-                        $b4 = (ord($data[$nn + 3]) & 63);
255
-                        $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
252
+                        $b2 = (ord($data[$nn+1]) & 63);
253
+                        $b3 = (ord($data[$nn+2]) & 63);
254
+                        $b4 = (ord($data[$nn+3]) & 63);
255
+                        $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4;
256 256
                         $escapedData .= sprintf('&#%d;', $ii);
257 257
                         $nn += 3;
258 258
                     }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                     // If src is UTF8, we run htmlspecialchars before converting to the target charset, as
306 306
                     // htmlspecialchars has limited charset support, but it groks utf8
307 307
                     if ($srcEncoding === 'UTF-8') {
308
-                        $data = htmlspecialchars($data,  defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
308
+                        $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
309 309
                     }
310 310
                     if ($srcEncoding !== $destEncoding) {
311 311
                         try {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                     }
318 318
                     if ($data === false) {
319 319
                         $escapedData = '';
320
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
320
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
321 321
                     } else {
322 322
                         if ($srcEncoding === 'UTF-8') {
323 323
                             $escapedData = $data;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                     }
328 328
                 } else {
329 329
                     $escapedData = '';
330
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported...");
330
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported...");
331 331
                 }
332 332
         }
333 333
 
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
         if (function_exists('mb_list_encodings')) {
346 346
             $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array(
347 347
                 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable',
348
-                '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
348
+                '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
349 349
             ))));
350 350
         }
351 351
         return $knownCharsets;
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
             case 'iso88591':
400 400
                 return $this->xml_iso88591_Entities;
401 401
             default:
402
-                throw new \Exception('Unsupported charset: ' . $charset);
402
+                throw new \Exception('Unsupported charset: '.$charset);
403 403
         }
404 404
     }
405 405
 }
Please login to merge, or discard this patch.