Passed
Push — master ( 70331e...a29e12 )
by Gaetano
09:40
created
src/Client.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             $server = $parts['host'];
136 136
             $path = isset($parts['path']) ? $parts['path'] : '';
137 137
             if (isset($parts['query'])) {
138
-                $path .= '?' . $parts['query'];
138
+                $path .= '?'.$parts['query'];
139 139
             }
140 140
             if (isset($parts['fragment'])) {
141
-                $path .= '#' . $parts['fragment'];
141
+                $path .= '#'.$parts['fragment'];
142 142
             }
143 143
             if (isset($parts['port'])) {
144 144
                 $port = $parts['port'];
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             }
155 155
         }
156 156
         if ($path == '' || $path[0] != '/') {
157
-            $this->path = '/' . $path;
157
+            $this->path = '/'.$path;
158 158
         } else {
159 159
             $this->path = $path;
160 160
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         }*/
193 193
 
194 194
         // initialize user_agent string
195
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
195
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
196 196
     }
197 197
 
198 198
     /**
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
      */
565 565
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
566 566
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
567
-        $method='http')
567
+        $method = 'http')
568 568
     {
569 569
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
570 570
 
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
      * @param int $sslVersion
597 597
      * @return Response
598 598
      */
599
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
599
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
600 600
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
601 601
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
602 602
         $sslVersion = 0)
@@ -633,11 +633,11 @@  discard block
 block discarded – undo
633 633
      */
634 634
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
635 635
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
636
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
636
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
637 637
         $sslVersion = 0)
638 638
     {
639 639
         if ($port == 0) {
640
-            $port = ( $method === 'https' ) ? 443 : 80;
640
+            $port = ($method === 'https') ? 443 : 80;
641 641
         }
642 642
 
643 643
         // Only create the payload if it was not created previously
@@ -667,15 +667,15 @@  discard block
 block discarded – undo
667 667
         // thanks to Grant Rauscher <[email protected]> for this
668 668
         $credentials = '';
669 669
         if ($username != '') {
670
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
670
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
671 671
             if ($authType != 1) {
672
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
672
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
673 673
             }
674 674
         }
675 675
 
676 676
         $acceptedEncoding = '';
677 677
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
678
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
678
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
679 679
         }
680 680
 
681 681
         $proxyCredentials = '';
@@ -686,17 +686,17 @@  discard block
 block discarded – undo
686 686
             $connectServer = $proxyHost;
687 687
             $connectPort = $proxyPort;
688 688
             $transport = 'tcp';
689
-            $uri = 'http://' . $server . ':' . $port . $this->path;
689
+            $uri = 'http://'.$server.':'.$port.$this->path;
690 690
             if ($proxyUsername != '') {
691 691
                 if ($proxyAuthType != 1) {
692
-                    Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
692
+                    Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
693 693
                 }
694
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
694
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
695 695
             }
696 696
         } else {
697 697
             $connectServer = $server;
698 698
             $connectPort = $port;
699
-            $transport = ( $method === 'https' ) ? 'tls' : 'tcp';
699
+            $transport = ($method === 'https') ? 'tls' : 'tcp';
700 700
             $uri = $this->path;
701 701
         }
702 702
 
@@ -706,45 +706,45 @@  discard block
 block discarded – undo
706 706
             $version = '';
707 707
             foreach ($this->cookies as $name => $cookie) {
708 708
                 if ($cookie['version']) {
709
-                    $version = ' $Version="' . $cookie['version'] . '";';
710
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
709
+                    $version = ' $Version="'.$cookie['version'].'";';
710
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
711 711
                     if ($cookie['path']) {
712
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
712
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
713 713
                     }
714 714
                     if ($cookie['domain']) {
715
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
715
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
716 716
                     }
717 717
                     if ($cookie['port']) {
718
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
718
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
719 719
                     }
720 720
                 } else {
721
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
721
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
722 722
                 }
723 723
             }
724
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
724
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
725 725
         }
726 726
 
727 727
         // omit port if default
728 728
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
729
-            $port =  '';
729
+            $port = '';
730 730
         } else {
731
-            $port = ':' . $port;
731
+            $port = ':'.$port;
732 732
         }
733 733
 
734
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
735
-            'User-Agent: ' . $this->user_agent . "\r\n" .
736
-            'Host: ' . $server . $port . "\r\n" .
737
-            $credentials .
738
-            $proxyCredentials .
739
-            $acceptedEncoding .
740
-            $encodingHdr .
741
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
742
-            $cookieHeader .
743
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
744
-            strlen($payload) . "\r\n\r\n" .
734
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
735
+            'User-Agent: '.$this->user_agent."\r\n".
736
+            'Host: '.$server.$port."\r\n".
737
+            $credentials.
738
+            $proxyCredentials.
739
+            $acceptedEncoding.
740
+            $encodingHdr.
741
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
742
+            $cookieHeader.
743
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
744
+            strlen($payload)."\r\n\r\n".
745 745
             $payload;
746 746
 
747
-        if ($this->debug > 1) {
747
+        if ($this->debug>1) {
748 748
             Logger::instance()->debugMessage("---SENDING---\n$op\n---END---");
749 749
         }
750 750
 
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
         }
771 771
         $context = stream_context_create($contextOptions);
772 772
 
773
-        if ($timeout <= 0) {
773
+        if ($timeout<=0) {
774 774
             $connectTimeout = ini_get('default_socket_timeout');
775 775
         } else {
776 776
             $connectTimeout = $timeout;
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
783 783
             STREAM_CLIENT_CONNECT, $context);
784 784
         if ($fp) {
785
-            if ($timeout > 0) {
785
+            if ($timeout>0) {
786 786
                 stream_set_timeout($fp, $timeout);
787 787
             }
788 788
         } else {
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
                 $err = error_get_last();
791 791
                 $this->errstr = $err['message'];
792 792
             }
793
-            $this->errstr = 'Connect error: ' . $this->errstr;
794
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
793
+            $this->errstr = 'Connect error: '.$this->errstr;
794
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
795 795
 
796 796
             return $r;
797 797
         }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
             $encodingHdr = '';
899 899
         }
