Passed
Push — master ( 5987e0...fe1d88 )
by Gaetano
09:19
created
demo/client/windowscharset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 /**
5 5
  * Demoing the charset conversion of the library: create a client class which uses data in the CP-1252 character set,
Please login to merge, or discard this patch.
tests/3EncoderTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpcs.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpcs.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 use PHPUnit\Runner\BaseTestRunner;
11 11
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing.
104 104
         ///       We should fix that, then re-enable this test
105 105
         if (version_compare(PHP_VERSION, '5.6.0', '>=')) {
106
-            $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>');
106
+            $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>');
107 107
             $this->assertEquals($string, $i->scalarVal());
108 108
         }
109 109
 
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             $server = $parts['host'];
190 190
             $path = isset($parts['path']) ? $parts['path'] : '';
191 191
             if (isset($parts['query'])) {
192
-                $path .= '?' . $parts['query'];
192
+                $path .= '?'.$parts['query'];
193 193
             }
194 194
             if (isset($parts['fragment'])) {
195
-                $path .= '#' . $parts['fragment'];
195
+                $path .= '#'.$parts['fragment'];
196 196
             }
197 197
             if (isset($parts['port'])) {
198 198
                 $port = $parts['port'];
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             }
209 209
         }
210 210
         if ($path == '' || $path[0] != '/') {
211
-            $this->path = '/' . $path;
211
+            $this->path = '/'.$path;
212 212
         } else {
213 213
             $this->path = $path;
214 214
         }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }*/
247 247
 
248 248
         // initialize user_agent string
249
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
249
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
250 250
     }
251 251
 
252 252
     /**
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
      */
671 671
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
672 672
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
673
-        $method='http')
673
+        $method = 'http')
674 674
     {
675 675
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
676 676
 
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      * @param int $sslVersion
704 704
      * @return Response
705 705
      */
706
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
706
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
707 707
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
708 708
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
709 709
         $sslVersion = 0)
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
      */
743 743
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
744 744
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
745
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
745
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
746 746
         $sslVersion = 0)
747 747
     {
748 748
         /// @todo log a warning if passed an unsupported method
@@ -779,16 +779,16 @@  discard block
 block discarded – undo
779 779
         // thanks to Grant Rauscher <[email protected]> for this
780 780
         $credentials = '';
781 781
         if ($username != '') {
782
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
782
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
783 783
             if ($authType != 1) {
784 784
                 /// @todo make this a proper error, i.e. return a failure
785
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
785
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
786 786
             }
787 787
         }
788 788
 
789 789
         $acceptedEncoding = '';
790 790
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
791
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
791
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
792 792
         }
793 793
 
794 794
         $proxyCredentials = '';
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
             $connectPort = $proxyPort;
801 801
             $transport = 'tcp';
802 802
             /// @todo check: should we not use https in some cases?
803
-            $uri = 'http://' . $server . ':' . $port . $this->path;
803
+            $uri = 'http://'.$server.':'.$port.$this->path;
804 804
             if ($proxyUsername != '') {
805 805
                 if ($proxyAuthType != 1) {
806 806
                     /// @todo make this a proper error, i.e. return a failure
807
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
807
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
808 808
                 }
809
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
809
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
810 810
             }
811 811
         } else {
812 812
             $connectServer = $server;
@@ -821,45 +821,45 @@  discard block
 block discarded – undo
821 821
             $version = '';
822 822
             foreach ($this->cookies as $name => $cookie) {
823 823
                 if ($cookie['version']) {
824
-                    $version = ' $Version="' . $cookie['version'] . '";';
825
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
824
+                    $version = ' $Version="'.$cookie['version'].'";';
825
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
826 826
                     if ($cookie['path']) {
827
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
827
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
828 828
                     }
829 829
                     if ($cookie['domain']) {
830
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
830
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
831 831
                     }
832 832
                     if ($cookie['port']) {
833
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
833
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
834 834
                     }
835 835
                 } else {
836
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
836
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
837 837
                 }
838 838
             }
839
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
839
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
840 840
         }
