Passed
Pull Request — master (#84)
by
unknown
10:39
created
src/Helper/Charset.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function buildConversionTable($tableName)
65 65
     {
66
-        switch($tableName) {
66
+        switch ($tableName) {
67 67
             case 'xml_iso88591_Entities':
68 68
                 if (count($this->xml_iso88591_Entities['in'])) {
69 69
                     return;
70 70
                 }
71
-                for ($i = 0; $i < 32; $i++) {
71
+                for ($i = 0; $i<32; $i++) {
72 72
                     $this->xml_iso88591_Entities["in"][] = chr($i);
73 73
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
74 74
                 }
75 75
 
76 76
                 /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
77 77
 
78
-                for ($i = 160; $i < 256; $i++) {
78
+                for ($i = 160; $i<256; $i++) {
79 79
                     $this->xml_iso88591_Entities["in"][] = chr($i);
80 80
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
81 81
                 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 break;*/
104 104
 
105 105
             default:
106
-                throw new \Exception('Unsupported table: ' . $tableName);
106
+                throw new \Exception('Unsupported table: '.$tableName);
107 107
         }
108 108
     }
109 109
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             $destEncoding = 'US-ASCII';
147 147
         }
148 148
 
149
-        $conversion = strtoupper($srcEncoding . '_' . $destEncoding);
149
+        $conversion = strtoupper($srcEncoding.'_'.$destEncoding);
150 150
 
151 151
         // list ordered with (expected) most common scenarios first
152 152
         switch ($conversion) {
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
                 // NB: this will choke on invalid UTF-8, going most likely beyond EOF
165 165
                 $escapedData = '';
166 166
                 // be kind to users creating string xmlrpc values out of different php types
167
-                $data = (string)$data;
167
+                $data = (string) $data;
168 168
                 $ns = strlen($data);
169
-                for ($nn = 0; $nn < $ns; $nn++) {
169
+                for ($nn = 0; $nn<$ns; $nn++) {
170 170
                     $ch = $data[$nn];
171 171
                     $ii = ord($ch);
172 172
                     // 7 bits in 1 byte: 0bbbbbbb (127)
173
-                    if ($ii < 32) {
173
+                    if ($ii<32) {
174 174
                         if ($conversion == 'UTF-8_US-ASCII') {
175 175
                             $escapedData .= sprintf('&#%d;', $ii);
176 176
                         } else {
177 177
                             $escapedData .= $ch;
178 178
                         }
179 179
                     }
180
-                    else if ($ii < 128) {
180
+                    else if ($ii<128) {
181 181
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
182 182
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
183 183
                         switch ($ii) {
@@ -202,25 +202,25 @@  discard block
 block discarded – undo
202 202
                     } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047)
203 203
                     elseif ($ii >> 5 == 6) {
204 204
                         $b1 = ($ii & 31);
205
-                        $b2 = (ord($data[$nn + 1]) & 63);
206
-                        $ii = ($b1 * 64) + $b2;
205
+                        $b2 = (ord($data[$nn+1]) & 63);
206
+                        $ii = ($b1 * 64)+$b2;
207 207
                         $escapedData .= sprintf('&#%d;', $ii);
208 208
                         $nn += 1;
209 209
                     } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb
210 210
                     elseif ($ii >> 4 == 14) {
211 211
                         $b1 = ($ii & 15);
212
-                        $b2 = (ord($data[$nn + 1]) & 63);
213
-                        $b3 = (ord($data[$nn + 2]) & 63);
214
-                        $ii = ((($b1 * 64) + $b2) * 64) + $b3;
212
+                        $b2 = (ord($data[$nn+1]) & 63);
213
+                        $b3 = (ord($data[$nn+2]) & 63);
214
+                        $ii = ((($b1 * 64)+$b2) * 64)+$b3;
215 215
                         $escapedData .= sprintf('&#%d;', $ii);
216 216
                         $nn += 2;
217 217
                     } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
218 218
                     elseif ($ii >> 3 == 30) {
219 219
                         $b1 = ($ii & 7);
220
-                        $b2 = (ord($data[$nn + 1]) & 63);
221
-                        $b3 = (ord($data[$nn + 2]) & 63);
222
-                        $b4 = (ord($data[$nn + 3]) & 63);
223
-                        $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
220
+                        $b2 = (ord($data[$nn+1]) & 63);
221
+                        $b3 = (ord($data[$nn+2]) & 63);
222
+                        $b4 = (ord($data[$nn+3]) & 63);
223
+                        $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4;
224 224
                         $escapedData .= sprintf('&#%d;', $ii);
225 225
                         $nn += 3;
226 226
                     }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 
269 269
             default:
270 270
                 $escapedData = '';
271
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported...");
271
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported...");
272 272
         }
273 273
 
274 274
         return $escapedData;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
             case 'iso88591':
323 323
                 return $this->xml_iso88591_Entities;
324 324
             default:
325
-                throw new \Exception('Unsupported charset: ' . $charset);
325
+                throw new \Exception('Unsupported charset: '.$charset);
326 326
         }
327 327
     }
328 328
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,8 +176,7 @@
 block discarded – undo
176 176
                         } else {
177 177
                             $escapedData .= $ch;
178 178
                         }
179
-                    }
180
-                    else if ($ii < 128) {
179
+                    } else if ($ii < 128) {
181 180
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
182 181
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
183 182
                         switch ($ii) {
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
             $server = $parts['host'];
152 152
             $path = isset($parts['path']) ? $parts['path'] : '';
153 153
             if (isset($parts['query'])) {
154
-                $path .= '?' . $parts['query'];
154
+                $path .= '?'.$parts['query'];
155 155
             }
156 156
             if (isset($parts['fragment'])) {
157
-                $path .= '#' . $parts['fragment'];
157
+                $path .= '#'.$parts['fragment'];
158 158
             }
159 159
             if (isset($parts['port'])) {
160 160
                 $port = $parts['port'];
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             }
171 171
         }
172 172
         if ($path == '' || $path[0] != '/') {
173
-            $this->path = '/' . $path;
173
+            $this->path = '/'.$path;
174 174
         } else {
175 175
             $this->path = $path;
176 176
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         }*/
209 209
 
210 210
         // initialize user_agent string
211
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
211
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
212 212
     }
213 213
 
214 214
     /**
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
      */
582 582
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
583 583
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
584
-        $method='http')
584
+        $method = 'http')
585 585
     {
586 586
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
587 587
 
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      * @param int $sslVersion
614 614
      * @return Response
615 615
      */
616
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
616
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
617 617
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
618 618
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
619 619
         $sslVersion = 0)
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
      */
651 651
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
652 652
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
653
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
653
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
654 654
         $sslVersion = 0)
655 655
     {
656 656
         if ($port == 0) {
657
-            $port = ( $method === 'https' ) ? 443 : 80;
657
+            $port = ($method === 'https') ? 443 : 80;
658 658
         }
659 659
 
660 660
         // Only create the payload if it was not created previously
@@ -684,15 +684,15 @@  discard block
 block discarded – undo
684 684
         // thanks to Grant Rauscher <[email protected]> for this
685 685
         $credentials = '';
686 686
         if ($username != '') {
687
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
687
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
688 688
             if ($authType != 1) {
689
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
689
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
690 690
             }
691 691
         }
692 692
 
693 693
         $acceptedEncoding = '';
694 694
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
695
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
695
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
696 696
         }
697 697
 
698 698
         $proxyCredentials = '';
@@ -703,17 +703,17 @@  discard block
 block discarded – undo
703 703
             $connectServer = $proxyHost;
704 704
             $connectPort = $proxyPort;
705 705
             $transport = 'tcp';
706
-            $uri = 'http://' . $server . ':' . $port . $this->path;
706
+            $uri = 'http://'.$server.':'.$port.$this->path;
707 707
             if ($proxyUsername != '') {
708 708
                 if ($proxyAuthType != 1) {
709
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
709
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
710 710
                 }
711
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
711
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
712 712
             }
713 713
         } else {
714 714
             $connectServer = $server;
715 715
             $connectPort = $port;
716
-            $transport = ( $method === 'https' ) ? 'tls' : 'tcp';
716
+            $transport = ($method === 'https') ? 'tls' : 'tcp';
717 717
             $uri = $this->path;
718 718
         }
