Passed
Push — master ( d85869...35cac2 )
by Gaetano
07:01
created
src/Helper/Charset.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
                 if (count($this->xml_iso88591_Entities['in'])) {
72 72
                     return;
73 73
                 }
74
-                for ($i = 0; $i < 32; $i++) {
74
+                for ($i = 0; $i<32; $i++) {
75 75
                     $this->xml_iso88591_Entities["in"][] = chr($i);
76 76
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
77 77
                 }
78 78
 
79 79
                 /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
80 80
 
81
-                for ($i = 160; $i < 256; $i++) {
81
+                for ($i = 160; $i<256; $i++) {
82 82
                     $this->xml_iso88591_Entities["in"][] = chr($i);
83 83
                     $this->xml_iso88591_Entities["out"][] = "&#{$i};";
84 84
                 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 break;*/
107 107
 
108 108
             default:
109
-                throw new \Exception('Unsupported table: ' . $tableName);
109
+                throw new \Exception('Unsupported table: '.$tableName);
110 110
         }
111 111
     }
112 112
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $destEncoding = 'US-ASCII';
150 150
         }
151 151
 
152
-        $conversion = strtoupper($srcEncoding . '_' . $destEncoding);
152
+        $conversion = strtoupper($srcEncoding.'_'.$destEncoding);
153 153
 
154 154
         // list ordered with (expected) most common scenarios first
155 155
         switch ($conversion) {
@@ -167,20 +167,20 @@  discard block
 block discarded – undo
167 167
                 // NB: this will choke on invalid UTF-8, going most likely beyond EOF
168 168
                 $escapedData = '';
169 169
                 // be kind to users creating string xmlrpc values out of different php types
170
-                $data = (string)$data;
170
+                $data = (string) $data;
171 171
                 $ns = strlen($data);
172
-                for ($nn = 0; $nn < $ns; $nn++) {
172
+                for ($nn = 0; $nn<$ns; $nn++) {
173 173
                     $ch = $data[$nn];
174 174
                     $ii = ord($ch);
175 175
                     // 7 bits in 1 byte: 0bbbbbbb (127)
176
-                    if ($ii < 32) {
176
+                    if ($ii<32) {
177 177
                         if ($conversion == 'UTF-8_US-ASCII') {
178 178
                             $escapedData .= sprintf('&#%d;', $ii);
179 179
                         } else {
180 180
                             $escapedData .= $ch;
181 181
                         }
182 182
                     }
183
-                    else if ($ii < 128) {
183
+                    else if ($ii<128) {
184 184
                         /// @todo shall we replace this with a (supposedly) faster str_replace?
185 185
                         /// @todo to be 'print safe', should we encode as well character 127 (DEL) ?
186 186
                         switch ($ii) {
@@ -205,25 +205,25 @@  discard block
 block discarded – undo
205 205
                     } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047)
206 206
                     elseif ($ii >> 5 == 6) {
207 207
                         $b1 = ($ii & 31);
208
-                        $b2 = (ord($data[$nn + 1]) & 63);
209
-                        $ii = ($b1 * 64) + $b2;
208
+                        $b2 = (ord($data[$nn+1]) & 63);
209
+                        $ii = ($b1 * 64)+$b2;
210 210
                         $escapedData .= sprintf('&#%d;', $ii);
211 211
                         $nn += 1;
212 212
                     } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb
213 213
                     elseif ($ii >> 4 == 14) {
214 214
                         $b1 = ($ii & 15);
215
-                        $b2 = (ord($data[$nn + 1]) & 63);
216
-                        $b3 = (ord($data[$nn + 2]) & 63);
217
-                        $ii = ((($b1 * 64) + $b2) * 64) + $b3;
215
+                        $b2 = (ord($data[$nn+1]) & 63);
216
+                        $b3 = (ord($data[$nn+2]) & 63);
217
+                        $ii = ((($b1 * 64)+$b2) * 64)+$b3;
218 218
                         $escapedData .= sprintf('&#%d;', $ii);
219 219
                         $nn += 2;
220 220
                     } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
221 221
                     elseif ($ii >> 3 == 30) {
222 222
                         $b1 = ($ii & 7);
223
-                        $b2 = (ord($data[$nn + 1]) & 63);
224
-                        $b3 = (ord($data[$nn + 2]) & 63);
225
-                        $b4 = (ord($data[$nn + 3]) & 63);
226
-                        $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
223
+                        $b2 = (ord($data[$nn+1]) & 63);
224
+                        $b3 = (ord($data[$nn+2]) & 63);
225
+                        $b4 = (ord($data[$nn+3]) & 63);
226
+                        $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4;
227 227
                         $escapedData .= sprintf('&#%d;', $ii);
228 228
                         $nn += 3;
229 229
                     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             default:
274 274
                 $escapedData = '';
275 275
                 /// @todo allow usage of a custom Logger via the DIC(ish) pattern we use in other classes
276
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported...");
276
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported...");
277 277
         }
278 278
 
279 279
         return $escapedData;
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             case 'iso88591':
327 327
                 return $this->xml_iso88591_Entities;
328 328
             default:
329
-                throw new \Exception('Unsupported charset: ' . $charset);
329
+                throw new \Exception('Unsupported charset: '.$charset);
330 330
         }
331 331
     }
332 332
 }
Please login to merge, or discard this patch.
src/Client.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
             $server = $parts['host'];
159 159
             $path = isset($parts['path']) ? $parts['path'] : '';
160 160
             if (isset($parts['query'])) {
161
-                $path .= '?' . $parts['query'];
161
+                $path .= '?'.$parts['query'];
162 162
             }
163 163
             if (isset($parts['fragment'])) {
164
-                $path .= '#' . $parts['fragment'];
164
+                $path .= '#'.$parts['fragment'];
165 165
             }
166 166
             if (isset($parts['port'])) {
167 167
                 $port = $parts['port'];
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             }
178 178
         }
179 179
         if ($path == '' || $path[0] != '/') {
180
-            $this->path = '/' . $path;
180
+            $this->path = '/'.$path;
181 181
         } else {
182 182
             $this->path = $path;
183 183
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         }*/
216 216
 
217 217
         // initialize user_agent string
218
-        $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion;
218
+        $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion;
219 219
     }