841 841
 
842 842
         // omit port if default
843 843
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
844
-            $port =  '';
844
+            $port = '';
845 845
         } else {
846
-            $port = ':' . $port;
846
+            $port = ':'.$port;
847 847
         }
848 848
 
849
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
850
-            'User-Agent: ' . $this->user_agent . "\r\n" .
851
-            'Host: ' . $server . $port . "\r\n" .
852
-            $credentials .
853
-            $proxyCredentials .
854
-            $acceptedEncoding .
855
-            $encodingHdr .
856
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
857
-            $cookieHeader .
858
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
859
-            strlen($payload) . "\r\n\r\n" .
849
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
850
+            'User-Agent: '.$this->user_agent."\r\n".
851
+            'Host: '.$server.$port."\r\n".
852
+            $credentials.
853
+            $proxyCredentials.
854
+            $acceptedEncoding.
855
+            $encodingHdr.
856
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
857
+            $cookieHeader.
858
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
859
+            strlen($payload)."\r\n\r\n".
860 860
             $payload;
861 861
 
862
-        if ($this->debug > 1) {
862
+        if ($this->debug>1) {
863 863
             $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---");
864 864
         }
865 865
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 
887 887
         $context = stream_context_create($contextOptions);
888 888
 
889
-        if ($timeout <= 0) {
889
+        if ($timeout<=0) {
890 890
             $connectTimeout = ini_get('default_socket_timeout');
891 891
         } else {
892 892
             $connectTimeout = $timeout;
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
899 899
             STREAM_CLIENT_CONNECT, $context);
900 900
         if ($fp) {
901
-            if ($timeout > 0) {
901
+            if ($timeout>0) {
902 902
                 stream_set_timeout($fp, $timeout, 0);
903 903
             }
904 904
         } else {
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
                 $this->errstr = $err['message'];
908 908
             }
909 909
 
910
-            $this->errstr = 'Connect error: ' . $this->errstr;
911
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
910
+            $this->errstr = 'Connect error: '.$this->errstr;
911
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
912 912
 
913 913
             return $r;
914 914
         }
@@ -996,18 +996,18 @@  discard block
 block discarded – undo
996 996
             $keyPass, $sslVersion);
997 997
 
998 998
         if (!$curl) {
999
-            return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
999
+            return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details');
1000 1000
         }
1001 1001
 
1002 1002
         $result = curl_exec($curl);
1003 1003
 
1004
-        if ($this->debug > 1) {
1004
+        if ($this->debug>1) {
1005 1005
             $message = "---CURL INFO---\n";
1006 1006
             foreach (curl_getinfo($curl) as $name => $val) {
1007 1007
                 if (is_array($val)) {
1008 1008
                     $val = implode("\n", $val);
1009 1009
                 }
1010
-                $message .= $name . ': ' . $val . "\n";
1010
+                $message .= $name.': '.$val."\n";
1011 1011
             }
1012 1012
             $message .= '---END---';
1013 1013
             $this->getLogger()->debugMessage($message);
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
             /// @todo we should use a better check here - what if we get back '' or '0'?
1018 1018
 
1019 1019
             $this->errstr = 'no response';
1020
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1020
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1021 1021
             curl_close($curl);
1022 1022
             if ($keepAlive) {
1023 1023
                 $this->xmlrpc_curl_handle = null;
@@ -1087,12 +1087,12 @@  discard block
 block discarded – undo
1087 1087
                     // http, https
1088 1088
                     $protocol = $method;
1089 1089
                     if (strpos($protocol, ':') !== false) {
1090
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1090
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1091 1091
                         return false;
1092 1092
                     }
1093 1093
                 }
1094 1094
             }
1095
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
1095
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
1096 1096
             if (!$curl) {
1097 1097
                 return false;
1098 1098
             }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         // results into variable
1107 1107
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1108 1108
 
1109
-        if ($this->debug > 1) {
1109
+        if ($this->debug>1) {
1110 1110
             curl_setopt($curl, CURLOPT_VERBOSE, true);
1111 1111
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
1112 1112
         }
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
             }
1132 1132
         }
1133 1133
         // extra headers
1134
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1134
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
1135 1135
         // if no keepalive is wanted, let the server know it in advance
1136 1136
         if (!$keepAlive) {
1137 1137
             $headers[] = 'Connection: close';
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1149 1149
         // timeout is borked
1150 1150
         if ($timeout) {
1151
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1151
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
1152 1152
         }
1153 1153
 
1154 1154
         switch ($method) {
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
                     curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
1164 1164
                 } else {
1165 1165
                     /// @todo make this a proper error, i.e. return a failure
1166
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install');
1166
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install');
1167 1167
                 }
1168 1168
                 break;
1169 1169
             case 'h2':
@@ -1172,12 +1172,12 @@  discard block
 block discarded – undo
1172 1172
         }
1173 1173
 
1174 1174
         if ($username && $password) {
1175
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1175
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1176 1176
             if (defined('CURLOPT_HTTPAUTH')) {
1177 1177
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
1178 1178
             } elseif ($authType != 1) {
1179 1179
                 /// @todo make this a proper error, i.e. return a failure
1180
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1180
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1181 1181
             }
1182 1182
         }
1183 1183
 
@@ -1220,14 +1220,14 @@  discard block
 block discarded – undo
1220 1220
             if ($proxyPort == 0) {
1221 1221
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1222 1222
             }
1223
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1223
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1224 1224
             if ($proxyUsername) {
1225
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1225
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1226 1226
                 if (defined('CURLOPT_PROXYAUTH')) {
1227 1227
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1228 1228
                 } elseif ($proxyAuthType != 1) {
1229 1229
                     /// @todo make this a proper error, i.e. return a failure
1230
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1230
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1231 1231
                 }
1232 1232
             }
1233 1233
         }
