Passed
Push — master ( 9f5262...c72dd6 )
by Gaetano
09:22
created
demo/client/loggerinjection.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 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 how to inject a custom logger for use by the library
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
     // logger API
23 23
     public function debug($message, $context = array())
24 24
     {
25
-        $this->debugBuffer .= $message . "\n";
25
+        $this->debugBuffer .= $message."\n";
26 26
     }
27 27
 
28 28
     // logger API
29 29
     public function error($message, $context = array())
30 30
     {
31
-        $this->errorBuffer .= $message . "\n";
31
+        $this->errorBuffer .= $message."\n";
32 32
     }
33 33
 
34 34
     public function getDebug()
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
 $input = array(
61 61
     array('name' => 'Dave', 'age' => 24),
62
-    array('name' => 'Edd',  'age' => 45),
63
-    array('name' => 'Joe',  'age' => 37),
62
+    array('name' => 'Edd', 'age' => 45),
63
+    array('name' => 'Joe', 'age' => 37),
64 64
     array('name' => 'Fred', 'age' => 27),
65 65
 );
66 66
 
@@ -79,5 +79,5 @@  discard block
 block discarded – undo
79 79
 $response = $client->send($request);
80 80
 output("Response received.<br>");
81 81
 
82
-output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>");
83
-output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>");
82
+output("The client error info is:<pre>\n".$logger->getError()."\n</pre>");
83
+output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>");
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
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
             $server = $parts['host'];
278 278
             $path = isset($parts['path']) ? $parts['path'] : '';
279 279
             if (isset($parts['query'])) {
280
-                $path .= '?' . $parts['query'];
280
+                $path .= '?'.$parts['query'];
281 281
             }
282 282
             if (isset($parts['fragment'])) {
283
-                $path .= '#' . $parts['fragment'];
283
+                $path .= '#'.$parts['fragment'];
284 284
             }
285 285
             if (isset($parts['port'])) {
286 286
                 $port = $parts['port'];
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             }
297 297
         }
298 298
         if ($path == '' || $path[0] != '/') {
299
-            $this->path = '/' . $path;
299
+            $this->path = '/'.$path;
300 300
         } else {
301 301
             $this->path = $path;
302 302
         }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         //$this->accepted_charset_encodings = $ch->knownCharsets();
329 329
 
330 330
         // initialize user_agent string
331
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
331
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
332 332
     }
333 333
 
334 334
     /**
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
      */
755 755
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
756 756
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
757
-        $method='http')
757
+        $method = 'http')
758 758
     {
759 759
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
760 760
 
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
      * @param int $sslVersion
788 788
      * @return Response
789 789
      */
790
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
790
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
791 791
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
792 792
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
793 793
         $sslVersion = 0)
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
      */
827 827
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
828 828
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
829
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
829
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
830 830
         $sslVersion = 0)
831 831
     {
832 832
         /// @todo log a warning if passed an unsupported method
@@ -863,16 +863,16 @@  discard block
 block discarded – undo
863 863
         // thanks to Grant Rauscher <[email protected]> for this
864 864
         $credentials = '';
865 865
         if ($username != '') {
866
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
866
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
867 867
             if ($authType != 1) {
868 868
                 /// @todo make this a proper error, i.e. return a failure
869
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
869
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
870 870
             }
871 871
         }
872 872
 
873 873
         $acceptedEncoding = '';
874 874
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
875
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
875
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
876 876
         }
877 877
 
878 878
         $proxyCredentials = '';
@@ -884,13 +884,13 @@  discard block
 block discarded – undo
884 884
             $connectPort = $proxyPort;
885 885
             $transport = 'tcp';
886 886
             /// @todo check: should we not use https in some cases?
887
-            $uri = 'http://' . $server . ':' . $port . $this->path;
887
+            $uri = 'http://'.$server.':'.$port.$this->path;
888 888
             if ($proxyUsername != '') {
889 889
                 if ($proxyAuthType != 1) {
890 890
                     /// @todo make this a proper error, i.e. return a failure
891
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
891
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
892 892
                 }
893
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
893
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
894 894
             }
895 895
         } else {
896 896
             $connectServer = $server;
@@ -905,45 +905,45 @@  discard block
 block discarded – undo
905 905
             $version = '';
906 906
             foreach ($this->cookies as $name => $cookie) {
907 907
                 if ($cookie['version']) {
908
-                    $version = ' $Version="' . $cookie['version'] . '";';
909
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
908
+                    $version = ' $Version="'.$cookie['version'].'";';
909
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
910 910
                     if ($cookie['path']) {
911
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
911
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
912 912
                     }
913 913
                     if ($cookie['domain']) {
914
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
914
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
915 915
                     }
916 916
                     if ($cookie['port']) {
917
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
917
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
918 918
                     }
919 919
                 } else {
920
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
920
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
921 921
                 }
922 922
             }
923
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
923
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
924 924
         }
925 925
 
926 926
         // omit port if default
927 927
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
928
-            $port =  '';
928
+            $port = '';
929 929
         } else {
930
-            $port = ':' . $port;
930
+            $port = ':'.$port;
931 931
         }
932 932
 
933
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
934
-            'User-Agent: ' . $this->user_agent . "\r\n" .
935
-            'Host: ' . $server . $port . "\r\n" .
936
-            $credentials .
937
-            $proxyCredentials .
938
-            $acceptedEncoding .
939
-            $encodingHdr .
940
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
941
-            $cookieHeader .
942
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
943
-            strlen($payload) . "\r\n\r\n" .
933
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
934
+            'User-Agent: '.$this->user_agent."\r\n".
935
+            'Host: '.$server.$port."\r\n".
936
+            $credentials.
937
+            $proxyCredentials.
938
+            $acceptedEncoding.
939
+            $encodingHdr.
940
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
941
+            $cookieHeader.
942
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
943
+            strlen($payload)."\r\n\r\n".
944 944
             $payload;
945 945
 
946
-        if ($this->debug > 1) {
946
+        if ($this->debug>1) {
947 947
             $this->getLogger()->debug("---SENDING---\n$op\n---END---");
948 948
         }
949 949
 
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 
971 971
         $context = stream_context_create($contextOptions);
972 972
 
973
-        if ($timeout <= 0) {
973
+        if ($timeout<=0) {
974 974
             $connectTimeout = ini_get('default_socket_timeout');
975 975
         } else {
976 976
             $connectTimeout = $timeout;
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
983 983
             STREAM_CLIENT_CONNECT, $context);
984 984
         if ($fp) {
985
-            if ($timeout > 0) {
985
+            if ($timeout>0) {
986 986
                 stream_set_timeout($fp, $timeout, 0);
987 987
             }
988 988
         } else {
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
                 $this->errstr = $err['message'];
992 992
             }
993 993
 
994
-            $this->errstr = 'Connect error: ' . $this->errstr;
995
-            $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
994
+            $this->errstr = 'Connect error: '.$this->errstr;
995
+            $r = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
996 996
 
997 997
             return $r;
998 998
         }
@@ -1080,18 +1080,18 @@  discard block
 block discarded – undo
1080 1080
             $keyPass, $sslVersion);
1081 1081
 
1082 1082
         if (!$curl) {
1083
-            return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
1083
+            return new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details');
1084 1084
         }
1085 1085
 
1086 1086
         $result = curl_exec($curl);
1087 1087
 
1088
-        if ($this->debug > 1) {
1088
+        if ($this->debug>1) {
1089 1089
             $message = "---CURL INFO---\n";
1090 1090
             foreach (curl_getinfo($curl) as $name => $val) {
1091 1091
                 if (is_array($val)) {
1092 1092
                     $val = implode("\n", $val);
1093 1093
                 }
1094
-                $message .= $name . ': ' . $val . "\n";
1094
+                $message .= $name.': '.$val."\n";
1095 1095
             }
1096 1096
             $message .= '---END---';
1097 1097
             $this->getLogger()->debug($message);
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
             /// @todo we should use a better check here - what if we get back '' or '0'?
1102 1102
 
1103 1103
             $this->errstr = 'no response';
1104
-            $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1104
+            $resp = new static::$responseClass(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1105 1105
             curl_close($curl);
1106 1106
             if ($keepAlive) {
1107 1107
                 $this->xmlrpc_curl_handle = null;
@@ -1171,12 +1171,12 @@  discard block
 block discarded – undo
1171 1171
                     // http, https
1172 1172
                     $protocol = $method;
1173 1173
                     if (strpos($protocol, ':') !== false) {
1174
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1174
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1175 1175
                         return false;
1176 1176
                     }
1177 1177
                 }
1178 1178
             }
1179
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
1179
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
1180 1180
             if (!$curl) {
1181 1181
                 return false;
1182 1182
             }
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
         // results into variable
1191 1191
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1192 1192
 
1193
-        if ($this->debug > 1) {
1193
+        if ($this->debug>1) {
1194 1194
             curl_setopt($curl, CURLOPT_VERBOSE, true);
1195 1195
             /// @todo redirect curlopt_stderr to some stream which can be piped to the logger
1196 1196
         }
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
             }
1216 1216
         }
1217 1217
         // extra headers
1218
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1218
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
1219 1219
         // if no keepalive is wanted, let the server know it in advance
1220 1220
         if (!$keepAlive) {
1221 1221
             $headers[] = 'Connection: close';
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1233 1233
         // timeout is borked
1234 1234
         if ($timeout) {
1235
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1235
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
1236 1236
         }
1237 1237
 
1238 1238
         switch ($method) {
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
                     curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
1248 1248
                 } else {
1249 1249
                     /// @todo make this a proper error, i.e. return a failure
1250
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install');
1250
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install');
1251 1251
                 }
1252 1252
                 break;
1253 1253
             case 'h2':
@@ -1256,12 +1256,12 @@  discard block
 block discarded – undo
1256 1256
         }
1257 1257
 
1258 1258
         if ($username && $password) {
1259
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1259
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1260 1260
             if (defined('CURLOPT_HTTPAUTH')) {
1261 1261
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
1262 1262
             } elseif ($authType != 1) {
1263 1263
                 /// @todo make this a proper error, i.e. return a failure
1264
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1264
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1265 1265
             }
1266 1266
         }
1267 1267
 
@@ -1304,14 +1304,14 @@  discard block
 block discarded – undo
1304 1304
             if ($proxyPort == 0) {
1305 1305
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1306 1306
             }
1307
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1307
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1308 1308
             if ($proxyUsername) {
1309
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1309
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1310 1310
                 if (defined('CURLOPT_PROXYAUTH')) {
1311 1311
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1312 1312
                 } elseif ($proxyAuthType != 1) {
1313 1313
                     /// @todo make this a proper error, i.e. return a failure
1314
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1314
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1315 1315
                 }
1316 1316
             }
1317 1317
         }
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
         if (count($this->cookies)) {
1322 1322
             $cookieHeader = '';
1323 1323
             foreach ($this->cookies as $name => $cookie) {
1324
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1324
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1325 1325
             }
1326 1326
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1327 1327
         }
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
             curl_setopt($curl, $opt, $val);
1331 1331
         }