220 220
 
221 221
     /**
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
      */
595 595
     protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '',
596 596
         $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1,
597
-        $method='http')
597
+        $method = 'http')
598 598
     {
599 599
         //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED);
600 600
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
      *
628 628
      * @return Response
629 629
      */
630
-    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '',  $password = '',
630
+    protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '',
631 631
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
632 632
         $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '',
633 633
         $sslVersion = 0)
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
      */
668 668
     protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '',
669 669
         $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0,
670
-        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '',
670
+        $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '',
671 671
         $sslVersion = 0)
672 672
     {
673 673
         /// @todo log a warning if passed an unsupported method
@@ -703,16 +703,16 @@  discard block
 block discarded – undo
703 703
         // thanks to Grant Rauscher <[email protected]> for this
704 704
         $credentials = '';
705 705
         if ($username != '') {
706
-            $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
706
+            $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n";
707 707
             if ($authType != 1) {
708 708
                 /// @todo make this a proper error, ie. return a failure
709
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
709
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
710 710
             }
711 711
         }
712 712
 
713 713
         $acceptedEncoding = '';
714 714
         if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
715
-            $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
715
+            $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n";
716 716
         }
717 717
 
718 718
         $proxyCredentials = '';
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
             $connectPort = $proxyPort;
725 725
             $transport = 'tcp';
726 726
             /// @todo check: should we not use https in some cases?
727
-            $uri = 'http://' . $server . ':' . $port . $this->path;
727
+            $uri = 'http://'.$server.':'.$port.$this->path;
728 728
             if ($proxyUsername != '') {
729 729
                 if ($proxyAuthType != 1) {
730 730
                     /// @todo make this a proper error, ie. return a failure
731
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
731
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
732 732
                 }
733
-                $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n";
733
+                $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n";
734 734
             }