719 719
 
@@ -723,45 +723,45 @@  discard block
 block discarded – undo
723 723
             $version = '';
724 724
             foreach ($this->cookies as $name => $cookie) {
725 725
                 if ($cookie['version']) {
726
-                    $version = ' $Version="' . $cookie['version'] . '";';
727
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
726
+                    $version = ' $Version="'.$cookie['version'].'";';
727
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
728 728
                     if ($cookie['path']) {
729
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
729
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
730 730
                     }
731 731
                     if ($cookie['domain']) {
732
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
732
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
733 733
                     }
734 734
                     if ($cookie['port']) {
735
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
735
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
736 736
                     }
737 737
                 } else {
738
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
738
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
739 739
                 }
740 740
             }
741
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
741
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
742 742
         }
743 743
 
744 744
         // omit port if default
745 745
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
746
-            $port =  '';
746
+            $port = '';
747 747
         } else {
748
-            $port = ':' . $port;
748
+            $port = ':'.$port;
749 749
         }
750 750
 
751
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
752
-            'User-Agent: ' . $this->user_agent . "\r\n" .
753
-            'Host: ' . $server . $port . "\r\n" .
754
-            $credentials .
755
-            $proxyCredentials .
756
-            $acceptedEncoding .
757
-            $encodingHdr .
758
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
759
-            $cookieHeader .
760
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
761
-            strlen($payload) . "\r\n\r\n" .
751
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
752
+            'User-Agent: '.$this->user_agent."\r\n".
753
+            'Host: '.$server.$port."\r\n".
754
+            $credentials.
755
+            $proxyCredentials.
756
+            $acceptedEncoding.
757
+            $encodingHdr.
758
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
759
+            $cookieHeader.
760
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
761
+            strlen($payload)."\r\n\r\n".
762 762
             $payload;