1332 1332
 
1333
-        if ($this->debug > 1) {
1333
+        if ($this->debug>1) {
1334 1334
             $this->getLogger()->debug("---SENDING---\n$payload\n---END---");
1335 1335
         }
1336 1336
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
             $call['methodName'] = new Value($req->method(), 'string');
1422 1422
             $numParams = $req->getNumParams();
1423 1423
             $params = array();
1424
-            for ($i = 0; $i < $numParams; $i++) {
1424
+            for ($i = 0; $i<$numParams; $i++) {
1425 1425
                 $params[$i] = $req->getParam($i);
1426 1426
             }
1427 1427
             $call['params'] = new Value($params, 'array');
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
         $response = array();
1444 1444
 
1445 1445
         if ($this->return_type == 'xml') {
1446
-            for ($i = 0; $i < count($reqs); $i++) {
1446
+            for ($i = 0; $i<count($reqs); $i++) {
1447 1447
                 $response[] = new Response($rets, 0, '', 'xml', $result->httpResponse());
1448 1448
             }
1449 1449
 
@@ -1451,21 +1451,21 @@  discard block
 block discarded – undo
1451 1451
             if (!is_array($rets)) {
1452 1452
                 // bad return type from system.multicall
1453 1453
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1454
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': not an array', 'phpvals', $result->httpResponse());
1454
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': not an array', 'phpvals', $result->httpResponse());
1455 1455
             }
1456 1456
             $numRets = count($rets);
1457 1457
             if ($numRets != count($reqs)) {
1458 1458
                 // wrong number of return values.
1459 1459
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1460
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'phpvals',
1460
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'phpvals',
1461 1461
                     $result->httpResponse());
1462 1462
             }
1463 1463
 
1464
-            for ($i = 0; $i < $numRets; $i++) {
1464
+            for ($i = 0; $i<$numRets; $i++) {
1465 1465
                 $val = $rets[$i];
1466 1466
                 if (!is_array($val)) {
1467 1467
                     return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1468
-                        PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1468
+                        PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1469 1469
                         'phpvals', $result->httpResponse());
1470 1470
                 }
1471 1471
                 switch (count($val)) {
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
                         if (!isset($val[0])) {
1474 1474
                             // Bad value
1475 1475
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1476
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has no value",
1476
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has no value",
1477 1477
                                 'phpvals', $result->httpResponse());
1478 1478
                         }
1479 1479
                         // Normal return value
@@ -1485,20 +1485,20 @@  discard block
 block discarded – undo
1485 1485
                         if (!is_int($code)) {
1486 1486
                             /// @todo should we check that it is != 0?
1487 1487
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1488
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1488
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1489 1489
                                 'phpvals', $result->httpResponse());
1490 1490
                         }
1491 1491
                         $str = @$val['faultString'];
1492 1492
                         if (!is_string($str)) {
1493 1493
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1494
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no FaultString",
1494
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no FaultString",
1495 1495
                                 'phpvals', $result->httpResponse());
1496 1496
                         }
1497 1497
                         $response[$i] = new Response(0, $code, $str, 'phpvals', $result->httpResponse());
1498 1498
                         break;
1499 1499
                     default:
1500 1500
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1501
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1501
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1502 1502
                             'phpvals', $result->httpResponse());
1503 1503
                 }
1504 1504
             }
@@ -1507,14 +1507,14 @@  discard block
 block discarded – undo
1507 1507
             // return type == 'xmlrpcvals'
1508 1508
             if ($rets->kindOf() != 'array') {
1509 1509
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1510
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array", 'xmlrpcvals',
1510
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array", 'xmlrpcvals',
1511 1511
                     $result->httpResponse());
1512 1512
             }
1513 1513
             $numRets = $rets->count();
1514 1514
             if ($numRets != count($reqs)) {
1515 1515
                 // wrong number of return values.
1516 1516
                 return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1517
-                    PhpXmlRpc::$xmlrpcstr['multicall_error'] . ': incorrect number of responses', 'xmlrpcvals',
1517
+                    PhpXmlRpc::$xmlrpcstr['multicall_error'].': incorrect number of responses', 'xmlrpcvals',
1518 1518
                     $result->httpResponse());
1519 1519
             }
1520 1520
 
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
                     case 'array':
1524 1524
                         if ($val->count() != 1) {
1525 1525
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1526
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1526
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1527 1527
                                 'phpvals', $result->httpResponse());
1528 1528
                         }
1529 1529
                         // Normal return value
@@ -1532,28 +1532,28 @@  discard block
 block discarded – undo
1532 1532
                     case 'struct':
1533 1533
                         if ($val->count() != 2) {
1534 1534
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1535
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has too many items",
1535
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has too many items",
1536 1536
                                 'phpvals', $result->httpResponse());
1537 1537
                         }
1538 1538
                         /** @var Value $code */
1539 1539
                         $code = $val['faultCode'];
1540 1540
                         if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') {
1541 1541
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1542
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1542
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1543 1543
                                 'xmlrpcvals', $result->httpResponse());
1544 1544
                         }
1545 1545
                         /** @var Value $str */
1546 1546
                         $str = $val['faultString'];
1547 1547
                         if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') {
1548 1548
                             return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1549
-                                PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i has invalid or no faultCode",
1549
+                                PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i has invalid or no faultCode",
1550 1550
                                 'xmlrpcvals', $result->httpResponse());
1551 1551
                         }
1552 1552
                         $response[] = new Response(0, $code->scalarval(), $str->scalarval(), 'xmlrpcvals', $result->httpResponse());
1553 1553
                         break;
1554 1554
                     default:
1555 1555
                         return new Response(0, PhpXmlRpc::$xmlrpcerr['multicall_error'],
1556
-                            PhpXmlRpc::$xmlrpcstr['multicall_error'] . ": response element $i is not an array or struct",
1556
+                            PhpXmlRpc::$xmlrpcstr['multicall_error'].": response element $i is not an array or struct",
1557 1557
                             'xmlrpcvals', $result->httpResponse());
1558 1558
                 }
1559 1559
             }
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
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
                                 'scalar' => $val,
58 58
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
59 59
                             );
60
-                            return (object)$xmlrpcVal;
60
+                            return (object) $xmlrpcVal;
61 61
                         case 'base64':
62 62
                             $xmlrpcVal = array(
63 63
                                 'xmlrpc_type' => 'base64',
64 64
                                 'scalar' => $val
65 65
                             );
66
-                            return (object)$xmlrpcVal;
66
+                            return (object) $xmlrpcVal;
67 67
                         case 'string':
68 68
                             if (isset($options['extension_api_encoding'])) {
69 69
                                 // if iconv is not available, we use mb_convert_encoding
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 'msg':
137 137
                 $paramCount = $xmlrpcVal->getNumParams();
138 138
                 $arr = array();
139
-                for ($i = 0; $i < $paramCount; $i++) {
139
+                for ($i = 0; $i<$paramCount; $i++) {
140 140
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
141 141
                 }
142 142
                 return $arr;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             case 'resource':
263 263
                 if (in_array('extension_api', $options)) {
264
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
264
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
265 265
                 } else {
266 266
                     $xmlrpcVal = new Value();
267 267
                 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     if ($valEncoding == 'ISO-8859-1') {
311 311
                         $xmlVal = utf8_encode($xmlVal);
312 312
                     } else {
313
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
313
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
314 314
                     }
315 315
                 }
316 316
             }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             $parserOptions
333 333
         );