@@ -1237,7 +1237,7 @@  discard block
 block discarded – undo
1237 1237
         if (count($this->cookies)) {
1238 1238
             $cookieHeader = '';
1239 1239
             foreach ($this->cookies as $name => $cookie) {
1240
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1240
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1241 1241
             }
1242 1242
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1243 1243
         }
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
             curl_setopt($curl, $opt, $val);
1247 1247
         }
1248 1248
 
1249
-        if ($this->debug > 1) {
1249
+        if ($this->debug>1) {
1250 1250
             $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---");
1251 1251
         }
1252 1252
 
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
             $call['methodName'] = new Value($req->method(), 'string');
1338 1338
             $numParams = $req->getNumParams();
1339 1339
             $params = array();
1340
-            for ($i = 0; $i < $numParams; $i++) {
1340
+            for ($i = 0; $i<$numParams; $i++) {
1341 1341
                 $params[$i] = $req->getParam($i);
1342 1342
             }
1343 1343
             $call['params'] = new Value($params, 'array');
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
         $response = array();
1360 1360
 
1361 1361
         if ($this->return_type == 'xml') {
1362
-            for ($i = 0; $i < count($reqs); $i++) {
1362
+            for ($i = 0; $i<count($reqs); $i++) {
1363 1363
                 $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse());
1364 1364
             }
1365 1365
 
@@ -1367,21 +1367,21 @@  discard block
 block discarded – undo
1367 1367
             if (!is_array($rets)) {
1368 1368
                 // bad return type from system.multicall
1369 1369
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1370
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse());
1370
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse());
1371 1371
             }
1372 1372
             $numRets = count($rets);
1373 1373
             if ($numRets != count($reqs)) {
1374 1374
                 // wrong number of return values.
1375 1375
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1376
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals',
1376
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals',
1377 1377
                     $result->httpResponse());
1378 1378
             }