735 735
         } else {
736 736
             $connectServer = $server;
@@ -745,45 +745,45 @@  discard block
 block discarded – undo
745 745
             $version = '';
746 746
             foreach ($this->cookies as $name => $cookie) {
747 747
                 if ($cookie['version']) {
748
-                    $version = ' $Version="' . $cookie['version'] . '";';
749
-                    $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";';
748
+                    $version = ' $Version="'.$cookie['version'].'";';
749
+                    $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";';
750 750
                     if ($cookie['path']) {
751
-                        $cookieHeader .= ' $Path="' . $cookie['path'] . '";';
751
+                        $cookieHeader .= ' $Path="'.$cookie['path'].'";';
752 752
                     }
753 753
                     if ($cookie['domain']) {
754
-                        $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";';
754
+                        $cookieHeader .= ' $Domain="'.$cookie['domain'].'";';
755 755
                     }
756 756
                     if ($cookie['port']) {
757
-                        $cookieHeader .= ' $Port="' . $cookie['port'] . '";';
757
+                        $cookieHeader .= ' $Port="'.$cookie['port'].'";';
758 758
                     }
759 759
                 } else {
760
-                    $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";";
760
+                    $cookieHeader .= ' '.$name.'='.$cookie['value'].";";
761 761
                 }
762 762
             }
763
-            $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n";
763
+            $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n";
764 764
         }
765 765
 
766 766
         // omit port if default
767 767
         if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) {
768
-            $port =  '';
768
+            $port = '';
769 769
         } else {
770
-            $port = ':' . $port;
770
+            $port = ':'.$port;
771 771
         }
772 772
 
773
-        $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
774
-            'User-Agent: ' . $this->user_agent . "\r\n" .
775
-            'Host: ' . $server . $port . "\r\n" .
776
-            $credentials .
777
-            $proxyCredentials .
778
-            $acceptedEncoding .
779
-            $encodingHdr .
780
-            'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" .
781
-            $cookieHeader .
782
-            'Content-Type: ' . $req->content_type . "\r\nContent-Length: " .
783
-            strlen($payload) . "\r\n\r\n" .
773
+        $op = 'POST '.$uri." HTTP/1.0\r\n".
774
+            'User-Agent: '.$this->user_agent."\r\n".
775
+            'Host: '.$server.$port."\r\n".
776
+            $credentials.
777
+            $proxyCredentials.
778
+            $acceptedEncoding.
779
+            $encodingHdr.
780
+            'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n".
781
+            $cookieHeader.
782
+            'Content-Type: '.$req->content_type."\r\nContent-Length: ".
783
+            strlen($payload)."\r\n\r\n".
784 784
             $payload;
785 785
 
786
-        if ($this->debug > 1) {
786
+        if ($this->debug>1) {
787 787
             $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---");
788 788
         }
789 789
 
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 
811 811
         $context = stream_context_create($contextOptions);
812 812
 
813
-        if ($timeout <= 0) {
813
+        if ($timeout<=0) {
814 814
             $connectTimeout = ini_get('default_socket_timeout');
815 815
         } else {
816 816
             $connectTimeout = $timeout;
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
         $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout,
823 823
             STREAM_CLIENT_CONNECT, $context);
824 824
         if ($fp) {
825
-            if ($timeout > 0) {
825
+            if ($timeout>0) {
826 826
                 stream_set_timeout($fp, $timeout, 0);
827 827
             }
828 828
         } else {
@@ -831,8 +831,8 @@  discard block
 block discarded – undo
831 831
                 $this->errstr = $err['message'];
832 832
             }
833 833
 
834
-            $this->errstr = 'Connect error: ' . $this->errstr;
835
-            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')');
834
+            $this->errstr = 'Connect error: '.$this->errstr;
835
+            $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')');
836 836
 
837 837
             return $r;
838 838
         }
@@ -921,18 +921,18 @@  discard block
 block discarded – undo
921 921
             $keyPass, $sslVersion);
922 922
 