334 334
 
335
-        if ($xmlRpcParser->_xh['isf'] > 1) {
335
+        if ($xmlRpcParser->_xh['isf']>1) {
336 336
             // test that $xmlrpc->_xh['value'] is an obj, too???
337 337
 
338 338
             $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
             case 'methodcall':
358 358
                 $req = new Request($xmlRpcParser->_xh['method']);
359
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
359
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
360 360
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
361 361
                 }
362 362
                 return $req;
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public static function xmlrpc_debugmsg($msg)
193 193
     {
194
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
194
+        static::$_xmlrpc_debuginfo .= $msg."\n";
195 195
     }
196 196
 
197 197
     /**
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public static function error_occurred($msg)
205 205
     {
206
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
206
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
207 207
     }
208 208
 
209 209
     /**
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
225 225
         $out = '';
226 226
         if ($this->debug_info != '') {
227
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
227
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
228 228
         }
229 229
         if (static::$_xmlrpc_debuginfo != '') {
230
-            $out .= "<!-- DEBUG INFO:\n" . $this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
230
+            $out .= "<!-- DEBUG INFO:\n".$this->getCharsetEncoder()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
231 231
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
232 232
             // into return payload AFTER the beginning tag
233 233
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
         $this->debug_info = '';
257 257
 
258 258
         // Save what we received, before parsing it
259
-        if ($this->debug > 1) {
260
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
259
+        if ($this->debug>1) {
260
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
261 261
         }
262 262
 
263 263
         $resp = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
             $resp->raw_data = $rawData;
275 275
         }
276 276
 
277
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors != '') {
278
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
279
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
277
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors != '') {
278
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
279
+                static::$_xmlrpcs_occurred_errors."+++END+++");
280 280
         }
281 281
 
282 282
         $payload = $this->xml_header($respCharset);
283
-        if ($this->debug > 0) {
284
-            $payload = $payload . $this->serializeDebug($respCharset);
283
+        if ($this->debug>0) {
284
+            $payload = $payload.$this->serializeDebug($respCharset);
285 285
         }
286 286
 
287 287
         // Do not create response serialization if it has already happened. Helps to build json magic
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         if (empty($resp->payload)) {
290 290
             $resp->serialize($respCharset);
291 291
         }
292
-        $payload = $payload . $resp->payload;
292
+        $payload = $payload.$resp->payload;
293 293
 
294 294
         if ($returnPayload) {
295 295
             return $payload;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // if we get a warning/error that has output some text before here, then we cannot
299 299
         // add a new header. We cannot say we are sending xml, either...
300 300
         if (!headers_sent()) {
301
-            header('Content-Type: ' . $resp->content_type);
301
+            header('Content-Type: '.$resp->content_type);
302 302
             // we do not know if client actually told us an accepted charset, but if it did we have to tell it what we did
303 303
             header("Vary: Accept-Charset");
304 304
 
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
322 322
             // responses up to 8000 bytes
323 323
             if ($phpNoSelfCompress) {
324
-                header('Content-Length: ' . (int)strlen($payload));
324
+                header('Content-Length: '.(int) strlen($payload));
325 325
             }
326 326
         } else {
327
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
327
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
328 328
         }
329 329
 
330 330
         print $payload;
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
             $numParams = count($in);
383 383
         }
384 384
         foreach ($sigs as $curSig) {
385
-            if (count($curSig) == $numParams + 1) {
385
+            if (count($curSig) == $numParams+1) {
386 386
                 $itsOK = 1;
387
-                for ($n = 0; $n < $numParams; $n++) {
387
+                for ($n = 0; $n<$numParams; $n++) {
388 388
                     if (is_object($in)) {
389 389
                         $p = $in->getParam($n);
390 390
                         if ($p->kindOf() == 'scalar') {
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
                     }
398 398
 
399 399
                     // param index is $n+1, as first member of sig is return type
400
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
400
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
401 401
                         $itsOK = 0;
402
-                        $pno = $n + 1;
403
-                        $wanted = $curSig[$n + 1];
402
+                        $pno = $n+1;
403
+                        $wanted = $curSig[$n+1];
404 404
                         $got = $pt;
405 405
                         break;
406 406
                     }
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
         // check if $_SERVER is populated: it might have been disabled via ini file
428 428
         // (this is true even when in CLI mode)
429 429
         if (count($_SERVER) == 0) {
430
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
430
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
431 431
         }
432 432
 
433
-        if ($this->debug > 1) {
433
+        if ($this->debug>1) {
434 434
             if (function_exists('getallheaders')) {
435 435
                 $this->debugmsg(''); // empty line
436 436
                 foreach (getallheaders() as $name => $val) {
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
456 456
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
457 457
                         $data = $degzdata;
458
-                        if ($this->debug > 1) {
459
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
458
+                        if ($this->debug>1) {
459
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
460 460
                         }
461 461
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
462 462
                         $data = $degzdata;
463
-                        if ($this->debug > 1) {
464
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
463
+                        if ($this->debug>1) {
464
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
465 465
                         }
466 466
                     } else {
467 467
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'],
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
                     if ($reqEncoding == 'ISO-8859-1') {
549 549
                         $data = utf8_encode($data);
550 550
                     } else {
551
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received request: ' . $reqEncoding);
551
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received request: '.$reqEncoding);
552 552
                     }
553 553
                 }
554 554
             }
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
576 576
             return new Response(
577 577
                 0,
578
-                PhpXmlRpc::$xmlrpcerrxml + (int)$matches[1],
578
+                PhpXmlRpc::$xmlrpcerrxml+(int) $matches[1],
579 579
                 $xmlRpcParser->_xh['isf_reason']);
580 580
         } elseif ($xmlRpcParser->_xh['isf']) {
581 581
             /// @todo separate better the various cases, as we have done in Request::parseResponse: invalid xml-rpc,
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
             return new Response(
584 584
                 0,
585 585
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
586
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
586
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
587 587
         } else {
588 588
             // small layering violation in favor of speed and memory usage: we should allow the 'execute' method handle
589 589
             // this, but in the most common scenario (xml-rpc values type server with some methods registered as phpvals)
@@ -593,20 +593,20 @@  discard block
 block discarded – undo
593 593
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] != 'xmlrpcvals')
594 594
                 )
595 595
             ) {
596
-                if ($this->debug > 1) {
597
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
596
+                if ($this->debug>1) {
597
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
598 598
                 }
599 599
 
600 600
                 return $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
601 601
             } else {
602 602
                 // build a Request object with data parsed from xml and add parameters in
603 603
                 $req = new Request($xmlRpcParser->_xh['method']);
604
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
604
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
605 605
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
606 606
                 }
607 607
 
608
-                if ($this->debug > 1) {
609
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
608
+                if ($this->debug>1) {
609
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
610 610
                 }
611 611
 
612 612
                 return $this->execute($req);
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                 return new Response(
659 659
                     0,
660 660
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
661
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": {$errStr}"
661
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": {$errStr}"
662 662
                 );
663 663
             }
664 664
         }
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         // build string representation of function 'name'
674 674
         if (is_array($func)) {
675 675
             if (is_object($func[0])) {
676
-                $funcName = get_class($func[0]) . '->' . $func[1];
676
+                $funcName = get_class($func[0]).'->'.$func[1];
677 677
             } else {
678 678
                 $funcName = implode('::', $func);
679 679
             }
@@ -685,17 +685,17 @@  discard block
 block discarded – undo
685 685
 
686 686
         // verify that function to be invoked is in fact callable
687 687
         if (!is_callable($func)) {
688
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
688
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
689 689
             return new Response(
690 690
                 0,
691 691
                 PhpXmlRpc::$xmlrpcerr['server_error'],
692
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
692
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
693 693
             );
694 694
         }
695 695
 
696 696
         // If debug level is 3, we should catch all errors generated during processing of user function, and log them
697 697
         // as part of response
698
-        if ($this->debug > 2) {
698
+        if ($this->debug>2) {
699 699
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
700 700
         }
701 701
 
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
                     $r = call_user_func($func, $req);
710 710
                 }
711 711
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
712
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
712
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
713 713
                     if (is_a($r, 'PhpXmlRpc\Value')) {
714 714
                         $r = new Response($r);
715 715
                     } else {
716 716
                         $r = new Response(
717 717
                             0,
718 718
                             PhpXmlRpc::$xmlrpcerr['server_error'],
719
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
719
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
720 720
                         );
721 721
                     }
722 722
                 }
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
                         $r = call_user_func_array($func, array($methodName, $params, $this->user_data));
732 732
                         // mimic EPI behaviour: if we get an array that looks like an error, make it an error response
733 733
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
734
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
734
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
735 735
                         } else {
736 736
                             // functions using EPI api should NOT return resp objects, so make sure we encode the
737 737
                             // return type correctly
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             // proper error-response
756 756
             switch ($this->exception_handling) {
757 757
                 case 2:
758
-                    if ($this->debug > 2) {
758
+                    if ($this->debug>2) {
759 759
                         if (self::$_xmlrpcs_prev_ehandler) {
760 760
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
761 761
                         } else {
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
             // proper error-response
779 779
             switch ($this->exception_handling) {
780 780
                 case 2:
781
-                    if ($this->debug > 2) {
781
+                    if ($this->debug>2) {
782 782
                         if (self::$_xmlrpcs_prev_ehandler) {
783 783
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
784 784
                         } else {
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
             }
799 799
         }
800 800
 
801
-        if ($this->debug > 2) {
801
+        if ($this->debug>2) {
802 802
             // note: restore the error handler we found before calling the user func, even if it has been changed
803 803
             // inside the func itself
804 804
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
      */
865 865
     protected function debugmsg($string)
866 866
     {
867
-        $this->debug_info .= $string . "\n";
867
+        $this->debug_info .= $string."\n";
868 868
     }
869 869
 
870 870
     /**
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
     protected function xml_header($charsetEncoding = '')
875 875
     {
876 876
         if ($charsetEncoding != '') {
877
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
877
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
878 878
         } else {
879
-            return "<?xml version=\"1.0\"?" . ">\n";
879
+            return "<?xml version=\"1.0\"?".">\n";
880 880
         }
881 881
     }
882 882
 
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                 $i++; // for error message, we count params from 1
1170 1170
                 return static::_xmlrpcs_multicall_error(new Response(0,
1171 1171
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
1172
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
1172
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
1173 1173
             }
1174 1174
         }
1175 1175
 
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
             }
1251 1251
         } else {
1252 1252
             $numCalls = count($req);
1253
-            for ($i = 0; $i < $numCalls; $i++) {
1253
+            for ($i = 0; $i<$numCalls; $i++) {
1254 1254
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1255 1255
             }
1256 1256
         }
Please login to merge, or discard this patch.
src/Helper/Charset.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
                 if (count($this->xml_iso88591_Entities['in'])) {
76 76
                     return;
77 77
                 }
78
-                for ($i = 0; $i < 32; $i++) {
78
+                for ($i = 0; $i<32; $i++) {
79 79
                     $this->xml_iso88591_Entities["in"][] = chr($i);
80 80
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
81 81
                 }
82 82
 
83 83
                 /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
84 84
 
85
-                for ($i = 160; $i < 256; $i++) {
85
+                for ($i = 160; $i<256; $i++) {
86 86
                     $this->xml_iso88591_Entities["in"][] = chr($i);
87 87
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
88 88
                 }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
                 break;*/
111 111
 
112 112
             default:
113
-                throw new \Exception('Unsupported table: ' . $tableName);
113
+                throw new \Exception('Unsupported table: '.$tableName);
114 114
         }