763 763
 
764
-        if ($this->debug > 1) {
764
+        if ($this->debug>1) {
765 765
             $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---");
766 766
         }
767 767
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
         }
788 788
         $context = stream_context_create($contextOptions);
789 789
 
790
-        if ($timeout <= 0) {
790
+        if ($timeout<=0) {
791 791
             $connectTimeout = ini_get('default_socket_timeout');
792 792
         } else {
793 793
             $connectTimeout = $timeout;
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
800 800
             STREAM_CLIENT_CONNECT, $context);
801 801
         if ($fp) {
802
-            if ($timeout > 0) {
802
+            if ($timeout>0) {
803 803
                 stream_set_timeout($fp, $timeout);
804 804
             }
805 805
         } else {
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
                 $err = error_get_last();
808 808
                 $this->errstr = $err['message'];
809 809
             }
810
-            $this->errstr = 'Connect error: ' . $this->errstr;
811
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
810
+            $this->errstr = 'Connect error: '.$this->errstr;
811
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
812 812
 
813 813
             return $r;
814 814
         }
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
             $encodingHdr = '';
916 916
         }
917 917
 
918
-        if ($this->debug > 1) {
918
+        if ($this->debug>1) {
919 919
             $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---");
920 920
         }
921 921
 
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
             } else {
926 926
                 $protocol = $method;
927 927
             }
928
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
928
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
929 929
             if ($keepAlive) {
930 930
                 $this->xmlrpc_curl_handle = $curl;
931 931
             }
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
         // results into variable
937 937
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
938 938
 
939
-        if ($this->debug > 1) {
939
+        if ($this->debug>1) {
940 940
             curl_setopt($curl, CURLOPT_VERBOSE, true);
941 941
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
942 942
         }
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
             }
962 962
         }
963 963
         // extra headers
964
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
964
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
965 965
         // if no keepalive is wanted, let the server know it in advance
966 966
         if (!$keepAlive) {
967 967
             $headers[] = 'Connection: close';
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
979 979
         // timeout is borked
980 980
         if ($timeout) {
981
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
981
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
982 982
         }
983 983
 
984 984
         if ($method == 'http10') {
@@ -988,11 +988,11 @@  discard block
 block discarded – undo
988 988
         }
989 989
 
990 990
         if ($username && $password) {
991
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
991
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
992 992
             if (defined('CURLOPT_HTTPAUTH')) {
993 993
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
994 994
             } elseif ($authType != 1) {
995
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
995
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
996 996
             }
997 997
         }
998 998
 
@@ -1034,13 +1034,13 @@  discard block
 block discarded – undo
1034 1034
             if ($proxyPort == 0) {
1035 1035
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1036 1036
             }
1037
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1037
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1038 1038
             if ($proxyUsername) {
1039
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1039
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1040 1040
                 if (defined('CURLOPT_PROXYAUTH')) {
1041 1041
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1042 1042
                 } elseif ($proxyAuthType != 1) {
1043
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1043
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1044 1044
                 }
1045 1045
             }
1046 1046
         }
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         if (count($this->cookies)) {
1051 1051
             $cookieHeader = '';
1052 1052
             foreach ($this->cookies as $name => $cookie) {
1053
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1053
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1054 1054
             }
1055 1055
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1056 1056
         }