923 923
         if (!$curl) {
924
-            return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': error during curl initialization. Check php error log for details');
924
+            return new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': error during curl initialization. Check php error log for details');
925 925
         }
926 926
 
927 927
         $result = curl_exec($curl);
928 928
 
929
-        if ($this->debug > 1) {
929
+        if ($this->debug>1) {
930 930
             $message = "---CURL INFO---\n";
931 931
             foreach (curl_getinfo($curl) as $name => $val) {
932 932
                 if (is_array($val)) {
933 933
                     $val = implode("\n", $val);
934 934
                 }
935
-                $message .= $name . ': ' . $val . "\n";
935
+                $message .= $name.': '.$val."\n";
936 936
             }
937 937
             $message .= '---END---';
938 938
             $this->getLogger()->debugMessage($message);
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
             /// @todo we should use a better check here - what if we get back '' or '0'?
943 943
 
944 944
             $this->errstr = 'no response';
945
-            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl));
945
+            $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl));
946 946
             curl_close($curl);
947 947
             if ($keepAlive) {
948 948
                 $this->xmlrpc_curl_handle = null;
@@ -1012,12 +1012,12 @@  discard block
 block discarded – undo
1012 1012
                     // http, https
1013 1013
                     $protocol = $method;
1014 1014
                     if (strpos($protocol, ':') !== false) {
1015
-                        $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1015
+                        $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.": warning - attempted hacking attempt?. The curl protocol requested for the call is: '$protocol'");
1016 1016
                         return false;
1017 1017
                     }
1018 1018
                 }
1019 1019
             }
1020
-            $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path);
1020
+            $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path);
1021 1021
             if (!$curl) {
1022 1022
                 return false;
1023 1023
             }
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
         // results into variable
1032 1032
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
1033 1033
 
1034
-        if ($this->debug > 1) {
1034
+        if ($this->debug>1) {
1035 1035
             curl_setopt($curl, CURLOPT_VERBOSE, true);
1036 1036
             /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
1037 1037
         }
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
             }
1057 1057
         }
1058 1058
         // extra headers
1059
-        $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1059
+        $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings));
1060 1060
         // if no keepalive is wanted, let the server know it in advance
1061 1061
         if (!$keepAlive) {
1062 1062
             $headers[] = 'Connection: close';
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1074 1074
         // timeout is borked
1075 1075
         if ($timeout) {
1076
-            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1076
+            curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1);
1077 1077
         }
1078 1078
 
1079 1079
         switch ($method) {
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
                     curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
1089 1089
                 } else {
1090 1090
                     /// @todo make this a proper error, ie. return a failure
1091
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. HTTP2 is not supported by the current PHP/curl install');
1091
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. HTTP2 is not supported by the current PHP/curl install');
1092 1092
                 }
1093 1093
                 break;
1094 1094
             case 'h2':
@@ -1097,12 +1097,12 @@  discard block
 block discarded – undo
1097 1097
         }
1098 1098
 
1099 1099
         if ($username && $password) {
1100
-            curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1100
+            curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1101 1101
             if (defined('CURLOPT_HTTPAUTH')) {
1102 1102
                 curl_setopt($curl, CURLOPT_HTTPAUTH, $authType);
1103 1103
             } elseif ($authType != 1) {
1104 1104
                 /// @todo make this a proper error, ie. return a failure
1105
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
1105
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1106 1106
             }
1107 1107
         }
1108 1108
 
@@ -1145,14 +1145,14 @@  discard block
 block discarded – undo
1145 1145
             if ($proxyPort == 0) {
1146 1146
                 $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080
1147 1147
             }
1148
-            curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort);
1148
+            curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort);
1149 1149
             if ($proxyUsername) {
1150
-                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword);
1150
+                curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword);
1151 1151
                 if (defined('CURLOPT_PROXYAUTH')) {
1152 1152
                     curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType);
1153 1153
                 } elseif ($proxyAuthType != 1) {
1154 1154
                     /// @todo make this a proper error, ie. return a failure
1155
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1155
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1156 1156
                 }
1157 1157
             }