115 115
     }
116 116
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             $srcEncoding = 'UTF-8';
163 163
         }
164 164
 
165
-        $conversion = strtoupper($srcEncoding . '_' . $destEncoding);
165
+        $conversion = strtoupper($srcEncoding.'_'.$destEncoding);
166 166
 
167 167
         // list ordered with (expected) most common scenarios first
168 168
         switch ($conversion) {
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
                 // NB: this will choke on invalid UTF-8, going most likely beyond EOF
181 181
                 $escapedData = '';
182 182
                 // be kind to users creating string xml-rpc values out of different php types
183
-                $data = (string)$data;
183
+                $data = (string) $data;
184 184
                 $ns = strlen($data);
185
-                for ($nn = 0; $nn < $ns; $nn++) {
185
+                for ($nn = 0; $nn<$ns; $nn++) {
186 186
                     $ch = $data[$nn];
187 187
                     $ii = ord($ch);
188 188
                     // 7 bits in 1 byte: 0bbbbbbb (127)
189
-                    if ($ii < 32) {
189
+                    if ($ii<32) {
190 190
                         if ($conversion == 'UTF-8_US-ASCII') {
191 191
                             $escapedData .= sprintf('&#%d;', $ii);
192 192
                         } else {
193 193
                             $escapedData .= $ch;
194 194
                         }
195 195
                     }
196
-                    else if ($ii < 128) {
196
+                    else if ($ii<128) {
197 197
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
198 198
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
199 199
                         switch ($ii) {
@@ -218,25 +218,25 @@  discard block
 block discarded – undo
218 218
                     } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047)
219 219
                     elseif ($ii >> 5 == 6) {
220 220
                         $b1 = ($ii & 31);
221
-                        $b2 = (ord($data[$nn + 1]) & 63);
222
-                        $ii = ($b1 * 64) + $b2;
221
+                        $b2 = (ord($data[$nn+1]) & 63);
222
+                        $ii = ($b1 * 64)+$b2;
223 223
                         $escapedData .= sprintf('&#%d;', $ii);
224 224
                         $nn += 1;
225 225
                     } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb
226 226
                     elseif ($ii >> 4 == 14) {
227 227
                         $b1 = ($ii & 15);
228
-                        $b2 = (ord($data[$nn + 1]) & 63);
229
-                        $b3 = (ord($data[$nn + 2]) & 63);
230
-                        $ii = ((($b1 * 64) + $b2) * 64) + $b3;
228
+                        $b2 = (ord($data[$nn+1]) & 63);
229
+                        $b3 = (ord($data[$nn+2]) & 63);
230
+                        $ii = ((($b1 * 64)+$b2) * 64)+$b3;
231 231
                         $escapedData .= sprintf('&#%d;', $ii);
232 232
                         $nn += 2;
233 233
                     } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
234 234
                     elseif ($ii >> 3 == 30) {
235 235
                         $b1 = ($ii & 7);
236
-                        $b2 = (ord($data[$nn + 1]) & 63);
237
-                        $b3 = (ord($data[$nn + 2]) & 63);
238
-                        $b4 = (ord($data[$nn + 3]) & 63);
239
-                        $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
236
+                        $b2 = (ord($data[$nn+1]) & 63);
237
+                        $b3 = (ord($data[$nn+2]) & 63);
238
+                        $b4 = (ord($data[$nn+3]) & 63);
239
+                        $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4;
240 240
                         $escapedData .= sprintf('&#%d;', $ii);
241 241
                         $nn += 3;
242 242
                     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                     // If src is UTF8, we run htmlspecialchars before converting to the target charset, as
290 290
                     // htmlspecialchars has limited charset support, but it groks utf8
291 291
                     if ($srcEncoding === 'UTF-8') {
292
-                        $data = htmlspecialchars($data,  defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
292
+                        $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8');
293 293
                     }
294 294
                     if ($srcEncoding !== $destEncoding) {
295 295
                         try {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                     }
302 302
                     if ($data === false) {
303 303
                         $escapedData = '';
304
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
304
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed...");
305 305
                     } else {
306 306
                         if ($srcEncoding === 'UTF-8') {
307 307
                             $escapedData = $data;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                     }
312 312
                 } else {
313 313
                     $escapedData = '';
314
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported...");
314
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported...");
315 315
                 }
316 316
         }
317 317
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         if (function_exists('mb_list_encodings')) {
330 330
             $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array(
331 331
                 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable',
332
-                '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
332
+                '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le'
333 333
             ))));
334 334
         }
335 335
         return $knownCharsets;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             case 'iso88591':
384 384
                 return $this->xml_iso88591_Entities;
385 385
             default:
386
-                throw new \Exception('Unsupported charset: ' . $charset);
386
+                throw new \Exception('Unsupported charset: '.$charset);
387 387
         }
388 388
     }
389 389
 }
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
         foreach ($mergedOptions as $key => $val) {
176 176
             // q: can php be built without ctype? should we use a regexp?
177 177
             if (is_string($key) && !ctype_digit($key)) {
178
-                switch($key) {
178
+                switch ($key) {
179 179
                     case 'target_charset':
180 180
                         if (function_exists('mb_convert_encoding')) {
181 181
                             $this->current_parsing_options['target_charset'] = $val;
182 182
                         } else {
183
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
183
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
184 184
                         }
185 185
                         break;
186 186
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                             //$this->_xh['isf'] = 4;
192 192
                             //$this->_xh['isf_reason'] = "Callback passed as 'methodname_callback' is not callable";
193 193
                             //return;
194
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
194
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
195 195
                         }
196 196
                         break;
197 197
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                         break;
203 203
 
204 204
                     default:
205
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
205
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key");
206 206
                 }
207 207
                 unset($mergedOptions[$key]);
208 208
             }
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 
249 249
         try {
250 250
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
251
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
251
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
252 252
                 $chunk = substr($data, $offset, $this->maxChunkLength);
253 253
                 // error handling: xml not well formed
254
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
254
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
255 255
                     $errCode = xml_get_error_code($parser);
256 256
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
257 257
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                     break;
262 262
                 }
263 263
                 // no need to parse further if we already have a fatal error
264
-                if ($this->_xh['isf'] >= 2) {
264
+                if ($this->_xh['isf']>=2) {
265 265
                     break;
266 266
                 }
267 267
             }
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
294 294
     {
295 295
         // if invalid xml-rpc already detected, skip all processing
296
-        if ($this->_xh['isf'] >= 2) {
296
+        if ($this->_xh['isf']>=2) {
297 297
             return;
298 298
         }
299 299
 
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 $this->_xh['rt'] = strtolower($name);
317 317
             } else {
318 318
                 $this->_xh['isf'] = 2;
319
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
319
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
320 320
 
321 321
                 return;
322 322
             }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
             case 'MEMBER':
420 420
                 // set member name to null, in case we do not find in the xml later on
421
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
421
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
422 422
                 //$this->_xh['ac']='';
423 423
                 // Drop trough intentionally
424 424
 
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
      */
493 493
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
494 494
     {
495
-        if ($this->_xh['isf'] >= 2) {
495
+        if ($this->_xh['isf']>=2) {
496 496
             return;
497 497
 
498 498
         }
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
515 515
                 }
516 516
 
517
-                if ($rebuildXmlrpcvals > 0) {
517
+                if ($rebuildXmlrpcvals>0) {
518 518
                     // build the xml-rpc val out of the data received, and substitute it
519 519
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
520 520
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -522,15 +522,15 @@  discard block
 block discarded – undo
522 522
                         $temp->_php_class = $this->_xh['php_class'];
523 523
                     }
524 524
                     $this->_xh['value'] = $temp;
525
-                } elseif ($rebuildXmlrpcvals < 0) {
525
+                } elseif ($rebuildXmlrpcvals<0) {
526 526
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
527
-                        $this->_xh['value'] = (object)array(
527
+                        $this->_xh['value'] = (object) array(
528 528
                             'xmlrpc_type' => 'datetime',
529 529
                             'scalar' => $this->_xh['value'],
530 530
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
531 531
                         );
532 532
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
533
-                        $this->_xh['value'] = (object)array(
533
+                        $this->_xh['value'] = (object) array(
534 534
                             'xmlrpc_type' => 'base64',
535 535
                             'scalar' => $this->_xh['value']
536 536
                         );
@@ -545,8 +545,8 @@  discard block
 block discarded – undo
545 545
                 // check if we are inside an array or struct:
546 546
                 // if value just built is inside an array, let's move it into array on the stack
547 547
                 $vscount = count($this->_xh['valuestack']);
548
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
549
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
548
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
549
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
550 550
                 }
551 551
                 break;
552 552
 
@@ -575,10 +575,10 @@  discard block
 block discarded – undo
575 575
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
576 576
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
577 577
                             $this->_xh['isf'] = 2;
578
-                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: ' . $this->truncateForLog($this->_xh['ac']);
578
+                            $this->_xh['isf_reason'] = 'Invalid data received in BOOLEAN value: '.$this->truncateForLog($this->_xh['ac']);
579 579
                             return;
580 580
                         } else {
581
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' .
581
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BOOLEAN value: '.
582 582
                                 $this->truncateForLog($this->_xh['ac']));
583 583
                         }
584 584
                     }
@@ -600,17 +600,17 @@  discard block
 block discarded – undo
600 600
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
601 601
                     {
602 602
                         $this->_xh['isf'] = 2;
603
-                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: ' . $this->truncateForLog($this->_xh['ac']);
603
+                        $this->_xh['isf_reason'] = 'Non numeric data received in INT value: '.$this->truncateForLog($this->_xh['ac']);
604 604
                         return;
605 605
                     } else {
606
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': non numeric data received in INT: ' .
606
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': non numeric data received in INT: '.
607 607
                             $this->truncateForLog($this->_xh['ac']));
608 608
                     }
609 609
                     /// @todo: find a better way of reporting an error value than this! Use NaN?
610 610
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
611 611
                 } else {
612 612
                     // it's ok, add it on
613
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
613
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
614 614
                 }
615 615
                 break;
616 616
 
@@ -620,18 +620,18 @@  discard block
 block discarded – undo
620 620
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
621 621
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
622 622
                         $this->_xh['isf'] = 2;
623
-                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: ' .
623
+                        $this->_xh['isf_reason'] = 'Non numeric data received in DOUBLE value: '.
624 624
                             $this->truncateForLog($this->_xh['ac']);
625 625
                         return;
626 626
                     } else {
627
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': non numeric data received in DOUBLE value: ' .
627
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': non numeric data received in DOUBLE value: '.
628 628
                             $this->truncateForLog($this->_xh['ac']));