900 900
 
901
-        if ($this->debug > 1) {
901
+        if ($this->debug>1) {
902 902
             Logger::instance()->debugMessage("---SENDING---\n$payload\n---END---");
903 903
         }
904 904
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
             } else {
909 909
                 $protocol = $method;
910 910
             }
911
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
911
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
912 912
             if ($keepAlive) {
913 913
                 $this->xmlrpc_curl_handle = $curl;
914 914
             }
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
         // results into variable
920 920
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
921 921
 
922
-        if ($this->debug > 1) {
922
+        if ($this->debug>1) {
923 923
             curl_setopt($curl, CURLOPT_VERBOSE, true);
924 924
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
925 925
         }
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
             }
945 945
         }
946 946
         // extra headers
947
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
947
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
948 948
         // if no keepalive is wanted, let the server know it in advance
949 949
         if (!$keepAlive) {
950 950
             $headers[] = 'Connection: close';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
962 962
         // timeout is borked
963 963
         if ($timeout) {
964
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
964
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
965 965
         }
966 966
 
967 967
         if ($method == 'http10') {
@@ -971,11 +971,11 @@  discard block
 block discarded – undo
971 971
         }
972 972
 
973 973
         if ($username && $password) {
974
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
974
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
975 975
             if (defined('CURLOPT_HTTPAUTH')) {
976 976
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
977 977
             } elseif ($authType != 1) {
978
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
978
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
979 979
             }
980 980
         }
981 981
 
@@ -1017,13 +1017,13 @@  discard block
 block discarded – undo
1017 1017
             if ($proxyPort == 0) {
1018 1018
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1019 1019
             }
1020
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1020
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1021 1021
             if ($proxyUsername) {
1022
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1022
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1023 1023
                 if (defined('CURLOPT_PROXYAUTH')) {
1024 1024
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1025 1025
                 } elseif ($proxyAuthType != 1) {
1026
-                    Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1026
+                    Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1027 1027
                 }
1028 1028
             }
1029 1029
         }
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
         if (count($this->cookies)) {
1034 1034
             $cookieHeader = '';
1035 1035
             foreach ($this->cookies as $name => $cookie) {
1036
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1036
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1037 1037
             }
1038 1038
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1039 1039
         }
@@ -1044,13 +1044,13 @@  discard block
 block discarded – undo
1044 1044
 
1045 1045
         $result = curl_exec($curl);
1046 1046
 