1158 1158
         }
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
         if (count($this->cookies)) {
1163 1163
             $cookieHeader = '';
1164 1164
             foreach ($this->cookies as $name => $cookie) {
1165
-                $cookieHeader .= $name . '=' . $cookie['value'] . '; ';
1165
+                $cookieHeader .= $name.'='.$cookie['value'].'; ';
1166 1166
             }
1167 1167
             curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2));
1168 1168
         }
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
             curl_setopt($curl, $opt, $val);
1172 1172
         }
1173 1173
 
1174
-        if ($this->debug > 1) {
1174
+        if ($this->debug>1) {
1175 1175
             $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---");
1176 1176
         }
1177 1177
 
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
             $call['methodName'] = new Value($req->method(), 'string');
1272 1272
             $numParams = $req->getNumParams();
1273 1273
             $params = array();
1274
-            for ($i = 0; $i < $numParams; $i++) {
1274
+            for ($i = 0; $i<$numParams; $i++) {
1275 1275
                 $params[$i] = $req->getParam($i);
1276 1276
             }
1277 1277
             $call['params'] = new Value($params, 'array');
@@ -1296,15 +1296,15 @@  discard block
 block discarded – undo
1296 1296
         } elseif ($this->return_type == 'phpvals') {
1297 1297
             /// @todo test this code branch...
1298 1298
             if (!is_array($rets)) {
1299
-                return false;       // bad return type from system.multicall
1299
+                return false; // bad return type from system.multicall
1300 1300
             }
1301 1301
             $numRets = count($rets);
1302 1302
             if ($numRets != count($reqs)) {
1303
-                return false;       // wrong number of return values.
1303
+                return false; // wrong number of return values.
1304 1304
             }
1305 1305
 
1306 1306
             $response = array();
1307
-            for ($i = 0; $i < $numRets; $i++) {
1307
+            for ($i = 0; $i<$numRets; $i++) {
1308 1308
                 $val = $rets[$i];
1309 1309
                 if (!is_array($val)) {
1310 1310
                     return false;
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
                 switch (count($val)) {
1313 1313
                     case 1:
1314 1314
                         if (!isset($val[0])) {
1315
-                            return false;       // Bad value
1315
+                            return false; // Bad value
1316 1316
                         }
1317 1317
                         // Normal return value
1318 1318
                         $response[$i] = new Response($val[0], 0, '', 'phpvals');
@@ -1338,11 +1338,11 @@  discard block
 block discarded – undo
1338 1338
         } else {
1339 1339
             // return type == 'xmlrpcvals'
1340 1340
             if ($rets->kindOf() != 'array') {
1341
-                return false;       // bad return type from system.multicall
1341
+                return false; // bad return type from system.multicall
1342 1342
             }
1343 1343
             $numRets = $rets->count();
1344 1344
             if ($numRets != count($reqs)) {
1345
-                return false;       // wrong number of return values.
1345
+                return false; // wrong number of return values.
1346 1346
             }
1347 1347
 
1348 1348
             $response = array();
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
                 switch ($val->kindOf()) {
1351 1351
                     case 'array':
1352 1352
                         if ($val->count() != 1) {
1353
-                            return false;       // Bad value
1353
+                            return false; // Bad value
1354 1354
                         }
1355 1355
                         // Normal return value
1356 1356
                         $response[] = new Response($val[0]);
Please login to merge, or discard this patch.
src/Wrapper.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -181,20 +181,20 @@  discard block
 block discarded – undo
181 181
             $callable = explode('::', $callable);
182 182
         }
183 183
         if (is_array($callable)) {
184
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
185
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
184
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
185
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
186 186
                 return false;
187 187
             }
188 188
             if (is_string($callable[0])) {
189 189
                 $plainFuncName = implode('::', $callable);
190 190
             } elseif (is_object($callable[0])) {
191
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
191
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
192 192
             }
193 193
             $exists = method_exists($callable[0], $callable[1]);
194 194
         } else if ($callable instanceof \Closure) {
195 195
             // we do not support creating code which wraps closures, as php does not allow to serialize them
196 196
             if (!$buildIt) {
197
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
197
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
198 198
                 return false;
199 199
             }
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         }
207 207
 
208 208
         if (!$exists) {
209
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
209
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
210 210
             return false;
211 211
         }
212 212
 
@@ -251,23 +251,23 @@  discard block
 block discarded – undo
251 251
         if (is_array($callable)) {
252 252
             $func = new \ReflectionMethod($callable[0], $callable[1]);
253 253
             if ($func->isPrivate()) {
254
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
254
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
255 255
                 return false;
256 256
             }
257 257
             if ($func->isProtected()) {
258
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
258
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
259 259
                 return false;
260 260
             }
261 261
             if ($func->isConstructor()) {
262
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
262
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
263 263
                 return false;
264 264
             }
265 265
             if ($func->isDestructor()) {
266
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
266
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
267 267
                 return false;
268 268
             }
269 269
             if ($func->isAbstract()) {
270
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
270
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
271 271
                 return false;
272 272
             }
273 273
             /// @todo add more checks for static vs. nonstatic?
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if ($func->isInternal()) {
278 278
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
279 279
             ///       reflect internal php functions
280
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
280
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
281 281
             return false;
282 282
         }
283 283
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         $i = 0;
330 330
         foreach ($func->getParameters() as $paramObj) {
331 331
             $params[$i] = array();
332
-            $params[$i]['name'] = '$' . $paramObj->getName();
332
+            $params[$i]['name'] = '$'.$paramObj->getName();
333 333
             $params[$i]['isoptional'] = $paramObj->isOptional();
334 334
             $i++;
335 335
         }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             // build a signature
395 395
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
396 396
             $pSig = array($funcDesc['returnsDocs']);
397
-            for ($i = 0; $i < count($pars); $i++) {
397
+            for ($i = 0; $i<count($pars); $i++) {
398 398
                 $name = strtolower($funcDesc['params'][$i]['name']);
399 399
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
400 400
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
                 }
453 453
             }
454 454
             $numPars = $req->getNumParams();
455
-            if ($numPars < $minPars || $numPars > $maxPars) {
455
+            if ($numPars<$minPars || $numPars>$maxPars) {
456 456
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
457 457
             }
458 458
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
             $result = call_user_func_array($callable, $params);
467 467
 
468
-            if (! is_a($result, $responseClass)) {
468
+            if (!is_a($result, $responseClass)) {
469 469
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
470 470
                     $result = new $valueClass($result, $funcDesc['returns']);
471 471
                 } else {
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
         if ($newFuncName == '') {
502 502
             if (is_array($callable)) {
503 503
                 if (is_string($callable[0])) {
504
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
504
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
505 505
                 } else {
506
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
506
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
507 507
                 }
508 508
             } else {
509 509
                 if ($callable instanceof \Closure) {
@@ -540,8 +540,8 @@  discard block
 block discarded – undo
540 540
     {
541 541
         $namespace = '\\PhpXmlRpc\\';
542 542
 
543
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
544
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
543
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
544
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
545 545
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
546 546
 
547 547
         $i = 0;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
         // build body of new function
577 577
 
578 578
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
579
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
579
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
580 580
 
581 581
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
582 582
         if ($decodePhpObjects) {
@@ -590,13 +590,13 @@  discard block
 block discarded – undo
590 590
         if (is_array($callable) && is_object($callable[0])) {
591 591
             self::$objHolder[$newFuncName] = $callable[0];
592 592
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
593
-            $realFuncName = '$obj->' . $callable[1];
593
+            $realFuncName = '$obj->'.$callable[1];
594 594
         } else {
595 595
             $realFuncName = $plainFuncName;
596 596
         }
597 597
         foreach ($parsVariations as $i => $pars) {
598
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
599
-            if ($i < (count($parsVariations) - 1))
598
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
599
+            if ($i<(count($parsVariations)-1))
600 600
                 $innerCode .= "else\n";
601 601
         }
602 602
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
         // if ($func->returnsReference())
614 614
         //     return false;
615 615
 
616
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
616
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
617 617
 
618 618
         return $code;
619 619
     }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
670 670
     {
671 671
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
672
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
672
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
673 673
         }
674 674
 
675 675
         if (is_object($className)) {
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         } else {
678 678
             $realClassName = $className;
679 679
         }
680
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
680
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
681 681
     }
682 682
 
683 683
     /**
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
761 761
     {
762 762
         $namespace = '\\PhpXmlRpc\\';
763
-        $reqClass = $namespace . 'Request';
764
-        $valClass = $namespace . 'Value';
765
-        $decoderClass = $namespace . 'Encoder';
763
+        $reqClass = $namespace.'Request';
764
+        $valClass = $namespace.'Value';
765
+        $decoderClass = $namespace.'Encoder';
766 766
 
767 767
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
768
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
768
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
769 769
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
770
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
770
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
771 771
 
772 772
         $req = new $reqClass('system.methodSignature');
773 773
         $req->addparam(new $valClass($methodName));
774 774
         $client->setDebug($debug);
775 775
         $response = $client->send($req, $timeout, $protocol);
776 776
         if ($response->faultCode()) {
777
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
777
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
778 778
             return false;
779 779
         }
780 780
 
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
             $mSig = $decoder->decode($mSig);
786 786
         }
787 787
 
788
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
789
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
788
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
789
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
790 790
             return false;
791 791
         }
792 792
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
804 804
     {
805 805
         $namespace = '\\PhpXmlRpc\\';
806
-        $reqClass = $namespace . 'Request';
807
-        $valClass = $namespace . 'Value';
806
+        $reqClass = $namespace.'Request';
807
+        $valClass = $namespace.'Value';
808 808
 
809 809
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
810
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
810
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
811 811
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
812 812
 
813 813
         $mDesc = '';
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
         $clientClone = clone $client;
843 843
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
844 844
         {
845
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
845
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
846 846
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
847
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
848
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
847
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
848
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
849 849
             if (isset($extraOptions['return_on_fault'])) {
850 850
                 $decodeFault = true;
851 851
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -854,9 +854,9 @@  discard block
 block discarded – undo
854 854
             }
855 855
 
856 856
             $namespace = '\\PhpXmlRpc\\';
857
-            $reqClass = $namespace . 'Request';
858
-            $encoderClass = $namespace . 'Encoder';
859
-            $valueClass = $namespace . 'Value';
857
+            $reqClass = $namespace.'Request';
858
+            $encoderClass = $namespace.'Encoder';
859
+            $valueClass = $namespace.'Value';
860 860
 
861 861
             $encoder = new $encoderClass();
862 862
             $encodeOptions = array();
@@ -930,13 +930,13 @@  discard block
 block discarded – undo
930 930
      *
931 931
      * @return string[] keys: source, docstring
932 932
      */
933
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
933
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
934 934
     {
935
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
935
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
936 936
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
937
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
938
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
939
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
937
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
938
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
939
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
940 940
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
941 941
         if (isset($extraOptions['return_on_fault'])) {
942 942
             $decodeFault = true;
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
         $namespace = '\\PhpXmlRpc\\';
950 950
 
951 951
         $code = "function $newFuncName (";
952
-        if ($clientCopyMode < 2) {
952
+        if ($clientCopyMode<2) {
953 953
             // client copy mode 0 or 1 == full / partial client copy in emitted code
954 954
             $verbatimClientCopy = !$clientCopyMode;
955 955
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
         if ($mDesc != '') {
966 966
             // take care that PHP comment is not terminated unwillingly by method description
967
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
967
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
968 968
         } else {
969 969
             $mDesc = "/**\nFunction $newFuncName\n";
970 970
         }
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
974 974
         $plist = array();
975 975
         $pCount = count($mSig);
976
-        for ($i = 1; $i < $pCount; $i++) {
976
+        for ($i = 1; $i<$pCount; $i++) {
977 977
             $plist[] = "\$p$i";
978 978
             $pType = $mSig[$i];
979 979
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -989,19 +989,19 @@  discard block
 block discarded – undo
989 989
                 }
990 990
             }
991 991
             $innerCode .= "\$req->addparam(\$p$i);\n";
992
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
992
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
993 993
         }
994
-        if ($clientCopyMode < 2) {
994
+        if ($clientCopyMode<2) {
995 995
             $plist[] = '$debug=0';
996 996
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
997 997
         }
998 998
         $plist = implode(', ', $plist);
999
-        $mDesc .= "* @return {$namespace}Response|" . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n";
999
+        $mDesc .= "* @return {$namespace}Response|".$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n";
1000 1000
 
1001 1001
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
1002 1002
         if ($decodeFault) {
1003 1003
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1004
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1004
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1005 1005
             } else {
1006 1006
                 $respCode = var_export($faultResponse, true);
1007 1007
             }
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
1015 1015
         }
1016 1016
 
1017
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
1017
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
1018 1018
 
1019 1019
         return array('source' => $code, 'docstring' => $mDesc);
1020 1020
     }
@@ -1042,24 +1042,24 @@  discard block
 block discarded – undo
1042 1042
     public function wrapXmlrpcServer($client, $extraOptions = array())
1043 1043
     {
1044 1044
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1045
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1045
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1046 1046
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1047 1047
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1048
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1049
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1048
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1049
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1050 1050
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1051 1051
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1052 1052
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1053 1053
         $namespace = '\\PhpXmlRpc\\';
1054 1054
 
1055
-        $reqClass = $namespace . 'Request';
1056
-        $decoderClass = $namespace . 'Encoder';
1055
+        $reqClass = $namespace.'Request';
1056
+        $decoderClass = $namespace.'Encoder';
1057 1057
 
1058 1058
         // retrieve the list of methods
1059 1059
         $req = new $reqClass('system.listMethods');
1060 1060
         $response = $client->send($req, $timeout, $protocol);
1061 1061
         if ($response->faultCode()) {
1062
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1062
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1063 1063
 
1064 1064
             return false;
1065 1065
         }
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
             $mList = $decoder->decode($mList);
1071 1071
         }
1072 1072
         if (!is_array($mList) || !count($mList)) {
1073
-            $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1073
+            $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1074 1074
 
1075 1075
             return false;
1076 1076
         }
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
         if ($newClassName != '') {
1080 1080
             $xmlrpcClassName = $newClassName;
1081 1081
         } else {
1082
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1083
-                    array('_', ''), $client->server) . '_client';
1082
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1083
+                    array('_', ''), $client->server).'_client';
1084 1084
         }
1085 1085
         while ($buildIt && class_exists($xmlrpcClassName)) {
1086 1086
             $xmlrpcClassName .= 'x';
@@ -1111,20 +1111,20 @@  discard block
 block discarded – undo
1111 1111
                     if (!$buildIt) {
1112 1112
                         $source .= $methodWrap['docstring'];
1113 1113
                     }
1114
-                    $source .= $methodWrap['source'] . "\n";
1114
+                    $source .= $methodWrap['source']."\n";
1115 1115
                 } else {
1116
-                    $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1116
+                    $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1117 1117
                 }
1118 1118
             }
1119 1119
         }
1120 1120
         $source .= "}\n";
1121 1121
         if ($buildIt) {
1122 1122
             $allOK = 0;
1123
-            eval($source . '$allOK=1;');
1123
+            eval($source.'$allOK=1;');
1124 1124
             if ($allOK) {
1125 1125
                 return $xmlrpcClassName;
1126 1126
             } else {
1127
-                $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1127
+                $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1128 1128
                 return false;
1129 1129
             }
1130 1130
         } else {
@@ -1144,8 +1144,8 @@  discard block
 block discarded – undo
1144 1144
      */
1145 1145
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1146 1146
     {
1147
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path) .
1148
-            "', '" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server) . "', $client->port);\n";
1147
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path).
1148
+            "', '".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server)."', $client->port);\n";
1149 1149
 
1150 1150
         // copy all client fields to the client that will be generated runtime
1151 1151
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.