1379 1379
 
1380
-            for ($i = 0; $i < $numRets; $i++) {
1380
+            for ($i = 0; $i<$numRets; $i++) {
1381 1381
                 $val = $rets[$i];
1382 1382
                 if (!is_array($val)) {
1383 1383
                     return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1384
-                        PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1384
+                        PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1385 1385
                         'phpvals', $result->httpResponse());
1386 1386
                 }
1387 1387
                 switch (count($val)) {
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
                         if (!isset($val[0])) {
1390 1390
                             // Bad value
1391 1391
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1392
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value",
1392
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value",
1393 1393
                                 'phpvals', $result->httpResponse());
1394 1394
                         }
1395 1395
                         // Normal return value
@@ -1401,20 +1401,20 @@  discard block
 block discarded – undo
1401 1401
                         if (!is_int($code)) {
1402 1402
                             /// @todo should we check that it is != 0?
1403 1403
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1404
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1404
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1405 1405
                                 'phpvals', $result->httpResponse());
1406 1406
                         }
1407 1407
                         $str = @$val['faultString'];
1408 1408
                         if (!is_string($str)) {
1409 1409
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1410
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString",
1410
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString",
1411 1411
                                 'phpvals', $result->httpResponse());
1412 1412
                         }
1413 1413
                         $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse());
1414 1414
                         break;
1415 1415
                     default:
1416 1416
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1417
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1417
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1418 1418
                             'phpvals', $result->httpResponse());
1419 1419
                 }
1420 1420
             }
@@ -1423,14 +1423,14 @@  discard block
 block discarded – undo
1423 1423
             // return type == 'xmlrpcvals'
1424 1424
             if ($rets->kindOf() != 'array') {
1425 1425
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1426
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals',
1426
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals',
1427 1427
                     $result->httpResponse());
1428 1428
             }
1429 1429
             $numRets = $rets->count();
1430 1430
             if ($numRets != count($reqs)) {
1431 1431
                 // wrong number of return values.
1432 1432
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1433
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals',
1433
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals',
1434 1434
                     $result->httpResponse());
1435 1435
             }
1436 1436
 
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
                     case 'array':
1440 1440
                         if ($val->count() != 1) {
1441 1441
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1442
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1442
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1443 1443
                                 'phpvals', $result->httpResponse());
1444 1444
                         }
1445 1445
                         // Normal return value
@@ -1448,28 +1448,28 @@  discard block
 block discarded – undo
1448 1448
                     case 'struct':
1449 1449
                         if ($val->count() != 2) {
1450 1450
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1451
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1451
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1452 1452
                                 'phpvals', $result->httpResponse());
1453 1453
                         }
1454 1454
                         /** @var Value $code */
1455 1455
                         $code = $val['faultCode'];
1456 1456
                         if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') {
1457 1457
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1458
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1458
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1459 1459
                                 'xmlrpcvals', $result->httpResponse());
1460 1460
                         }
1461 1461
                         /** @var Value $str */
1462 1462
                         $str = $val['faultString'];
1463 1463
                         if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') {
1464 1464
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1465
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1465
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1466 1466
                                 'xmlrpcvals', $result->httpResponse());
1467 1467
                         }
1468 1468
                         $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse());
1469 1469
                         break;
1470 1470
                     default:
1471 1471
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1472
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1472
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1473 1473
                             'xmlrpcvals', $result->httpResponse());
1474 1474
                 }
1475 1475
             }
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
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                     $this->me['struct'] = $val;
130 130
                     break;
131 131
                 default:
132
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
132
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
133 133
             }
134 134
         }
135 135
     }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         }
154 154
 
155 155
         if ($typeOf !== 1) {
156
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
156
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
157 157
             return 0;
158 158
         }