1047
-        if ($this->debug > 1) {
1047
+        if ($this->debug>1) {
1048 1048
             $message = "---CURL INFO---\n";
1049 1049
             foreach (curl_getinfo($curl) as $name => $val) {
1050 1050
                 if (is_array($val)) {
1051 1051
                     $val = implode("\n", $val);
1052 1052
                 }
1053
-                $message .= $name . ': ' . $val . "\n";
1053
+                $message .= $name.': '.$val."\n";
1054 1054
             }
1055 1055
             $message .= '---END---';
1056 1056
             Logger::instance()->debugMessage($message);
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
             /// @todo we should use a better check here - what if we get back '' or '0'?
1061 1061
 
1062 1062
             $this->errstr = 'no response';
1063
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
1063
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
1064 1064
             curl_close($curl);
1065 1065
             if ($keepAlive) {
1066 1066
                 $this->xmlrpc_curl_handle = null;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
             $call['methodName'] = new Value($req->method(), 'string');
1171 1171
             $numParams = $req->getNumParams();
1172 1172
             $params = array();
1173
-            for ($i = 0; $i < $numParams; $i++) {
1173
+            for ($i = 0; $i<$numParams; $i++) {
1174 1174
                 $params[$i] = $req->getParam($i);
1175 1175
             }
1176 1176
             $call['params'] = new Value($params, 'array');
@@ -1196,15 +1196,15 @@  discard block
 block discarded – undo
1196 1196
             /// @todo test this code branch...
1197 1197
             $rets = $result->value();
1198 1198
             if (!is_array($rets)) {
1199
-                return false;       // bad return type from system.multicall
1199
+                return false; // bad return type from system.multicall
1200 1200
             }
1201 1201
             $numRets = count($rets);
1202 1202
             if ($numRets != count($reqs)) {
1203
-                return false;       // wrong number of return values.
1203
+                return false; // wrong number of return values.
1204 1204
             }
1205 1205
 
1206 1206
             $response = array();
1207
-            for ($i = 0; $i < $numRets; $i++) {
1207
+            for ($i = 0; $i<$numRets; $i++) {
1208 1208
                 $val = $rets[$i];
1209 1209
                 if (!is_array($val)) {
1210 1210
                     return false;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
                 switch (count($val)) {
1213 1213
                     case 1:
1214 1214
                         if (!isset($val[0])) {
1215
-                            return false;       // Bad value
1215
+                            return false; // Bad value
1216 1216
                         }
1217 1217
                         // Normal return value
1218 1218
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1240,19 +1240,19 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
             $rets = $result->value();
1242 1242
             if ($rets->kindOf() != 'array') {
1243
-                return false;       // bad return type from system.multicall
1243
+                return false; // bad return type from system.multicall
1244 1244
             }
1245 1245
             $numRets = $rets->count();
1246 1246
             if ($numRets != count($reqs)) {
1247
-                return false;       // wrong number of return values.
1247
+                return false; // wrong number of return values.
1248 1248
             }
1249 1249
 
1250 1250
             $response = array();
1251
-            foreach($rets as $val) {
1251
+            foreach ($rets as $val) {
1252 1252
                 switch ($val->kindOf()) {
1253 1253
                     case 'array':
1254 1254
                         if ($val->count() != 1) {
1255
-                            return false;       // Bad value
1255
+                            return false; // Bad value
1256 1256
                         }
1257 1257
                         // Normal return value
1258 1258
                         $response[] = new Response($val[0]);
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
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                     $this->me['struct'] = $val;
84 84
                     break;
85 85
                 default:
86
-                    Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
86
+                    Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a known type ($type)");
87 87
             }
88 88
         }
89 89
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         if ($typeOf !== 1) {
111
-            Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
111
+            Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
112 112
             return 0;
113 113
         }
114 114
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
         switch ($this->mytype) {
127 127
             case 1:
128
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
128
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
129 129
                 return 0;
130 130
             case 3:
131
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
131
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
132 132
                 return 0;
133 133
             case 2:
134 134
                 // we're adding a scalar value to an array here
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
             return 1;
172 172
         } else {
173
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
173
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
174 174
             return 0;
175 175
         }
176 176
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 
202 202
             return 1;
203 203
         } else {
204
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
204
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
205 205
             return 0;
206 206
         }
207 207
     }
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
             case 1:
241 241
                 switch ($typ) {
242 242
                     case static::$xmlrpcBase64:
243
-                        $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
243
+                        $rs .= "<${typ}>".base64_encode($val)."</${typ}>";
244 244
                         break;
245 245
                     case static::$xmlrpcBoolean:
246
-                        $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
246
+                        $rs .= "<${typ}>".($val ? '1' : '0')."</${typ}>";
247 247
                         break;
248 248
                     case static::$xmlrpcString:
249 249
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
250
-                        $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
250
+                        $rs .= "<${typ}>".Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</${typ}>";
251 251
                         break;
252 252
                     case static::$xmlrpcInt:
253 253
                     case static::$xmlrpcI4:
254 254
                     case static::$xmlrpcI8:
255
-                        $rs .= "<${typ}>" . (int)$val . "</${typ}>";
255
+                        $rs .= "<${typ}>".(int) $val."</${typ}>";
256 256
                         break;
257 257
                     case static::$xmlrpcDouble:
258 258
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -260,15 +260,15 @@  discard block
 block discarded – undo
260 260
                         // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
261 261
                         // The code below tries its best at keeping max precision while avoiding exp notation,
262 262
                         // but there is of course no limit in the number of decimal places to be used...
263
-                        $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>";
263
+                        $rs .= "<${typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, 128, '.', ''))."</${typ}>";
264 264
                         break;
265 265
                     case static::$xmlrpcDateTime:
266 266
                         if (is_string($val)) {
267 267
                             $rs .= "<${typ}>${val}</${typ}>";
268 268
                         } elseif (is_a($val, 'DateTime')) {
269
-                            $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
269
+                            $rs .= "<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
270 270
                         } elseif (is_int($val)) {
271
-                            $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
271
+                            $rs .= "<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
272 272
                         } else {
273 273
                             // not really a good idea here: but what shall we output anyway? left for backward compat...
274 274
                             $rs .= "<${typ}>${val}</${typ}>";
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
             case 3:
291 291
                 // struct
292 292
                 if ($this->_php_class) {
293
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
293
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
294 294
                 } else {
295 295
                     $rs .= "<struct>\n";
296 296
                 }
297 297
                 $charsetEncoder = Charset::instance();
298 298
                 /** @var Value $val2 */
299 299
                 foreach ($val as $key2 => $val2) {
300
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
300
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
301 301
                     //$rs.=$this->serializeval($val2);
302 302
                     $rs .= $val2->serialize($charsetEncoding);
303 303
                     $rs .= "</member>\n";
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $val = reset($this->me);
334 334
         $typ = key($this->me);
335 335
 
336
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
336
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
337 337
     }
338 338
 
339 339
     /**
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
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 return $xmlrpcVal->scalarval();
75 75
             case 'array':
76 76
                 $arr = array();
77
-                foreach($xmlrpcVal as $value) {
77
+                foreach ($xmlrpcVal as $value) {
78 78
                     $arr[] = $this->decode($value, $options);
79 79
                 }
80 80
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             case 'msg':
105 105
                 $paramCount = $xmlrpcVal->getNumParams();
106 106
                 $arr = array();
107
-                for ($i = 0; $i < $paramCount; $i++) {
107
+                for ($i = 0; $i<$paramCount; $i++) {
108 108
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
109 109
                 }
110 110
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                     $xmlrpcVal = new Value($phpVal->format('Ymd\TH:i:s'), Value::$xmlrpcStruct);
180 180
                 } else {
181 181
                     $arr = array();
182
-                    foreach($phpVal as $k => $v) {
182
+                    foreach ($phpVal as $k => $v) {
183 183
                         $arr[$k] = $this->encode($v, $options);
184 184
                     }
185 185
                     $xmlrpcVal = new Value($arr, Value::$xmlrpcStruct);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                 break;
202 202
             case 'resource':
203 203
                 if (in_array('extension_api', $options)) {
204
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
204
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
205 205
                 } else {
206 206
                     $xmlrpcVal = new Value();
207 207
                 }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
                     if (extension_loaded('mbstring')) {
247 247
                         $xmlVal = mb_convert_encoding($xmlVal, 'UTF-8', $valEncoding);
248 248
                     } else {
249
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
249
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
250 250
                     }
251 251
                 }
252 252
             }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $xmlRpcParser = new XMLParser($options);
263 263
         $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE);
264 264
 
265
-        if ($xmlRpcParser->_xh['isf'] > 1) {
265
+        if ($xmlRpcParser->_xh['isf']>1) {
266 266
             // test that $xmlrpc->_xh['value'] is an obj, too???
267 267
 
268 268
             Logger::instance()->errorLog($xmlRpcParser->_xh['isf_reason']);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
                 return $r;
287 287
             case 'methodcall':
288 288
                 $req = new Request($xmlRpcParser->_xh['method']);
289
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
289
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
290 290
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
291 291
                 }
292 292
 
Please login to merge, or discard this patch.
src/Wrapper.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -157,20 +157,20 @@  discard block
 block discarded – undo
157 157
             $callable = explode('::', $callable);
158 158
         }
159 159
         if (is_array($callable)) {
160
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
161
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
160
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
161
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
162 162
                 return false;
163 163
             }
164 164
             if (is_string($callable[0])) {
165 165
                 $plainFuncName = implode('::', $callable);
166 166
             } elseif (is_object($callable[0])) {
167
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
167
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
168 168
             }
169 169
             $exists = method_exists($callable[0], $callable[1]);
170 170
         } else if ($callable instanceof \Closure) {
171 171
             // we do not support creating code which wraps closures, as php does not allow to serialize them
172 172
             if (!$buildIt) {
173
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
173
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
174 174
                 return false;
175 175
             }
176 176
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         if (!$exists) {
185
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
185
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
186 186
             return false;
187 187
         }
188 188
 
@@ -226,23 +226,23 @@  discard block
 block discarded – undo
226 226
         if (is_array($callable)) {
227 227
             $func = new \ReflectionMethod($callable[0], $callable[1]);
228 228
             if ($func->isPrivate()) {
229
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
229
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
230 230
                 return false;
231 231
             }
232 232
             if ($func->isProtected()) {
233
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
233
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
234 234
                 return false;
235 235
             }
236 236
             if ($func->isConstructor()) {
237
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
237
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
238 238
                 return false;
239 239
             }
240 240
             if ($func->isDestructor()) {
241
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
241
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
242 242
                 return false;
243 243
             }
244 244
             if ($func->isAbstract()) {
245
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
245
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
246 246
                 return false;
247 247
             }
248 248
             /// @todo add more checks for static vs. nonstatic?
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         if ($func->isInternal()) {
253 253
             // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
254 254
             // instead of getparameters to fully reflect internal php functions ?
255
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
255
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
256 256
             return false;
257 257
         }
258 258
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $i = 0;
305 305
         foreach ($func->getParameters() as $paramObj) {
306 306
             $params[$i] = array();
307
-            $params[$i]['name'] = '$' . $paramObj->getName();
307
+            $params[$i]['name'] = '$'.$paramObj->getName();
308 308
             $params[$i]['isoptional'] = $paramObj->isOptional();
309 309
             $i++;
310 310
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
             // build a signature
370 370
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
371 371
             $pSig = array($funcDesc['returnsDocs']);
372
-            for ($i = 0; $i < count($pars); $i++) {
372
+            for ($i = 0; $i<count($pars); $i++) {
373 373
                 $name = strtolower($funcDesc['params'][$i]['name']);
374 374
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
375 375
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                 }
425 425
             }
426 426
             $numPars = $req->getNumParams();
427
-            if ($numPars < $minPars || $numPars > $maxPars) {
427
+            if ($numPars<$minPars || $numPars>$maxPars) {
428 428
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
429 429
             }
430 430
 
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
             $result = call_user_func_array($callable, $params);
439 439
 
440
-            if (! is_a($result, $responseClass)) {
440
+            if (!is_a($result, $responseClass)) {
441 441
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
442 442
                     $result = new $valueClass($result, $funcDesc['returns']);
443 443
                 } else {
@@ -472,9 +472,9 @@  discard block
 block discarded – undo
472 472
         if ($newFuncName == '') {
473 473
             if (is_array($callable)) {
474 474
                 if (is_string($callable[0])) {
475
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
475
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
476 476
                 } else {
477
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
477
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
478 478
                 }
479 479
             } else {
480 480
                 if ($callable instanceof \Closure) {
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
     {
511 511
         $namespace = '\\PhpXmlRpc\\';
512 512
 
513
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
514
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
513
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
514
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
515 515
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
516 516
 
517 517
         $i = 0;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
         // build body of new function
547 547
 
548 548
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
549
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
549
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
550 550
 
551 551
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
552 552
         if ($decodePhpObjects) {
@@ -560,13 +560,13 @@  discard block
 block discarded – undo
560 560
         if (is_array($callable) && is_object($callable[0])) {
561 561
             self::$objHolder[$newFuncName] = $callable[0];
562 562
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
563
-            $realFuncName = '$obj->' . $callable[1];
563
+            $realFuncName = '$obj->'.$callable[1];
564 564
         } else {
565 565
             $realFuncName = $plainFuncName;
566 566
         }
567 567
         foreach ($parsVariations as $i => $pars) {
568
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
569
-            if ($i < (count($parsVariations) - 1))
568
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
569
+            if ($i<(count($parsVariations)-1))
570 570
                 $innerCode .= "else\n";
571 571
         }
572 572
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
         // if($func->returnsReference())
584 584
         //     return false;
585 585
 
586
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
586
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
587 587
 
588 588
         return $code;
589 589
     }
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
                         if ($methodWrap) {
621 621
                             if (is_object($className)) {
622 622
                                 $realClassName = get_class($className);
623
-                            }else {
623
+                            } else {
624 624
                                 $realClassName = $className;
625 625
                             }
626 626
                             $results[$prefix."$realClassName.$mName"] = $methodWrap;
@@ -721,21 +721,21 @@  discard block
 block discarded – undo
721 721
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
722 722
     {
723 723
         $namespace = '\\PhpXmlRpc\\';
724
-        $reqClass = $namespace . 'Request';
725
-        $valClass = $namespace . 'Value';
726
-        $decoderClass = $namespace . 'Encoder';
724
+        $reqClass = $namespace.'Request';
725
+        $valClass = $namespace.'Value';
726
+        $decoderClass = $namespace.'Encoder';
727 727
 
728 728
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
729
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
729
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
730 730
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
731
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
731
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
732 732
 
733 733
         $req = new $reqClass('system.methodSignature');
734 734
         $req->addparam(new $valClass($methodName));
735 735
         $client->setDebug($debug);
736 736
         $response = $client->send($req, $timeout, $protocol);
737 737
         if ($response->faultCode()) {
738
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
738
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
739 739
             return false;
740 740
         }
741 741
 
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
             $mSig = $decoder->decode($mSig);
746 746
         }
747 747
 
748
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
749
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
748
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
749
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
750 750
             return false;
751 751
         }
752 752
 
@@ -762,11 +762,11 @@  discard block
 block discarded – undo
762 762
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
763 763
     {
764 764
         $namespace = '\\PhpXmlRpc\\';
765
-        $reqClass = $namespace . 'Request';
766
-        $valClass = $namespace . 'Value';
765
+        $reqClass = $namespace.'Request';
766
+        $valClass = $namespace.'Value';
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 771
 
772 772
         $mDesc = '';
@@ -800,10 +800,10 @@  discard block
 block discarded – undo
800 800
         $clientClone = clone $client;
801 801
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
802 802
         {
803
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
803
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
804 804
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
805
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
806
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
805
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
806
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
807 807
             if (isset($extraOptions['return_on_fault'])) {
808 808
                 $decodeFault = true;
809 809
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -812,9 +812,9 @@  discard block
 block discarded – undo
812 812
             }
813 813
 
814 814
             $namespace = '\\PhpXmlRpc\\';
815
-            $reqClass = $namespace . 'Request';
816
-            $encoderClass = $namespace . 'Encoder';
817
-            $valueClass = $namespace . 'Value';
815
+            $reqClass = $namespace.'Request';
816
+            $encoderClass = $namespace.'Encoder';
817
+            $valueClass = $namespace.'Value';
818 818
 
819 819
             $encoder = new $encoderClass();
820 820
             $encodeOptions = array();
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
             }
838 838
 
839 839
             $xmlrpcArgs = array();
840
-            foreach($currentArgs as $i => $arg) {
840
+            foreach ($currentArgs as $i => $arg) {
841 841
                 if ($i == $maxArgs) {
842 842
                     break;
843 843
                 }
@@ -885,13 +885,13 @@  discard block
 block discarded – undo
885 885
      * @param string $mDesc
886 886
      * @return array
887 887
      */
888
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
888
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
889 889
     {
890
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
890
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
891 891
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
892
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
893
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
894
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
892
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
893
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
894
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
895 895
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
896 896
         if (isset($extraOptions['return_on_fault'])) {
897 897
             $decodeFault = true;
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
         $namespace = '\\PhpXmlRpc\\';
905 905
 
906 906
         $code = "function $newFuncName (";
907
-        if ($clientCopyMode < 2) {
907
+        if ($clientCopyMode<2) {
908 908
             // client copy mode 0 or 1 == full / partial client copy in emitted code
909 909
             $verbatimClientCopy = !$clientCopyMode;
910 910
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 
920 920
         if ($mDesc != '') {
921 921
             // take care that PHP comment is not terminated unwillingly by method description
922
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
922
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
923 923
         } else {
924 924
             $mDesc = "/**\nFunction $newFuncName\n";
925 925
         }
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
929 929
         $plist = array();
930 930
         $pCount = count($mSig);
931
-        for ($i = 1; $i < $pCount; $i++) {
931
+        for ($i = 1; $i<$pCount; $i++) {
932 932
             $plist[] = "\$p$i";
933 933
             $pType = $mSig[$i];
934 934
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -944,19 +944,19 @@  discard block
 block discarded – undo
944 944
                 }
945 945
             }
946 946
             $innerCode .= "\$req->addparam(\$p$i);\n";
947
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
947
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
948 948
         }
949
-        if ($clientCopyMode < 2) {
949
+        if ($clientCopyMode<2) {
950 950
             $plist[] = '$debug=0';
951 951
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
952 952
         }
953 953
         $plist = implode(', ', $plist);
954
-        $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n";
954
+        $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n";
955 955
 
956 956
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
957 957
         if ($decodeFault) {
958 958
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
959
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
959
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
960 960
             } else {
961 961
                 $respCode = var_export($faultResponse, true);
962 962
             }
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
970 970
         }
971 971
 
972
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
972
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
973 973
 
974 974
         return array('source' => $code, 'docstring' => $mDesc);
975 975
     }
@@ -995,23 +995,23 @@  discard block
 block discarded – undo
995 995
     public function wrapXmlrpcServer($client, $extraOptions = array())
996 996
     {
997 997
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
998
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
998
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
999 999
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1000 1000
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1001
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1002
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1001
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1002
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1003 1003
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1004 1004
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1005 1005
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1006 1006
         $namespace = '\\PhpXmlRpc\\';
1007 1007
 
1008
-        $reqClass = $namespace . 'Request';
1009
-        $decoderClass = $namespace . 'Encoder';
1008
+        $reqClass = $namespace.'Request';
1009
+        $decoderClass = $namespace.'Encoder';
1010 1010
 
1011 1011
         $req = new $reqClass('system.listMethods');
1012 1012
         $response = $client->send($req, $timeout, $protocol);
1013 1013
         if ($response->faultCode()) {
1014
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1014
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1015 1015
 
1016 1016
             return false;
1017 1017
         } else {
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
                 $mList = $decoder->decode($mList);
1022 1022
             }
1023 1023
             if (!is_array($mList) || !count($mList)) {
1024
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1024
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1025 1025
 
1026 1026
                 return false;
1027 1027
             } else {
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
                 if ($newClassName != '') {
1030 1030
                     $xmlrpcClassName = $newClassName;
1031 1031
                 } else {
1032
-                    $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1033
-                            array('_', ''), $client->server) . '_client';
1032
+                    $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1033
+                            array('_', ''), $client->server).'_client';
1034 1034
                 }
1035 1035
                 while ($buildIt && class_exists($xmlrpcClassName)) {
1036 1036
                     $xmlrpcClassName .= 'x';
@@ -1061,20 +1061,20 @@  discard block
 block discarded – undo
1061 1061
                             if (!$buildIt) {
1062 1062
                                 $source .= $methodWrap['docstring'];
1063 1063
                             }
1064
-                            $source .= $methodWrap['source'] . "\n";
1064
+                            $source .= $methodWrap['source']."\n";
1065 1065
                         } else {
1066
-                            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1066
+                            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1067 1067
                         }
1068 1068
                     }
1069 1069
                 }
1070 1070
                 $source .= "}\n";
1071 1071
                 if ($buildIt) {
1072 1072
                     $allOK = 0;
1073
-                    eval($source . '$allOK=1;');
1073
+                    eval($source.'$allOK=1;');
1074 1074
                     if ($allOK) {
1075 1075
                         return $xmlrpcClassName;
1076 1076
                     } else {
1077
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1077
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1078 1078
                         return false;
1079 1079
                     }
1080 1080
                 } else {
@@ -1095,10 +1095,10 @@  discard block
 block discarded – undo
1095 1095
      *
1096 1096
      * @return string
1097 1097
      */
1098
-    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1098
+    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1099 1099
     {
1100
-        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1101
-            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1100
+        $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path).
1101
+            "', '".str_replace("'", "\'", $client->server)."', $client->port);\n";
1102 1102
 
1103 1103
         // copy all client fields to the client that will be generated runtime
1104 1104
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
src/Server.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public static function xmlrpc_debugmsg($msg)
154 154
     {
155
-        static::$_xmlrpc_debuginfo .= $msg . "\n";
155
+        static::$_xmlrpc_debuginfo .= $msg."\n";
156 156
     }
157 157
 
158 158
     /**
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public static function error_occurred($msg)
162 162
     {
163
-        static::$_xmlrpcs_occurred_errors .= $msg . "\n";
163
+        static::$_xmlrpcs_occurred_errors .= $msg."\n";
164 164
     }
165 165
 
166 166
     /**
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
         // user debug info should be encoded by the end user using the INTERNAL_ENCODING
180 180
         $out = '';
181 181
         if ($this->debug_info != '') {
182
-            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n" . base64_encode($this->debug_info) . "\n-->\n";
182
+            $out .= "<!-- SERVER DEBUG INFO (BASE64 ENCODED):\n".base64_encode($this->debug_info)."\n-->\n";
183 183
         }
184 184
         if (static::$_xmlrpc_debuginfo != '') {
185
-            $out .= "<!-- DEBUG INFO:\n" . Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "\n-->\n";
185
+            $out .= "<!-- DEBUG INFO:\n".Charset::instance()->encodeEntities(str_replace('--', '_-', static::$_xmlrpc_debuginfo), PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."\n-->\n";
186 186
             // NB: a better solution MIGHT be to use CDATA, but we need to insert it
187 187
             // into return payload AFTER the beginning tag
188 188
             //$out .= "<![CDATA[ DEBUG INFO:\n\n" . str_replace(']]>', ']_]_>', static::$_xmlrpc_debuginfo) . "\n]]>\n";
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
         $this->debug_info = '';
213 213
 
214 214
         // Save what we received, before parsing it
215
-        if ($this->debug > 1) {
216
-            $this->debugmsg("+++GOT+++\n" . $data . "\n+++END+++");
215
+        if ($this->debug>1) {
216
+            $this->debugmsg("+++GOT+++\n".$data."\n+++END+++");
217 217
         }
218 218
 
219 219
         $r = $this->parseRequestHeaders($data, $reqCharset, $respCharset, $respEncoding);
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
         // save full body of request into response, for more debugging usages
226 226
         $r->raw_data = $rawData;
227 227
 
228
-        if ($this->debug > 2 && static::$_xmlrpcs_occurred_errors) {
229
-            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n" .
230
-                static::$_xmlrpcs_occurred_errors . "+++END+++");
228
+        if ($this->debug>2 && static::$_xmlrpcs_occurred_errors) {
229
+            $this->debugmsg("+++PROCESSING ERRORS AND WARNINGS+++\n".
230
+                static::$_xmlrpcs_occurred_errors."+++END+++");
231 231
         }
232 232
 
233 233
         $payload = $this->xml_header($respCharset);
234
-        if ($this->debug > 0) {
235
-            $payload = $payload . $this->serializeDebug($respCharset);
234
+        if ($this->debug>0) {
235
+            $payload = $payload.$this->serializeDebug($respCharset);
236 236
         }
237 237
 
238 238
         // Do not create response serialization if it has already happened. Helps building json magic
239 239
         if (empty($r->payload)) {
240 240
             $r->serialize($respCharset);
241 241
         }
242
-        $payload = $payload . $r->payload;
242
+        $payload = $payload.$r->payload;
243 243
 
244 244
         if ($returnPayload) {
245 245
             return $payload;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         // if we get a warning/error that has output some text before here, then we cannot
249 249
         // add a new header. We cannot say we are sending xml, either...
250 250
         if (!headers_sent()) {
251
-            header('Content-Type: ' . $r->content_type);
251
+            header('Content-Type: '.$r->content_type);
252 252
             // we do not know if client actually told us an accepted charset, but if he did
253 253
             // we have to tell him what we did
254 254
             header("Vary: Accept-Charset");
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
             // Note that Apache/mod_php will add (and even alter!) the Content-Length header on its own, but only for
277 277
             // responses up to 8000 bytes
278 278
             if ($phpNoSelfCompress) {
279
-                header('Content-Length: ' . (int)strlen($payload));
279
+                header('Content-Length: '.(int) strlen($payload));
280 280
             }
281 281
         } else {
282
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': http headers already sent before response is fully generated. Check for php warning or error messages');
282
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': http headers already sent before response is fully generated. Check for php warning or error messages');
283 283
         }
284 284
 
285 285
         print $payload;
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
             $numParams = count($in);
329 329
         }
330 330
         foreach ($sigs as $curSig) {
331
-            if (count($curSig) == $numParams + 1) {
331
+            if (count($curSig) == $numParams+1) {
332 332
                 $itsOK = 1;
333
-                for ($n = 0; $n < $numParams; $n++) {
333
+                for ($n = 0; $n<$numParams; $n++) {
334 334
                     if (is_object($in)) {
335 335
                         $p = $in->getParam($n);
336 336
                         if ($p->kindOf() == 'scalar') {
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
                     }
344 344
 
345 345
                     // param index is $n+1, as first member of sig is return type
346
-                    if ($pt != $curSig[$n + 1] && $curSig[$n + 1] != Value::$xmlrpcValue) {
346
+                    if ($pt != $curSig[$n+1] && $curSig[$n+1] != Value::$xmlrpcValue) {
347 347
                         $itsOK = 0;
348
-                        $pno = $n + 1;
349
-                        $wanted = $curSig[$n + 1];
348
+                        $pno = $n+1;
349
+                        $wanted = $curSig[$n+1];
350 350
                         $got = $pt;
351 351
                         break;
352 352
                     }
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
         // check if $_SERVER is populated: it might have been disabled via ini file
374 374
         // (this is true even when in CLI mode)
375 375
         if (count($_SERVER) == 0) {
376
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': cannot parse request headers as $_SERVER is not populated');
376
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': cannot parse request headers as $_SERVER is not populated');
377 377
         }
378 378
 
379
-        if ($this->debug > 1) {
379
+        if ($this->debug>1) {
380 380
             if (function_exists('getallheaders')) {
381 381
                 $this->debugmsg(''); // empty line
382 382
                 foreach (getallheaders() as $name => $val) {
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
                 if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
399 399
                     if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
400 400
                         $data = $degzdata;
401
-                        if ($this->debug > 1) {
402
-                            $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
401
+                        if ($this->debug>1) {
402
+                            $this->debugmsg("\n+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
403 403
                         }
404 404
                     } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
405 405
                         $data = $degzdata;
406
-                        if ($this->debug > 1) {
407
-                            $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
406
+                        if ($this->debug>1) {
407
+                            $this->debugmsg("+++INFLATED REQUEST+++[".strlen($data)." chars]+++\n".$data."\n+++END+++");
408 408
                         }
409 409
                     } else {
410 410
                         $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_decompress_fail'], PhpXmlRpc::$xmlrpcstr['server_decompress_fail']);
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                     if (extension_loaded('mbstring')) {
492 492
                         $data = mb_convert_encoding($data, 'UTF-8', $reqEncoding);
493 493
                     } else {
494
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received request: ' . $reqEncoding);
494
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received request: '.$reqEncoding);
495 495
                     }
496 496
                 }
497 497
             }
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 
510 510
         $xmlRpcParser = new XMLParser($options);
511 511
         $xmlRpcParser->parse($data, $this->functions_parameters_type, XMLParser::ACCEPT_REQUEST);
512
-        if ($xmlRpcParser->_xh['isf'] > 2) {
512
+        if ($xmlRpcParser->_xh['isf']>2) {
513 513
             // (BC) we return XML error as a faultCode
514 514
             preg_match('/^XML error ([0-9]+)/', $xmlRpcParser->_xh['isf_reason'], $matches);
515 515
             $r = new Response(0,
516
-                PhpXmlRpc::$xmlrpcerrxml + $matches[1],
516
+                PhpXmlRpc::$xmlrpcerrxml+$matches[1],
517 517
                 $xmlRpcParser->_xh['isf_reason']);
518 518
         } elseif ($xmlRpcParser->_xh['isf']) {
519 519
             $r = new Response(0,
520 520
                 PhpXmlRpc::$xmlrpcerr['invalid_request'],
521
-                PhpXmlRpc::$xmlrpcstr['invalid_request'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
521
+                PhpXmlRpc::$xmlrpcstr['invalid_request'].' '.$xmlRpcParser->_xh['isf_reason']);
522 522
         } else {
523 523
             // small layering violation in favor of speed and memory usage:
524 524
             // we should allow the 'execute' method handle this, but in the
@@ -529,20 +529,20 @@  discard block
 block discarded – undo
529 529
                     ($this->dmap[$xmlRpcParser->_xh['method']]['parameters_type'] == 'phpvals')
530 530
                 )
531 531
             ) {
532
-                if ($this->debug > 1) {
533
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($xmlRpcParser->_xh['params'], true) . "\n+++END+++");
532
+                if ($this->debug>1) {
533
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($xmlRpcParser->_xh['params'], true)."\n+++END+++");
534 534
                 }
535 535
                 $r = $this->execute($xmlRpcParser->_xh['method'], $xmlRpcParser->_xh['params'], $xmlRpcParser->_xh['pt']);
536 536
             } else {
537 537
                 // build a Request object with data parsed from xml
538 538
                 $req = new Request($xmlRpcParser->_xh['method']);
539 539
                 // now add parameters in
540
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
540
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
541 541
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
542 542
                 }
543 543
 
544
-                if ($this->debug > 1) {
545
-                    $this->debugmsg("\n+++PARSED+++\n" . var_export($req, true) . "\n+++END+++");
544
+                if ($this->debug>1) {
545
+                    $this->debugmsg("\n+++PARSED+++\n".var_export($req, true)."\n+++END+++");
546 546
                 }
547 547
                 $r = $this->execute($req);
548 548
             }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
                 return new Response(
596 596
                     0,
597 597
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
598
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": ${errStr}"
598
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": ${errStr}"
599 599
                 );
600 600
             }
601 601
         }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
         if (is_array($func)) {
610 610
             if (is_object($func[0])) {
611
-                $funcName = get_class($func[0]) . '->' . $func[1];
611
+                $funcName = get_class($func[0]).'->'.$func[1];
612 612
             } else {
613 613
                 $funcName = implode('::', $func);
614 614
             }
@@ -620,17 +620,17 @@  discard block
 block discarded – undo
620 620
 
621 621
         // verify that function to be invoked is in fact callable
622 622
         if (!is_callable($func)) {
623
-            Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler is not callable");
623
+            Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler is not callable");
624 624
             return new Response(
625 625
                 0,
626 626
                 PhpXmlRpc::$xmlrpcerr['server_error'],
627
-                PhpXmlRpc::$xmlrpcstr['server_error'] . ": no function matches method"
627
+                PhpXmlRpc::$xmlrpcstr['server_error'].": no function matches method"
628 628
             );
629 629
         }
630 630
 
631 631
         // If debug level is 3, we should catch all errors generated during
632 632
         // processing of user function, and log them as part of response
633
-        if ($this->debug > 2) {
633
+        if ($this->debug>2) {
634 634
             self::$_xmlrpcs_prev_ehandler = set_error_handler(array('\PhpXmlRpc\Server', '_xmlrpcs_errorHandler'));
635 635
         }
636 636
 
@@ -643,14 +643,14 @@  discard block
 block discarded – undo
643 643
                     $r = call_user_func($func, $req);
644 644
                 }
645 645
                 if (!is_a($r, 'PhpXmlRpc\Response')) {
646
-                    Logger::instance()->errorLog("XML-RPC: " . __METHOD__ . ": function '$funcName' registered as method handler does not return an xmlrpc response object but a " . gettype($r));
646
+                    Logger::instance()->errorLog("XML-RPC: ".__METHOD__.": function '$funcName' registered as method handler does not return an xmlrpc response object but a ".gettype($r));
647 647
                     if (is_a($r, 'PhpXmlRpc\Value')) {
648 648
                         $r = new Response($r);
649 649
                     } else {
650 650
                         $r = new Response(
651 651
                             0,
652 652
                             PhpXmlRpc::$xmlrpcerr['server_error'],
653
-                            PhpXmlRpc::$xmlrpcstr['server_error'] . ": function does not return xmlrpc response object"
653
+                            PhpXmlRpc::$xmlrpcstr['server_error'].": function does not return xmlrpc response object"
654 654
                         );
655 655
                     }
656 656
                 }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                         // mimic EPI behaviour: if we get an array that looks like an error, make it
667 667
                         // an eror response
668 668
                         if (is_array($r) && array_key_exists('faultCode', $r) && array_key_exists('faultString', $r)) {
669
-                            $r = new Response(0, (integer)$r['faultCode'], (string)$r['faultString']);
669
+                            $r = new Response(0, (integer) $r['faultCode'], (string) $r['faultString']);
670 670
                         } else {
671 671
                             // functions using EPI api should NOT return resp objects,
672 672
                             // so make sure we encode the return type correctly
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
             // in the called function, we wrap it in a proper error-response
691 691
             switch ($this->exception_handling) {
692 692
                 case 2:
693
-                    if ($this->debug > 2) {
693
+                    if ($this->debug>2) {
694 694
                         if (self::$_xmlrpcs_prev_ehandler) {
695 695
                             set_error_handler(self::$_xmlrpcs_prev_ehandler);
696 696
                         } else {
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                     $r = new Response(0, PhpXmlRpc::$xmlrpcerr['server_error'], PhpXmlRpc::$xmlrpcstr['server_error']);
707 707
             }
708 708
         }
709
-        if ($this->debug > 2) {
709
+        if ($this->debug>2) {
710 710
             // note: restore the error handler we found before calling the
711 711
             // user func, even if it has been changed inside the func itself
712 712
             if (self::$_xmlrpcs_prev_ehandler) {
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
      */
727 727
     protected function debugmsg($string)
728 728
     {
729
-        $this->debug_info .= $string . "\n";
729
+        $this->debug_info .= $string."\n";
730 730
     }
731 731
 
732 732
     /**
@@ -736,9 +736,9 @@  discard block
 block discarded – undo
736 736
     protected function xml_header($charsetEncoding = '')
737 737
     {
738 738
         if ($charsetEncoding != '') {
739
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?" . ">\n";
739
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\"?".">\n";
740 740
         } else {
741
-            return "<?xml version=\"1.0\"?" . ">\n";
741
+            return "<?xml version=\"1.0\"?".">\n";
742 742
         }
743 743
     }
744 744
 
@@ -971,12 +971,12 @@  discard block
 block discarded – undo
971 971
         }
972 972
 
973 973
         $req = new Request($methName->scalarval());
974
-        foreach($params as $i => $param) {
974
+        foreach ($params as $i => $param) {
975 975
             if (!$req->addParam($param)) {
976 976
                 $i++; // for error message, we count params from 1
977 977
                 return static::_xmlrpcs_multicall_error(new Response(0,
978 978
                     PhpXmlRpc::$xmlrpcerr['incorrect_params'],
979
-                    PhpXmlRpc::$xmlrpcstr['incorrect_params'] . ": probable xml error in param " . $i));
979
+                    PhpXmlRpc::$xmlrpcstr['incorrect_params'].": probable xml error in param ".$i));
980 980
             }
981 981
         }
982 982
 
@@ -1043,12 +1043,12 @@  discard block
 block discarded – undo
1043 1043
         // let accept a plain list of php parameters, beside a single xmlrpc msg object
1044 1044
         if (is_object($req)) {
1045 1045
             $calls = $req->getParam(0);
1046
-            foreach($calls as $call) {
1046
+            foreach ($calls as $call) {
1047 1047
                 $result[] = static::_xmlrpcs_multicall_do_call($server, $call);
1048 1048
             }
1049 1049
         } else {
1050 1050
             $numCalls = count($req);
1051
-            for ($i = 0; $i < $numCalls; $i++) {
1051
+            for ($i = 0; $i<$numCalls; $i++) {
1052 1052
                 $result[$i] = static::_xmlrpcs_multicall_do_call_phpvals($server, $req[$i]);
1053 1053
             }
1054 1054
         }
Please login to merge, or discard this patch.