629 629
                     }
630 630
 
631 631
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
632 632
                 } else {
633 633
                     // it's ok, add it on
634
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
634
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
635 635
                 }
636 636
                 break;
637 637
 
@@ -641,19 +641,19 @@  discard block
 block discarded – undo
641 641
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
642 642
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
643 643
                         $this->_xh['isf'] = 2;
644
-                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: ' . $this->truncateForLog($this->_xh['ac']);
644
+                        $this->_xh['isf_reason'] = 'Invalid data received in DATETIME value: '.$this->truncateForLog($this->_xh['ac']);
645 645
                         return;
646 646
                     } else {
647
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in DATETIME value: ' .
647
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in DATETIME value: '.
648 648
                             $this->truncateForLog($this->_xh['ac']));
649 649
                     }
650 650
                 }
651 651
                 if ($this->current_parsing_options['xmlrpc_return_datetimes']) {
652 652
                     try {
653 653
                         $this->_xh['value'] = new \DateTime($this->_xh['ac']);
654
-                    } catch(\Exception $e) {
654
+                    } catch (\Exception $e) {
655 655
                         // q: what to do? we can not guarantee that a valid date can be created. Return null or throw?
656
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': ' . $e->getMessage());
656
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': '.$e->getMessage());
657 657
                         $this->_xh['value'] = null;
658 658
                     }
659 659
                 } else {
@@ -668,14 +668,14 @@  discard block
 block discarded – undo
668 668
                     $v = base64_decode($this->_xh['ac'], true);
669 669
                     if ($v === false) {
670 670
                         $this->_xh['isf'] = 2;
671
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateForLog($this->_xh['ac']);
671
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateForLog($this->_xh['ac']);
672 672
                         return;
673 673
                     }
674 674
                 } else {
675 675
                     $v = base64_decode($this->_xh['ac']);
676 676
                     if ($v === '' && $this->_xh['ac'] !== '') {
677 677
                         // only the empty string should decode to the empty string
678
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
678
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
679 679
                             $this->truncateForLog($this->_xh['ac']));
680 680
                     }
681 681
                 }
@@ -683,31 +683,31 @@  discard block
 block discarded – undo
683 683
                 break;
684 684
 
685 685
             case 'NAME':
686
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
686
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
687 687
                 break;
688 688
 
689 689
             case 'MEMBER':
690 690
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
691 691
                 if ($this->_xh['vt']) {
692 692
                     $vscount = count($this->_xh['valuestack']);
693
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
693
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
694 694
                         if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
695 695
                             $this->_xh['isf'] = 2;
696 696
                             $this->_xh['isf_reason'] = 'Missing NAME inside STRUCT in received xml';
697 697
                             return;
698 698
                         } else {
699
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing NAME inside STRUCT in received xml');
699
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing NAME inside STRUCT in received xml');
700 700
                         }
701
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
701
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
702 702
                     }
703
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
703
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
704 704
                 } else {
705 705
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
706 706
                         $this->_xh['isf'] = 2;
707 707
                         $this->_xh['isf_reason'] = 'Missing VALUE inside STRUCT in received xml';
708 708
                         return;
709 709
                     } else {
710
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing VALUE inside STRUCT in received xml');
710
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing VALUE inside STRUCT in received xml');
711 711
                     }
712 712
                 }
713 713
                 break;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
                         $this->_xh['isf_reason'] = 'Missing VALUE inside PARAM in received xml';
739 739
                         return;
740 740
                     } else {
741
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': missing VALUE inside PARAM in received xml');
741
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': missing VALUE inside PARAM in received xml');
742 742
                     }
743 743
                 }
744 744
                 break;
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
                 if (!preg_match(PhpXmlRpc::$xmlrpc_methodname_format, $this->_xh['ac'])) {
748 748
                     if ($this->current_parsing_options['xmlrpc_reject_invalid_values']) {
749 749
                         $this->_xh['isf'] = 2;
750
-                        $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '. $this->truncateForLog($this->_xh['ac']);
750
+                        $this->_xh['isf_reason'] = 'Invalid data received in METHODNAME: '.$this->truncateForLog($this->_xh['ac']);
751 751
                         return;
752 752
                     } else {
753
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in METHODNAME: '.
753
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in METHODNAME: '.
754 754
                             $this->truncateForLog($this->_xh['ac']));
755 755
                     }
756 756
                 }
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
     public function xmlrpc_cd($parser, $data)