159 159
 
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 
171 171
         switch ($this->mytype) {
172 172
             case 1:
173
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
173
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
174 174
                 return 0;
175 175
             case 3:
176
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
176
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
177 177
                 return 0;
178 178
             case 2:
179 179
                 // we're adding a scalar value to an array here
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
             return 1;
216 216
         } else {
217
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
217
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
218 218
             return 0;
219 219
         }
220 220
     }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
             return 1;
246 246
         } else {
247
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
247
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
248 248
             return 0;
249 249
         }
250 250
     }
@@ -286,19 +286,19 @@  discard block
 block discarded – undo
286 286
             case 1:
287 287
                 switch ($typ) {
288 288
                     case static::$xmlrpcBase64:
289
-                        $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
289
+                        $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>";
290 290
                         break;
291 291
                     case static::$xmlrpcBoolean:
292
-                        $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
292
+                        $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>";
293 293
                         break;
294 294
                     case static::$xmlrpcString:
295 295
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
296
-                        $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>";
296
+                        $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>";
297 297
                         break;
298 298
                     case static::$xmlrpcInt:
299 299
                     case static::$xmlrpcI4:
300 300
                     case static::$xmlrpcI8:
301
-                        $rs .= "<{$typ}>" . (int)$val . "</{$typ}>";
301
+                        $rs .= "<{$typ}>".(int) $val."</{$typ}>";
302 302
                         break;
303 303
                     case static::$xmlrpcDouble:
304 304
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -306,16 +306,16 @@  discard block
 block discarded – undo
306 306
                         // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14.
307 307
                         // The code below tries its best at keeping max precision while avoiding exp notation,
308 308
                         // but there is of course no limit in the number of decimal places to be used...
309
-                        $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>";
309
+                        $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>";
310 310
                         break;
311 311
                     case static::$xmlrpcDateTime:
312 312
                         if (is_string($val)) {
313 313
                             $rs .= "<{$typ}>{$val}</{$typ}>";
314 314
                         // DateTimeInterface is not present in php 5.4...
315 315
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
316
-                            $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>";
316
+                            $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>";
317 317
                         } elseif (is_int($val)) {
318
-                            $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>";
318
+                            $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>";
319 319
                         } else {
320 320
                             // not really a good idea here: but what should we output anyway? left for backward compat...
321 321
                             $rs .= "<{$typ}>{$val}</{$typ}>";
@@ -337,14 +337,14 @@  discard block
 block discarded – undo
337 337
             case 3:
338 338
                 // struct
339 339
                 if ($this->_php_class) {
340
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
340
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
341 341
                 } else {
342 342
                     $rs .= "<struct>\n";
343 343
                 }
344 344
                 $charsetEncoder = $this->getCharsetEncoder();
345 345
                 /** @var Value $val2 */
346 346
                 foreach ($val as $key2 => $val2) {
347
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
347
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
348 348
                     //$rs.=$this->serializeval($val2);
349 349
                     $rs .= $val2->serialize($charsetEncoding);
350 350
                     $rs .= "</member>\n";
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         $val = reset($this->me);
380 380
         $typ = key($this->me);
381 381
 
382
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
382
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
383 383
     }
384 384
 
385 385
     /**
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
                                 'scalar' => $val,
91 91
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
92 92
                             );
93
-                            return (object)$xmlrpcVal;
93
+                            return (object) $xmlrpcVal;
94 94
                         case 'base64':
95 95
                             $xmlrpcVal = array(
96 96
                                 'xmlrpc_type' => 'base64',
97 97
                                 'scalar' => $val
98 98
                             );
99
-                            return (object)$xmlrpcVal;
99
+                            return (object) $xmlrpcVal;
100 100
                         case 'string':
101 101
                             if (isset($options['extension_api_encoding'])) {
102 102
                                 // if iconv is not available, we use mb_convert_encoding
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             case 'msg':
166 166
                 $paramCount = $xmlrpcVal->getNumParams();
167 167
                 $arr = array();
168
-                for ($i = 0; $i < $paramCount; $i++) {
168
+                for ($i = 0; $i<$paramCount; $i++) {
169 169
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
170 170
                 }
171 171
                 return $arr;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 break;
292 292
             case 'resource':
293 293
                 if (in_array('extension_api', $options)) {
294
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
294
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
295 295
                 } else {
296 296
                     $xmlrpcVal = new Value();
297 297
                 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
                     if ($valEncoding == 'ISO-8859-1') {
341 341
                         $xmlVal = utf8_encode($xmlVal);
342 342
                     } else {
343
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
343
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
344 344
                     }
345 345
                 }
346 346
             }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
             $parserOptions
363 363
         );
364 364
 
365
-        if ($xmlRpcParser->_xh['isf'] > 1) {
365
+        if ($xmlRpcParser->_xh['isf']>1) {
366 366
             // test that $xmlrpc->_xh['value'] is an obj, too???
367 367
 
368 368
             $this->getLogger()->errorLog($xmlRpcParser->_xh['isf_reason']);
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
             case 'methodcall':
388 388
                 $req = new Request($xmlRpcParser->_xh['method']);
389
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
389
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
390 390
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
391 391
                 }
392 392
                 return $req;
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public static function xmlrpc_debugmsg($msg)
239 239
     {
240
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
240
+        static::$_xmlrpc_debuginfo .= $msg."\n";
241 241
     }
242 242
 
243 243
     /**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public static function error_occurred($msg)
251 251
     {
252
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
252
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
253 253
     }
254 254
 
255 255
     /**
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
271 271
         $out = '';
272 272
         if ($this->debug_info != '') {
273
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
273
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
274 274
         }
275 275
         if (static::$_xmlrpc_debuginfo != '') {
276
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
276
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
277 277
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
278 278
             // into return payload AFTER the beginning tag
279 279
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
         $this->debug_info = '';
303 303
 
304 304
         // Save what we received, before parsing it
305
-        if ($this->debug > 1) {
306
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
305
+        if ($this->debug>1) {
306
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
307 307
         }
308 308
 
309 309
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
             $resp->raw_data = $rawData;
321 321
         }
322 322
 
323
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
324
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
325
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
323
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
324
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
325
+                static::$_xmlrpcs_occurred_errors."+++END+++");
326 326
         }
327 327
 
328 328
         $payload = $this->xml_header($respCharset);
329
-        if ($this->debug > 0) {
330
-            $payload = $payload . $this->serializeDebug($respCharset);
329
+        if ($this->debug>0) {
330
+            $payload = $payload.$this->serializeDebug($respCharset);
331 331
         }
332 332
 
333 333
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
         if (empty($resp->payload)) {
336 336
             $resp->serialize($respCharset);
337 337
         }
338
-        $payload = $payload . $resp->payload;
338
+        $payload = $payload.$resp->payload;
339 339
 
340 340
         if ($returnPayload) {
341 341
             return $payload;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         // if we get a warning/error that has output some text before here, then we cannot
345 345
         // add a new header. We cannot say we are sending xml, either...
346 346
         if (!headers_sent()) {
347
-            header('Content-Type: ' . $resp->content_type);
347
+            header('Content-Type: '.$resp->content_type);
348 348
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
349 349
             header("Vary: Accept-Charset");
350 350
 
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
368 368
             // responses up to 8000 bytes
369 369
             if ($phpNoSelfCompress) {
370
-                header('Content-Length: ' . (int)strlen($payload));
370
+                header('Content-Length: '.(int) strlen($payload));
371 371
             }
372 372
         } else {
373
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
373
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
374 374
         }
375 375
 
376 376
         print $payload;
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
             $numParams = count($in);
429 429
         }
430 430
         foreach ($sigs as $curSig) {
431
-            if (count($curSig) == $numParams + 1) {
431
+            if (count($curSig) == $numParams+1) {
432 432
                 $itsOK = 1;
433
-                for ($n = 0; $n < $numParams; $n++) {
433
+                for ($n = 0; $n<$numParams; $n++) {
434 434
                     if (is_object($in)) {
435 435
                         $p = $in->getParam($n);
436 436
                         if ($p->kindOf() == 'scalar') {
@@ -443,10 +443,10 @@  discard block
 block discarded – undo
443 443
                     }
444 444
 
445 445
                     // param index is $n+1, as first member of sig is return type
446
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
446
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
447 447
                         $itsOK = 0;
448
-                        $pno = $n + 1;
449
-                        $wanted = $curSig[$n + 1];
448
+                        $pno = $n+1;
449
+                        $wanted = $curSig[$n+1];
450 450
                         $got = $pt;
451 451
                         break;
452 452
                     }
@@ -473,10 +473,10 @@  discard block
 block discarded – undo
473 473
         // check if $_SERVER is populated: it might have been disabled via ini file
474 474
         // (this is true even when in CLI mode)
475 475
         if (count($_SERVER) == 0) {
476
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
476
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
477 477
         }
478 478
 
479
-        if ($this->debug > 1) {
479
+        if ($this->debug>1) {
480 480
             if (function_exists('getallheaders')) {
481 481
                 $this->debugmsg(''); // empty line
482 482
                 foreach (getallheaders() as $name => $val) {
@@ -501,13 +501,13 @@  discard block
 block discarded – undo
501 501
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
502 502
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
503 503
                         $data = $degzdata;
504
-                        if ($this->debug > 1) {
505
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
504
+                        if ($this->debug>1) {
505
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
506 506
                         }
507 507
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
508 508
                         $data = $degzdata;
509
-                        if ($this->debug > 1) {
510
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
509
+                        if ($this->debug>1) {
510
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
511 511
                         }
512 512
                     } else {
513 513
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                 // here we check if we can match the client-requested encoding with the encodings we know we can generate.
535 535
                 // we parse q=0.x preferences instead of preferring the first charset specified
536 536
                 $clientAcceptedCharsets = array();
537
-                foreach(explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET'])) as $c) {
537
+                foreach (explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET'])) as $c) {
538 538
                     if (preg_match('/^([^;]+);Q=([0-9.]+)/', $c, $matches)) {
539 539
                         $c = $matches[1];
540 540
                         $w = $matches[2];
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
                     if ($reqEncoding == 'ISO-8859-1') {
614 614
                         $data = utf8_encode($data);
615 615
                     } else {
616
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
616
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
617 617
                     }
618 618
                 }
619 619
             }
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
641 641
             return new Response(
642 642
                 0,
643
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
643
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
644 644
                 $xmlRpcParser->_xh['isf_reason']);
645 645
         } elseif ($xmlRpcParser->_xh['isf']) {
646 646
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc,
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             return new Response(
649 649
                 0,
650 650
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
651
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
651
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
652 652
         } else {
653 653
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
654 654
             // this, but in the most common scenario (xmlrpc values type server with some methods registered as phpvals)
@@ -658,20 +658,20 @@  discard block
 block discarded – undo
658 658
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
659 659
                 )
660 660
             ) {
661
-                if ($this->debug > 1) {
662
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
661
+                if ($this->debug>1) {
662
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
663 663
                 }
664 664
 
665 665
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
666 666
             } else {
667 667
                 // build a Request object with data parsed from xml and add parameters in
668 668
                 $req = new Request($xmlRpcParser->_xh['method']);
669
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
669
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
670 670
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
671 671
                 }
672 672
 
673
-                if ($this->debug > 1) {
674
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
673
+                if ($this->debug>1) {
674
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
675 675
                 }
676 676
 
677 677
                 return $this->execute($req);
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                 return new Response(
724 724
                     0,
725 725
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
726
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
726
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
727 727
                 );
728 728
             }
729 729
         }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
         // build string representation of function 'name'
739 739
         if (is_array($func)) {
740 740
             if (is_object($func[0])) {
741
-                $funcName = get_class($func[0]) . '->' . $func[1];
741
+                $funcName = get_class($func[0]).'->'.$func[1];
742 742
             } else {
743 743
                 $funcName = implode('::', $func);
744 744
             }
@@ -750,17 +750,17 @@  discard block
 block discarded – undo
750 750
 
751 751
         // verify that function to be invoked is in fact callable
752 752
         if (!is_callable($func)) {
753
-            $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
753
+            $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
754 754
             return new Response(
755 755
                 0,
756 756
                 PhpXmlRpc::$xmlrpcerr['server_error'],
757
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
757
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
758 758
             );
759 759
         }
760 760
 
761 761
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
762 762
         // as part of response
763
-        if ($this->debug > 2) {
763
+        if ($this->debug>2) {
764 764
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
765 765
         }
766 766
 
@@ -774,14 +774,14 @@  discard block
 block discarded – undo
774 774
                     $r = call_user_func($func, $req);
775 775
                 }
776 776
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
777
-                    $this->getLogger()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
777
+                    $this->getLogger()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
778 778
                     if (is_a($r, 'PhpXmlRpc\Value')) {
779 779
                         $r = new Response($r);
780 780
                     } else {
781 781
                         $r = new Response(
782 782
                             0,
783 783
                             PhpXmlRpc::$xmlrpcerr['server_error'],
784
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
784
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
785 785
                         );
786 786
                     }
787 787
                 }
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
797 797
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
798 798
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
799
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
799
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
800 800
                         } else {
801 801
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
802 802
                             // return type correctly
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
             // proper error-response
821 821
             switch ($this->exception_handling) {
822 822
                 case 2:
823
-                    if ($this->debug > 2) {
823
+                    if ($this->debug>2) {
824 824
                         if (self::$_xmlrpcs_prev_ehandler) {
825 825
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
826 826
                         } else {
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
             // proper error-response
844 844
             switch ($this->exception_handling) {
845 845
                 case 2:
846
-                    if ($this->debug > 2) {
846
+                    if ($this->debug>2) {
847 847
                         if (self::$_xmlrpcs_prev_ehandler) {
848 848
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
849 849
                         } else {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
             }
864 864
         }
865 865
 
866
-        if ($this->debug > 2) {
866
+        if ($this->debug>2) {
867 867
             // note: restore the error handler we found before calling the user func, even if it has been changed
868 868
             // inside the func itself
869 869
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
      */
930 930
     protected function debugmsg($string)
931 931
     {
932
-        $this->debug_info .= $string . "\n";
932
+        $this->debug_info .= $string."\n";
933 933
     }
934 934
 
935 935
     /**
@@ -939,9 +939,9 @@  discard block
 block discarded – undo
939 939
     protected function xml_header($charsetEncoding = '')
940 940
     {
941 941
         if ($charsetEncoding != '') {
942
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
942
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
943 943
         } else {
944
-            return "<?xml version=\"1.0\"?" . ">\n";
944
+            return "<?xml version=\"1.0\"?".">\n";
945 945
         }
946 946
     }
947 947
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
                 $i++; // for error message, we count params from 1
1235 1235
                 return static::_xmlrpcs_multicall_error(new Response(0,
1236 1236
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1237
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1237
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1238 1238
             }
1239 1239
         }
1240 1240
 
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
             }
1316 1316
         } else {
1317 1317
             $numCalls = count($req);
1318
-            for ($i = 0; $i < $numCalls; $i++) {
1318
+            for ($i = 0; $i<$numCalls; $i++) {
1319 1319
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1320 1320
             }
1321 1321
         }
Please login to merge, or discard this patch.