@@ -1061,13 +1061,13 @@  discard block
 block discarded – undo
1061 1061
 
1062 1062
         $result = curl_exec($curl);
1063 1063
 
1064
-        if ($this->debug > 1) {
1064
+        if ($this->debug>1) {
1065 1065
             $message = "---CURL INFO---\n";
1066 1066
             foreach (curl_getinfo($curl) as $name => $val) {
1067 1067
                 if (is_array($val)) {
1068 1068
                     $val = implode("\n", $val);
1069 1069
                 }
1070
-                $message .= $name . ': ' . $val . "\n";
1070
+                $message .= $name.': '.$val."\n";
1071 1071
             }
1072 1072
             $message .= '---END---';
1073 1073
             $this->getLogger()->debugMessage($message);
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
             /// @todo we should use a better check here - what if we get back '' or '0'?
1078 1078
 
1079 1079
             $this->errstr = 'no response';
1080
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1080
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1081 1081
             curl_close($curl);
1082 1082
             if ($keepAlive) {
1083 1083
                 $this->xmlrpc_curl_handle = null;
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
             $call['methodName'] = new Value($req->method(), 'string');
1188 1188
             $numParams = $req->getNumParams();
1189 1189
             $params = array();
1190
-            for ($i = 0; $i < $numParams; $i++) {
1190
+            for ($i = 0; $i<$numParams; $i++) {
1191 1191
                 $params[$i] = $req->getParam($i);
1192 1192
             }
1193 1193
             $call['params'] = new Value($params, 'array');
@@ -1213,15 +1213,15 @@  discard block
 block discarded – undo
1213 1213
             /// @todo test this code branch...
1214 1214
             $rets = $result->value();
1215 1215
             if (!is_array($rets)) {
1216
-                return false;       // bad return type from system.multicall
1216
+                return false; // bad return type from system.multicall
1217 1217
             }
1218 1218
             $numRets = count($rets);
1219 1219
             if ($numRets != count($reqs)) {
1220
-                return false;       // wrong number of return values.
1220
+                return false; // wrong number of return values.
1221 1221
             }
1222 1222
 
1223 1223
             $response = array();
1224
-            for ($i = 0; $i < $numRets; $i++) {
1224
+            for ($i = 0; $i<$numRets; $i++) {
1225 1225
                 $val = $rets[$i];
1226 1226
                 if (!is_array($val)) {
1227 1227
                     return false;
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
                 switch (count($val)) {
1230 1230
                     case 1:
1231 1231
                         if (!isset($val[0])) {
1232
-                            return false;       // Bad value
1232
+                            return false; // Bad value
1233 1233
                         }
1234 1234
                         // Normal return value
1235 1235
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1257,19 +1257,19 @@  discard block
 block discarded – undo
1257 1257
 
1258 1258
             $rets = $result->value();
1259 1259
             if ($rets->kindOf() != 'array') {
1260
-                return false;       // bad return type from system.multicall
1260
+                return false; // bad return type from system.multicall
1261 1261
             }
1262 1262
             $numRets = $rets->count();
1263 1263
             if ($numRets != count($reqs)) {
1264
-                return false;       // wrong number of return values.
1264
+                return false; // wrong number of return values.
1265 1265
             }
1266 1266
 
1267 1267
             $response = array();
1268
-            foreach($rets as $val) {
1268
+            foreach ($rets as $val) {
1269 1269
                 switch ($val->kindOf()) {
1270 1270
                     case 'array':
1271 1271
                         if ($val->count() != 1) {
1272
-                            return false;       // Bad value
1272
+                            return false; // Bad value
1273 1273
                         }
1274 1274
                         // Normal return value
1275 1275
                         $response[] = new Response($val[0]);
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
     public function xml_header($charsetEncoding = '')
89 89
     {
90 90
         if ($charsetEncoding != '') {
91
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
91
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
92 92
         } else {
93
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
93
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
94 94
         }
95 95
     }
96 96
 
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
     public function createPayload($charsetEncoding = '')
111 111
     {
112 112
         if ($charsetEncoding != '') {
113
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
113
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
114 114
         } else {
115 115
             $this->content_type = 'text/xml';
116 116
         }
117 117
         $this->payload = $this->xml_header($charsetEncoding);
118
-        $this->payload .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
119
-            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
118
+        $this->payload .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
119
+            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
120 120
         $this->payload .= "<params>\n";
121 121
         foreach ($this->params as $p) {
122
-            $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) .
122
+            $this->payload .= "<param>\n".$p->serialize($charsetEncoding).
123 123
                 "</param>\n";
124 124
         }
125 125
         $this->payload .= "</params>\n";
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
247 247
 
248 248
         if ($data == '') {
249
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.');
249
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.');
250 250
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
251 251
         }
252 252
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $httpParser = new Http();
256 256
             try {
257 257
                 $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug);
258
-            } catch(\Exception $e) {
258
+            } catch (\Exception $e) {
259 259
                 $r = new Response(0, $e->getCode(), $e->getMessage());
260 260
                 // failed processing of HTTP response headers
261 261
                 // save into response obj the full payload received, for debugging
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
275 275
         $pos = strrpos($data, '</methodResponse>');
276 276
         if ($pos !== false) {
277
-            $data = substr($data, 0, $pos + 17);
277
+            $data = substr($data, 0, $pos+17);
278 278
         }
279 279
 
280 280
         // try to 'guestimate' the character encoding of the received response
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
             if ($start) {
286 286
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
287 287
                 $end = strpos($data, '-->', $start);
288
-                $comments = substr($data, $start, $end - $start);
289
-                $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" .
290
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding);
288
+                $comments = substr($data, $start, $end-$start);
289
+                $this->getLogger()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t".
290
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding);
291 291
             }
292 292
         }
293 293
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                     if (extension_loaded('mbstring')) {
316 316
                         $data = mb_convert_encoding($data, 'UTF-8', $respEncoding);
317 317
                     } else {
318
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding);
318
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding);
319 319
                     }
320 320
                 }
321 321
             }
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
         $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE, $options);
337 337
 
338 338
         // first error check: xml not well formed
339
-        if ($xmlRpcParser->_xh['isf'] > 2) {
339
+        if ($xmlRpcParser->_xh['isf']>2) {
340 340
 
341 341
             // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL'
342 342
 
343 343
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
344
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
344
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
345 345
 
346 346
             if ($this->debug) {
347 347
                 print $xmlRpcParser->_xh['isf_reason'];
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         // second error check: xml well formed but not xml-rpc compliant
351 351
         elseif ($xmlRpcParser->_xh['isf'] == 2) {
352 352
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
353
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
353
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
354 354
 
355 355
             if ($this->debug) {
356 356
                 /// @todo echo something for user?
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
366 366
                 PhpXmlRpc::$xmlrpcstr['invalid_return']);
367 367
         } else {
368
-            if ($this->debug > 1) {
368
+            if ($this->debug>1) {
369 369
                 $this->getLogger()->debugMessage(
370 370
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
371 371
                 );
Please login to merge, or discard this patch.
src/Value.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
                     $this->me['struct'] = $val;
120 120
                     break;
121 121
                 default:
122
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
122
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
123 123
             }
124 124
         }
125 125
     }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         }
145 145
 
146 146
         if ($typeOf !== 1) {
147
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
147
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
148 148
             return 0;
149 149
         }
150 150
 
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 
162 162
         switch ($this->mytype) {
163 163
             case 1:
164
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
164
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
165 165
                 return 0;
166 166
             case 3:
167
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
167
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
168 168
                 return 0;
169 169
             case 2:
170 170
                 // we're adding a scalar value to an array here
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
             return 1;
208 208
         } else {
209
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
209
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
210 210
             return 0;
211 211
         }
212 212
     }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
             return 1;
239 239
         } else {
240
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
240
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
241 241
             return 0;
242 242
         }
243 243
     }
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             case 1:
280 280
                 switch ($typ) {
281 281
                     case static::$xmlrpcBase64:
282
-                        $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
282
+                        $rs .= "<${typ}>".base64_encode($val)."</${typ}>";
283 283
                         break;
284 284
                     case static::$xmlrpcBoolean:
285
-                        $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
285
+                        $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>";
286 286
                         break;
287 287
                     case static::$xmlrpcString:
288 288
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
289
-                        $rs .= "<${typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
289
+                        $rs .= "<${typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>";
290 290
                         break;
291 291
                     case static::$xmlrpcInt:
292 292
                     case static::$xmlrpcI4:
293 293
                     case static::$xmlrpcI8:
294
-                        $rs .= "<${typ}>" . (int)$val . "</${typ}>";
294
+                        $rs .= "<${typ}>".(int) $val."</${typ}>";
295 295
                         break;
296 296
                     case static::$xmlrpcDouble:
297 297
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
300 300
                         // The code below tries its best at keeping max precision while avoiding exp notation,
301 301
                         // but there is of course no limit in the number of decimal places to be used...
302
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</${typ}>";
302
+                        $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</${typ}>";
303 303
                         break;
304 304
                     case static::$xmlrpcDateTime:
305 305
                         if (is_string($val)) {
306 306
                             $rs .= "<${typ}>${val}</${typ}>";
307 307
                         } elseif (is_a($val, 'DateTime')) {
308
-                            $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
308
+                            $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
309 309
                         } elseif (is_int($val)) {
310
-                            $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
310
+                            $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
311 311
                         } else {
312 312
                             // not really a good idea here: but what shall we output anyway? left for backward compat...
313 313
                             $rs .= "<${typ}>${val}</${typ}>";
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
             case 3:
330 330
                 // struct
331 331
                 if ($this->_php_class) {
332
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
332
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
333 333
                 } else {
334 334
                     $rs .= "<struct>\n";
335 335
                 }
336 336
                 $charsetEncoder = $this->getCharsetEncoder();
337 337
                 /** @var Value $val2 */
338 338
                 foreach ($val as $key2 => $val2) {
339
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
339
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
340 340
                     //$rs.=$this->serializeval($val2);
341 341
                     $rs .= $val2->serialize($charsetEncoding);
342 342
                     $rs .= "</member>\n";
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $val = reset($this->me);
373 373
         $typ = key($this->me);
374 374
 
375
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
375
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
376 376
     }
377 377
 
378 378
     /**
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public static function xmlrpc_debugmsg($msg)
205 205
     {
206
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
206
+        static::$_xmlrpc_debuginfo .= $msg."\n";
207 207
     }
208 208
 
209 209
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     public static function error_occurred($msg)
217 217
     {
218
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
218
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
219 219
     }
220 220
 
221 221
     /**
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
235 235
         $out = '';
236 236
         if ($this->debug_info != '') {
237
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
237
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
238 238
         }
239 239
         if (static::$_xmlrpc_debuginfo != '') {
240
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
240
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
241 241
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
242 242
             // into return payload AFTER the beginning tag
243 243
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         $this->debug_info = '';
268 268
 
269 269
         // Save what we received, before parsing it
270
-        if ($this->debug > 1) {
271
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
270
+        if ($this->debug>1) {
271
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
272 272
         }
273 273
 
274 274
         $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
         // save full body of request into response, for more debugging usages
281 281
         $r->raw_data = $rawData;
282 282
 
283
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) {
284
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
285
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
283
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) {
284
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
285
+                static::$_xmlrpcs_occurred_errors."+++END+++");
286 286
         }
287 287
 
288 288
         $payload = $this->xml_header($respCharset);
289
-        if ($this->debug > 0) {
290
-            $payload = $payload . $this->serializeDebug($respCharset);
289
+        if ($this->debug>0) {
290
+            $payload = $payload.$this->serializeDebug($respCharset);
291 291
         }
292 292
 
293 293
         // Do not create response serialization if it has already happened. Helps building json magic
294 294
         if (empty($r->payload)) {
295 295
             $r->serialize($respCharset);
296 296
         }
297
-        $payload = $payload . $r->payload;
297
+        $payload = $payload.$r->payload;
298 298
 
299 299
         if ($returnPayload) {
300 300
             return $payload;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
         // if we get a warning/error that has output some text before here, then we cannot
304 304
         // add a new header. We cannot say we are sending xml, either...
305 305
         if (!headers_sent()) {
306
-            header('Content-Type: ' . $r->content_type);
306
+            header('Content-Type: '.$r->content_type);
307 307
             // we do not know if client actually told us an accepted charset, but if he did
308 308
             // we have to tell him what we did
309 309
             header("Vary: Accept-Charset");
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
333 333
             // responses up to 8000 bytes
334 334
             if ($phpNoSelfCompress) {
335
-                header('Content-Length: ' . (int)strlen($payload));
335
+                header('Content-Length: '.(int) strlen($payload));
336 336
             }
337 337
         } else {
338
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
338
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
339 339
         }
340 340
 
341 341
         print $payload;
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
             $numParams = count($in);
391 391
         }
392 392
         foreach ($sigs as $curSig) {
393
-            if (count($curSig) == $numParams + 1) {
393
+            if (count($curSig) == $numParams+1) {
394 394
                 $itsOK = 1;
395
-                for ($n = 0; $n < $numParams; $n++) {
395
+                for ($n = 0; $n<$numParams; $n++) {
396 396
                     if (is_object($in)) {
397 397
                         $p = $in->getParam($n);
398 398
                         if ($p->kindOf() == 'scalar') {
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
                     }
406 406
 
407 407
                     // param index is $n+1, as first member of sig is return type
408
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
408
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
409 409
                         $itsOK = 0;
410
-                        $pno = $n + 1;
411
-                        $wanted = $curSig[$n + 1];
410
+                        $pno = $n+1;
411
+                        $wanted = $curSig[$n+1];
412 412
                         $got = $pt;
413 413
                         break;
414 414
                     }
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
         // check if $_SERVER is populated: it might have been disabled via ini file
436 436
         // (this is true even when in CLI mode)
437 437
         if (count($_SERVER) == 0) {
438
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
438
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
439 439
         }
440 440
 
441
-        if ($this->debug > 1) {
441
+        if ($this->debug>1) {
442 442
             if (function_exists('getallheaders')) {
443 443
                 $this->debugmsg(''); // empty line
444 444
                 foreach (getallheaders() as $name => $val) {
@@ -460,13 +460,13 @@  discard block
 block discarded – undo
460 460
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
461 461
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
462 462
                         $data = $degzdata;
463
-                        if ($this->debug > 1) {
464
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
463
+                        if ($this->debug>1) {
464
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
465 465
                         }
466 466
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
467 467
                         $data = $degzdata;
468
-                        if ($this->debug > 1) {
469
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
468
+                        if ($this->debug>1) {
469
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
470 470
                         }
471 471
                     } else {
472 472
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']);
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                     if (extension_loaded('mbstring')) {
557 557
                         $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding);
558 558
                     } else {
559
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding);
559
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding);
560 560
                     }
561 561
                 }
562 562
             }
@@ -575,16 +575,16 @@  discard block
 block discarded – undo
575 575
 
576 576
         $xmlRpcParser = $this->getParser();
577 577
         $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST, $options);
578
-        if ($xmlRpcParser->_xh['isf'] > 2) {
578
+        if ($xmlRpcParser->_xh['isf']>2) {
579 579
             // (BC) we return XML error as a faultCode
580 580
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
581 581
             $r = new Response(0,
582
-                PhpXmlRpc::$xmlrpcerrxml + $matches[1],
582
+                PhpXmlRpc::$xmlrpcerrxml+$matches[1],
583 583
                 $xmlRpcParser->_xh['isf_reason']);
584 584
         } elseif ($xmlRpcParser->_xh['isf']) {
585 585
             $r = new Response(0,
586 586
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
587
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
587
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
588 588
         } else {
589 589
             // small layering violation in favor of speed and memory usage:
590 590
             // we should allow the 'execute' method handle this, but in the
@@ -595,20 +595,20 @@  discard block
 block discarded – undo
595 595
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
596 596
                 )
597 597
             ) {
598
-                if ($this->debug > 1) {
599
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
598
+                if ($this->debug>1) {
599
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
600 600
                 }
601 601
                 $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
602 602
             } else {
603 603
                 // build a Request object with data parsed from xml
604 604
                 $req = new Request($xmlRpcParser->_xh['method']);
605 605
                 // now add parameters in
606
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
606
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
607 607
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
608 608
                 }
609 609
 
610
-                if ($this->debug > 1) {
611
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
610
+                if ($this->debug>1) {
611
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
612 612
                 }
613 613
                 $r = $this->execute($req);
614 614
             }
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
                 return new Response(
662 662
                     0,
663 663
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
664
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}"
664
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}"
665 665
                 );
666 666
             }
667 667
         }
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
         if (is_array($func)) {
676 676
             if (is_object($func[0])) {
677
-                $funcName = get_class($func[0]) . '->' . $func[1];
677
+                $funcName = get_class($func[0]).'->'.$func[1];
678 678
             } else {
679 679
                 $funcName = implode('::', $func);
680 680
             }
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
 
687 687
         // verify that function to be invoked is in fact callable
688 688
         if (!is_callable($func)) {
689
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
689
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
690 690
             return new Response(
691 691
                 0,
692 692
                 PhpXmlRpc::$xmlrpcerr['server_error'],
693
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
693
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
694 694
             );
695 695
         }
696 696
 
697 697
         // If debug level is 3, we should catch all errors generated during
698 698
         // processing of user function, and log them as part of response
699
-        if ($this->debug > 2) {
699
+        if ($this->debug>2) {
700 700
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
701 701
         }
702 702
 
@@ -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()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
712
+                    $this->getLogger()->errorLog("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
                 }
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
                         // mimic EPI behaviour: if we get an array that looks like an error, make it
733 733
                         // an error response
734 734
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
735
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
735
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
736 736
                         } else {
737 737
                             // functions using EPI api should NOT return resp objects,
738 738
                             // so make sure we encode the return type correctly
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
             // in the called function, we wrap it in a proper error-response
757 757
             switch ($this->exception_handling) {
758 758
                 case 2:
759
-                    if ($this->debug > 2) {
759
+                    if ($this->debug>2) {
760 760
                         if (self::$_xmlrpcs_prev_ehandler) {
761 761
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
762 762
                         } else {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
                     $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']);
772 772
             }
773 773
         }
774
-        if ($this->debug > 2) {
774
+        if ($this->debug>2) {
775 775
             // note: restore the error handler we found before calling the
776 776
             // user func, even if it has been changed inside the func itself
777 777
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
      */
792 792
     protected function debugmsg($string)
793 793
     {
794
-        $this->debug_info .= $string . "\n";
794
+        $this->debug_info .= $string."\n";
795 795
     }
796 796
 
797 797
     /**
@@ -801,9 +801,9 @@  discard block
 block discarded – undo
801 801
     protected function xml_header($charsetEncoding = '')
802 802
     {
803 803
         if ($charsetEncoding != '') {
804
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
804
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
805 805
         } else {
806
-            return "<?xml version=\"1.0\"?" . ">\n";
806
+            return "<?xml version=\"1.0\"?".">\n";
807 807
         }
808 808
     }
809 809
 
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
         }
1056 1056
 
1057 1057
         $req = new Request($methName->scalarval());
1058
-        foreach($params as $i => $param) {
1058
+        foreach ($params as $i => $param) {
1059 1059
             if (!$req->addParam($param)) {
1060 1060
                 $i++; // for error message, we count params from 1
1061 1061
                 return static::_xmlrpcs_multicall_error(new Response(0,
1062 1062
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1063
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1063
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1064 1064
             }
1065 1065
         }
1066 1066
 
@@ -1132,12 +1132,12 @@  discard block
 block discarded – undo
1132 1132
         // let accept a plain list of php parameters, beside a single xmlrpc msg object
1133 1133
         if (is_object($req)) {
1134 1134
             $calls = $req->getParam(0);
1135
-            foreach($calls as $call) {
1135
+            foreach ($calls as $call) {
1136 1136
                 $result[] = static::_xmlrpcs_multicall_do_call($server, $call);
1137 1137
             }
1138 1138
         } else {
1139 1139
             $numCalls = count($req);
1140
-            for ($i = 0; $i < $numCalls; $i++) {
1140
+            for ($i = 0; $i<$numCalls; $i++) {
1141 1141
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1142 1142
             }
1143 1143
         }
Please login to merge, or discard this patch.