824 824
     {
825 825
         // skip processing if xml fault already detected
826
-        if ($this->_xh['isf'] >= 2) {
826
+        if ($this->_xh['isf']>=2) {
827 827
             return;
828 828
         }
829 829
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
     public function xmlrpc_dh($parser, $data)
846 846
     {
847 847
         // skip processing if xml fault already detected
848
-        if ($this->_xh['isf'] >= 2) {
848
+        if ($this->_xh['isf']>=2) {
849 849
             return;
850 850
         }
851 851
 
@@ -919,8 +919,8 @@  discard block
 block discarded – undo
919 919
         // Details:
920 920
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
921 921
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
922
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
923
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
922
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
923
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
924 924
             $xmlChunk, $matches)) {
925 925
             return strtoupper(substr($matches[2], 1, -1));
926 926
         }
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
939 939
             // IANA also likes better US-ASCII, so go with it
940 940
             if ($enc == 'ASCII') {
941
-                $enc = 'US-' . $enc;
941
+                $enc = 'US-'.$enc;
942 942
             }
943 943
 
944 944
             return $enc;
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
         // Details:
976 976
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
977 977
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
978
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
979
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
978
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
979
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
980 980
             $xmlChunk)) {
981 981
             return true;
982 982
         }
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
                 break;
997 997
             default:
998 998
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
999
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
999
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1000 1000
         }
1001 1001
     }
1002 1002
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
                 break;
1021 1021
             default:
1022 1022
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
1023
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1023
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1024 1024
         }
1025 1025
     }
1026 1026
 
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
      */
1032 1032
     protected function truncateForLog($data)
1033 1033
     {
1034
-        if (strlen($data) > $this->maxLogValueLength) {
1035
-            return substr($data, 0, $this->maxLogValueLength - 3) . '...';
1034
+        if (strlen($data)>$this->maxLogValueLength) {
1035
+            return substr($data, 0, $this->maxLogValueLength-3).'...';
1036 1036
         }
1037 1037
 
1038 1038
         return $data;
Please login to merge, or discard this patch.
src/Helper/Http.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
         // read chunk-size, chunk-extension (if any) and crlf
28 28
         // get the position of the linebreak
29
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
29
+        $chunkEnd = strpos($buffer, "\r\n")+2;
30 30
         $temp = substr($buffer, 0, $chunkEnd);
31 31
         $chunkSize = hexdec(trim($temp));
32 32
         $chunkStart = $chunkEnd;
33
-        while ($chunkSize > 0) {
34
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
33
+        while ($chunkSize>0) {
34
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
35 35
 
36 36
             // just in case we got a broken connection
37 37
             if ($chunkEnd == false) {
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
             }
44 44
 
45 45
             // read chunk-data and crlf
46
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
46
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
47 47
             // append chunk-data to entity-body
48 48
             $new .= $chunk;
49 49
             // length := length + chunk-size
50 50
             $length += strlen($chunk);
51 51
             // read chunk-size and crlf
52
-            $chunkStart = $chunkEnd + 2;
52
+            $chunkStart = $chunkEnd+2;
53 53
 
54
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
54
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
55 55
             if ($chunkEnd == false) {
56 56
                 break; // just in case we got a broken connection
57 57
             }
58
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
58
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
59 59
             $chunkSize = hexdec(trim($temp));
60 60
             $chunkStart = $chunkEnd;
61 61
         }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             // Look for CR/LF or simple LF as line separator (even though it is not valid http)
85 85
             $pos = strpos($data, "\r\n\r\n");
86 86
             if ($pos || is_int($pos)) {
87
-                $bd = $pos + 4;
87
+                $bd = $pos+4;
88 88
             } else {
89 89
                 $pos = strpos($data, "\n\n");
90 90
                 if ($pos || is_int($pos)) {
91
-                    $bd = $pos + 2;
91
+                    $bd = $pos+2;
92 92
                 } else {
93 93
                     // No separation between response headers and body: fault?
94 94
                     $bd = 0;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 // this filters out all http headers from proxy. maybe we could take them into account, too?
99 99
                 $data = substr($data, $bd);
100 100
             } else {
101
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
102
-                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
101
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
102
+                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
103 103
             }
104 104
         }
105 105
 
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         if ($httpResponse['status_code'] !== '200') {
135
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
136
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
137
-            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
135
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
136
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
137
+            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
138 138
         }
139 139
 
140 140
         // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http)
141 141
         $pos = strpos($data, "\r\n\r\n");
142 142
         if ($pos || is_int($pos)) {
143
-            $bd = $pos + 4;
143
+            $bd = $pos+4;
144 144
         } else {
145 145
             $pos = strpos($data, "\n\n");
146 146
             if ($pos || is_int($pos)) {
147
-                $bd = $pos + 2;
147
+                $bd = $pos+2;
148 148
             } else {
149 149
                 // No separation between response headers and body: fault?
150 150
                 // we could take some action here instead of going on...
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         foreach ($ar as $line) {
159 159
             // take care of multi-line headers and cookies
160 160
             $arr = explode(':', $line, 2);
161
-            if (count($arr) > 1) {
161
+            if (count($arr)>1) {
162 162
                 $headerName = strtolower(trim($arr[0]));
163 163
                 /// @todo some other headers (the ones that allow a CSV list of values) do allow many values to be
164 164
                 ///       passed using multiple header lines.
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                     foreach ($cookies as $cookie) {
176 176
                         // glue together all received cookies, using a comma to separate them (same as php does with getallheaders())
177 177
                         if (isset($httpResponse['headers'][$headerName])) {
178
-                            $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
178
+                            $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
179 179
                         } else {
180 180
                             $httpResponse['headers'][$headerName] = trim($cookie);
181 181
                         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 }
205 205
             } elseif (isset($headerName)) {
206 206
                 /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
207
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
207
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
208 208
             }
209 209
         }
210 210
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             // Decode chunked encoding sent by http 1.1 servers
228 228
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
229 229
                 if (!$data = static::decodeChunked($data)) {
230
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
230
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
231 231
                     throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']);
232 232
                 }
233 233
             }
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
243 243
                             $data = $degzdata;
244 244
                             if ($debug) {
245
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
245
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
246 246
                             }
247 247
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
248 248
                             $data = $degzdata;
249 249
                             if ($debug) {
250
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
250
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
251 251
                             }
252 252
                         } else {
253
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
253
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
254 254
                             throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']);
255 255
                         }
256 256
                     } else {
257
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
257
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
258 258
                         throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']);
259 259
                     }
260 260
                 }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     public function parseAcceptHeader($header)
275 275
     {
276 276
         $accepted = array();
277
-        foreach(explode(',', $header) as $c) {
277
+        foreach (explode(',', $header) as $c) {
278 278
             if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) {
279 279
                 $c = $matches[1];
280 280
                 $w = $matches[2];
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
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $this->me['struct'] = $val;
94 94
                     break;
95 95
                 default:
96
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
96
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)");
97 97
             }
98 98
         }
99 99
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         if ($typeOf !== 1) {
120
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
120
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
121 121
             return 0;
122 122
         }
123 123
 
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
         switch ($this->mytype) {
136 136
             case 1:
137
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
137
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
138 138
                 return 0;
139 139
             case 3:
140
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
140
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
141 141
                 return 0;
142 142
             case 2:
143 143
                 // we're adding a scalar value to an array here
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
             return 1;
181 181
         } else {
182
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
182
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
183 183
             return 0;
184 184
         }
185 185
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             return 1;
211 211
         } else {
212
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
212
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
213 213
             return 0;
214 214
         }
215 215
     }
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
             case 1:
252 252
                 switch ($typ) {
253 253
                     case static::$xmlrpcBase64:
254
-                        $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
254
+                        $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>";
255 255
                         break;
256 256
                     case static::$xmlrpcBoolean:
257
-                        $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
257
+                        $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>";
258 258
                         break;
259 259
                     case static::$xmlrpcString:
260 260
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
261
-                        $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>";
261
+                        $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>";
262 262
                         break;
263 263
                     case static::$xmlrpcInt:
264 264
                     case static::$xmlrpcI4:
265 265
                     case static::$xmlrpcI8:
266
-                        $rs .= "<{$typ}>" . (int)$val . "</{$typ}>";
266
+                        $rs .= "<{$typ}>".(int) $val."</{$typ}>";
267 267
                         break;
268 268
                     case static::$xmlrpcDouble:
269 269
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
                         // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14.
272 272
                         // The code below tries its best at keeping max precision while avoiding exp notation,
273 273
                         // but there is of course no limit in the number of decimal places to be used...
274
-                        $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>";
274
+                        $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>";
275 275
                         break;
276 276
                     case static::$xmlrpcDateTime:
277 277
                         if (is_string($val)) {
278 278
                             $rs .= "<{$typ}>{$val}</{$typ}>";
279 279
                         // DateTimeInterface is not present in php 5.4...
280 280
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
281
-                            $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>";
281
+                            $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>";
282 282
                         } elseif (is_int($val)) {
283
-                            $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>";
283
+                            $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>";
284 284
                         } else {
285 285
                             // not really a good idea here: but what should we output anyway? left for backward compat...
286 286
                             $rs .= "<{$typ}>{$val}</{$typ}>";
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
             case 3:
303 303
                 // struct
304 304
                 if ($this->_php_class) {
305
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
305
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
306 306
                 } else {
307 307
                     $rs .= "<struct>\n";
308 308
                 }
309 309
                 $charsetEncoder = $this->getCharsetEncoder();
310 310
                 /** @var Value $val2 */
311 311
                 foreach ($val as $key2 => $val2) {
312
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
312
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
313 313
                     //$rs.=$this->serializeval($val2);
314 314
                     $rs .= $val2->serialize($charsetEncoding);
315 315
                     $rs .= "</member>\n";
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $val = reset($this->me);
345 345
         $typ = key($this->me);
346 346
 
347
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
347
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
348 348
     }
349 349
 
350 350
     /**
Please login to merge, or discard this patch.
src/Wrapper.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
             $callable = explode('::', $callable);
174 174
         }
175 175
         if (is_array($callable)) {
176
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
177
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
176
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
177
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
178 178
                 return false;
179 179
             }
180 180
             if (is_string($callable[0])) {
181 181
                 $plainFuncName = implode('::', $callable);
182 182
             } elseif (is_object($callable[0])) {
183
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
183
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
184 184
             }
185 185
             $exists = method_exists($callable[0], $callable[1]);
186 186
         } else if ($callable instanceof \Closure) {
187 187
             // we do not support creating code which wraps closures, as php does not allow to serialize them
188 188
             if (!$buildIt) {
189
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
189
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
190 190
                 return false;
191 191
             }
192 192
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         }
199 199
 
200 200
         if (!$exists) {
201
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
201
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
202 202
             return false;
203 203
         }
204 204
 
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
         if (is_array($callable)) {
243 243
             $func = new \ReflectionMethod($callable[0], $callable[1]);
244 244
             if ($func->isPrivate()) {
245
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
245
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
246 246
                 return false;
247 247
             }
248 248
             if ($func->isProtected()) {
249
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
249
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
250 250
                 return false;
251 251
             }
252 252
             if ($func->isConstructor()) {
253
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
253
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
254 254
                 return false;
255 255
             }
256 256
             if ($func->isDestructor()) {
257
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
257
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
258 258
                 return false;
259 259
             }
260 260
             if ($func->isAbstract()) {
261
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
261
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
262 262
                 return false;
263 263
             }
264 264
             /// @todo add more checks for static vs. nonstatic?
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         if ($func->isInternal()) {
269 269
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
270 270
             ///       reflect internal php functions
271
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
271
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
272 272
             return false;
273 273
         }
274 274
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $i = 0;
321 321
         foreach ($func->getParameters() as $paramObj) {
322 322
             $params[$i] = array();
323
-            $params[$i]['name'] = '$' . $paramObj->getName();
323
+            $params[$i]['name'] = '$'.$paramObj->getName();
324 324
             $params[$i]['isoptional'] = $paramObj->isOptional();
325 325
             $i++;
326 326
         }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             // build a signature
385 385
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
386 386
             $pSig = array($funcDesc['returnsDocs']);
387
-            for ($i = 0; $i < count($pars); $i++) {
387
+            for ($i = 0; $i<count($pars); $i++) {
388 388
                 $name = strtolower($funcDesc['params'][$i]['name']);
389 389
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
390 390
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                 }
441 441
             }
442 442
             $numPars = $req->getNumParams();
443
-            if ($numPars < $minPars || $numPars > $maxPars) {
443
+            if ($numPars<$minPars || $numPars>$maxPars) {
444 444
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
445 445
             }
446 446
 
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
             $result = call_user_func_array($callable, $params);
455 455
 
456
-            if (! is_a($result, $responseClass)) {
456
+            if (!is_a($result, $responseClass)) {
457 457
                 // q: why not do the same for int, float, bool, string?
458 458
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
459 459
                     $result = new $valueClass($result, $funcDesc['returns']);
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
         if ($newFuncName == '') {
493 493
             if (is_array($callable)) {
494 494
                 if (is_string($callable[0])) {
495
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
495
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
496 496
                 } else {
497
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
497
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
498 498
                 }
499 499
             } else {
500 500
                 if ($callable instanceof \Closure) {
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
      */
527 527
     protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc)
528 528
     {
529
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
530
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
531
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
529
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
530
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
531
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
532 532
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
533 533
 
534 534
         $i = 0;
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
         // build body of new function
564 564
 
565 565
         $innerCode = "  \$paramCount = \$req->getNumParams();\n";
566
-        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
566
+        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
567 567
 
568
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
568
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
569 569
         if ($decodePhpObjects) {
570 570
             $innerCode .= "  \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n";
571 571
         } else {
@@ -578,23 +578,23 @@  discard block
 block discarded – undo
578 578
             static::holdObject($newFuncName, $callable[0]);
579 579
             $class = get_class($callable[0]);
580 580
             if ($class[0] !== '\\') {
581
-                $class = '\\' . $class;
581
+                $class = '\\'.$class;
582 582
             }
583 583
             $innerCode .= "  /// @var $class \$obj\n";
584 584
             $innerCode .= "  \$obj = PhpXmlRpc\\Wrapper::getHeldObject('$newFuncName');\n";
585
-            $realFuncName = '$obj->' . $callable[1];
585
+            $realFuncName = '$obj->'.$callable[1];
586 586
         } else {
587 587
             $realFuncName = $plainFuncName;
588 588
         }
589 589
         foreach ($parsVariations as $i => $pars) {
590
-            $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
591
-            if ($i < (count($parsVariations) - 1))
590
+            $innerCode .= "  if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
591
+            if ($i<(count($parsVariations)-1))
592 592
                 $innerCode .= "  else\n";
593 593
         }
594
-        $innerCode .= "  if (is_a(\$retVal, '" . static::$namespace . "Response'))\n    return \$retVal;\n  else\n";
594
+        $innerCode .= "  if (is_a(\$retVal, '".static::$namespace."Response'))\n    return \$retVal;\n  else\n";
595 595
         /// q: why not do the same for int, float, bool, string?
596 596
         if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
597
-            $innerCode .= "    return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));";
597
+            $innerCode .= "    return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));";
598 598
         } else {
599 599
             $encodeOptions = array();
600 600
             if ($encodeNulls) {
@@ -605,18 +605,18 @@  discard block
 block discarded – undo
605 605
             }
606 606
 
607 607
             if ($encodeOptions) {
608
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" .
609
-                    implode("', '", $encodeOptions) . "')));";
608
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('".
609
+                    implode("', '", $encodeOptions)."')));";
610 610
             } else {
611
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));";
611
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal));";
612 612
             }
613 613
         }
614 614
         // shall we exclude functions returning by ref?
615 615
         // if ($func->returnsReference())
616 616
         //     return false;
617 617
 
618
-        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" .
619
-            "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}";
618
+        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n".
619
+            "function $newFuncName(\$req)\n{\n".$innerCode."\n}";
620 620
 
621 621
         return $code;
622 622
     }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
671 671
     {
672 672
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
673
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
673
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
674 674
         }
675 675
 
676 676
         if (is_object($className)) {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         } else {
679 679
             $realClassName = $className;
680 680
         }
681
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
681
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
682 682
     }
683 683
 
684 684
     /**
@@ -761,21 +761,21 @@  discard block
 block discarded – undo
761 761
      */
762 762
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
763 763
     {
764
-        $reqClass = static::$namespace . 'Request';
765
-        $valClass = static::$namespace . 'Value';
766
-        $decoderClass = static::$namespace . 'Encoder';
764
+        $reqClass = static::$namespace.'Request';
765
+        $valClass = static::$namespace.'Value';
766
+        $decoderClass = static::$namespace.'Encoder';
767 767
 
768 768
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
769
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
769
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
770 770
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
771
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
771
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
772 772
 
773 773
         $req = new $reqClass('system.methodSignature');
774 774
         $req->addparam(new $valClass($methodName));
775 775
         $client->setDebug($debug);
776 776
         $response = $client->send($req, $timeout, $protocol);
777 777
         if ($response->faultCode()) {
778
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
778
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
779 779
             return false;
780 780
         }
781 781
 
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
             $mSig = $decoder->decode($mSig);
787 787
         }
788 788
 
789
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
790
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
789
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
790
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
791 791
             return false;
792 792
         }
793 793
 
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
      */
803 803
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
804 804
     {
805
-        $reqClass = static::$namespace . 'Request';
806
-        $valClass = static::$namespace . 'Value';
805
+        $reqClass = static::$namespace.'Request';
806
+        $valClass = static::$namespace.'Value';
807 807
 
808 808
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
809
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
809
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
810 810
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
811 811
 
812 812
         $mDesc = '';
@@ -840,11 +840,11 @@  discard block
 block discarded – undo
840 840
         $clientClone = clone $client;
841 841
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
842 842
         {
843
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
843
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
844 844
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
845
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
846
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
847
-            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
845
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
846
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
847
+            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
848 848
             $throwFault = false;
849 849
             $decodeFault = false;
850 850
             $faultResponse = null;
@@ -855,9 +855,9 @@  discard block
 block discarded – undo
855 855
                 $faultResponse = $extraOptions['return_on_fault'];
856 856
             }
857 857
 
858
-            $reqClass = static::$namespace . 'Request';
859
-            $encoderClass = static::$namespace . 'Encoder';
860
-            $valueClass = static::$namespace . 'Value';
858
+            $reqClass = static::$namespace.'Request';
859
+            $encoderClass = static::$namespace.'Encoder';
860
+            $valueClass = static::$namespace.'Value';
861 861
 
862 862
             $encoder = new $encoderClass();
863 863
             $encodeOptions = array();
@@ -939,14 +939,14 @@  discard block
 block discarded – undo
939 939
      * @param string $mDesc
940 940
      * @return string[] keys: source, docstring
941 941
      */
942
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
942
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
943 943
     {
944
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
944
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
945 945
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
946
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
947
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
948
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
949
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
946
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
947
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
948
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
949
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
950 950
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
951 951
         $throwFault = false;
952 952
         $decodeFault = false;
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
         }
960 960
 
961 961
         $code = "function $newFuncName(";
962
-        if ($clientCopyMode < 2) {
962
+        if ($clientCopyMode<2) {
963 963
             // client copy mode 0 or 1 == full / partial client copy in emitted code
964 964
             $verbatimClientCopy = !$clientCopyMode;
965
-            $innerCode = '  ' . str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
965
+            $innerCode = '  '.str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
966 966
             $innerCode .= "\$client->setDebug(\$debug);\n";
967 967
             $this_ = '';
968 968
         } else {
@@ -970,28 +970,28 @@  discard block
 block discarded – undo
970 970
             $innerCode = '';
971 971
             $this_ = 'this->';
972 972
         }
973
-        $innerCode .= "  \$req = new " . static::$namespace . "Request('$methodName');\n";
973
+        $innerCode .= "  \$req = new ".static::$namespace."Request('$methodName');\n";
974 974
 
975 975
         if ($mDesc != '') {
976 976
             // take care that PHP comment is not terminated unwillingly by method description
977 977
             /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags...
978
-            $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n";
978
+            $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n";
979 979
         } else {
980 980
             $mDesc = "/**\n * Function $newFuncName.\n";
981 981
         }
982 982
 
983 983
         // param parsing
984
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
984
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
985 985
         $plist = array();
986 986
         $pCount = count($mSig);
987
-        for ($i = 1; $i < $pCount; $i++) {
987
+        for ($i = 1; $i<$pCount; $i++) {
988 988
             $plist[] = "\$p$i";
989 989
             $pType = $mSig[$i];
990 990
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
991 991
                 $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null'
992 992
             ) {
993 993
                 // only build directly xml-rpc values when type is known and scalar
994
-                $innerCode .= "  \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n";
994
+                $innerCode .= "  \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n";
995 995
             } else {
996 996
                 if ($encodePhpObjects || $encodeNulls) {
997 997
                     $encOpts = array();
@@ -1002,26 +1002,26 @@  discard block
 block discarded – undo
1002 1002
                         $encOpts[] = 'null_extension';
1003 1003
                     }
1004 1004
 
1005
-                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n";
1005
+                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n";
1006 1006
                 } else {
1007 1007
                     $innerCode .= "  \$p$i = \$encoder->encode(\$p$i);\n";
1008 1008
                 }
1009 1009
             }
1010 1010
             $innerCode .= "  \$req->addparam(\$p$i);\n";
1011
-            $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
1011
+            $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n";
1012 1012
         }
1013
-        if ($clientCopyMode < 2) {
1013
+        if ($clientCopyMode<2) {
1014 1014
             $plist[] = '$debug = 0';
1015 1015
             $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
1016 1016
         }
1017 1017
         $plist = implode(', ', $plist);
1018
-        $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]);
1018
+        $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]);
1019 1019
         if ($throwFault) {
1020
-            $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\Exception');
1020
+            $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\Exception');
1021 1021
         } else if ($decodeFault) {
1022
-            $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)";
1022
+            $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)";
1023 1023
         } else {
1024
-            $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)";
1024
+            $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)";
1025 1025
         }
1026 1026
         $mDesc .= "\n */\n";
1027 1027
 
@@ -1033,9 +1033,9 @@  discard block
 block discarded – undo
1033 1033
             $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())";
1034 1034
         } else if ($decodeFault) {
1035 1035
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1036
-                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1036
+                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1037 1037
             } else {
1038
-                $respCode = 'return ' . var_export($faultResponse, true);
1038
+                $respCode = 'return '.var_export($faultResponse, true);
1039 1039
             }
1040 1040
         } else {
1041 1041
             $respCode = 'return $res';
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
             $innerCode .= "  if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());";
1047 1047
         }
1048 1048
 
1049
-        $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n";
1049
+        $code = $code.$plist.")\n{\n".$innerCode."\n}\n";
1050 1050
 
1051 1051
         return array('source' => $code, 'docstring' => $mDesc);
1052 1052
     }
@@ -1073,25 +1073,25 @@  discard block
 block discarded – undo
1073 1073
     public function wrapXmlrpcServer($client, $extraOptions = array())
1074 1074
     {
1075 1075
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1076
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1076
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1077 1077
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1078 1078
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1079
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
1080
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1081
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1079
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
1080
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1081
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1082 1082
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1083
-        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false;
1083
+        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false;
1084 1084
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1085 1085
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1086 1086
 
1087
-        $reqClass = static::$namespace . 'Request';
1088
-        $decoderClass = static::$namespace . 'Encoder';
1087
+        $reqClass = static::$namespace.'Request';
1088
+        $decoderClass = static::$namespace.'Encoder';
1089 1089
 
1090 1090
         // retrieve the list of methods
1091 1091
         $req = new $reqClass('system.listMethods');
1092 1092
         $response = $client->send($req, $timeout, $protocol);
1093 1093
         if ($response->faultCode()) {
1094
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1094
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1095 1095
 
1096 1096
             return false;
1097 1097
         }
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
             $mList = $decoder->decode($mList);
1103 1103
         }
1104 1104
         if (!is_array($mList) || !count($mList)) {
1105
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1105
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1106 1106
 
1107 1107
             return false;
1108 1108
         }
@@ -1111,8 +1111,8 @@  discard block
 block discarded – undo
1111 1111
         if ($newClassName != '') {
1112 1112
             $xmlrpcClassName = $newClassName;
1113 1113
         } else {
1114
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1115
-                    array('_', ''), $client->server) . '_client';
1114
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1115
+                    array('_', ''), $client->server).'_client';
1116 1116
         }
1117 1117
         while ($buildIt && class_exists($xmlrpcClassName)) {
1118 1118
             $xmlrpcClassName .= 'x';
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
         /// @todo add method setDebug() to new class, to enable/disable debugging
1122 1122
         $source = "class $xmlrpcClassName\n{\n  public \$client;\n\n";
1123 1123
         $source .= "  function __construct()\n  {\n";
1124
-        $source .= '    ' . str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1124
+        $source .= '    '.str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1125 1125
         $source .= "\$this->client = \$client;\n  }\n\n";
1126 1126
         $opts = array(
1127 1127
             'return_source' => true,
@@ -1144,26 +1144,26 @@  discard block
 block discarded – undo
1144 1144
                 $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts);
1145 1145
                 if ($methodWrap) {
1146 1146
                     if ($buildIt) {
1147
-                        $source .= $methodWrap['source'] . "\n";
1147
+                        $source .= $methodWrap['source']."\n";
1148 1148
 
1149 1149
                     } else {
1150
-                        $source .= '  ' . str_replace("\n", "\n  ", $methodWrap['docstring']);
1151
-                        $source .= str_replace("\n", "\n  ", $methodWrap['source']). "\n";
1150
+                        $source .= '  '.str_replace("\n", "\n  ", $methodWrap['docstring']);
1151
+                        $source .= str_replace("\n", "\n  ", $methodWrap['source'])."\n";
1152 1152
                     }
1153 1153
 
1154 1154
                 } else {
1155
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1155
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1156 1156
                 }
1157 1157
             }
1158 1158
         }
1159 1159
         $source .= "}\n";
1160 1160
         if ($buildIt) {
1161 1161
             $allOK = 0;
1162
-            eval($source . '$allOK=1;');
1162
+            eval($source.'$allOK=1;');
1163 1163
             if ($allOK) {
1164 1164
                 return $xmlrpcClassName;
1165 1165
             } else {
1166
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1166
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1167 1167
                 return false;
1168 1168
             }
1169 1169
         } else {
@@ -1182,8 +1182,8 @@  discard block
 block discarded – undo
1182 1182
      */
1183 1183
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1184 1184
     {
1185
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path) .
1186
-            "', '" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server) . "', $client->port);\n";
1185
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path).
1186
+            "', '".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server)."', $client->port);\n";
1187 1187
 
1188 1188
         // copy all client fields to the client that will be generated runtime
1189 1189
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.