Passed
Push — master ( 5787f8...cad2d5 )
by Gaetano
08:38
created
src/Helper/Logger.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
             $flags = ENT_COMPAT;
40 40
             // avoid warnings on php < 5.4...
41 41
             if (defined('ENT_HTML401')) {
42
-                $flags =  $flags | ENT_HTML401;
42
+                $flags = $flags | ENT_HTML401;
43 43
             }
44 44
             if (defined('ENT_SUBSTITUTE')) {
45
-                $flags =  $flags | ENT_SUBSTITUTE;
45
+                $flags = $flags | ENT_SUBSTITUTE;
46 46
             }
47 47
             if ($encoding != null) {
48 48
                 print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>";
Please login to merge, or discard this patch.
src/Response.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -117,35 +117,35 @@
 block discarded – undo
117 117
     public function serialize($charsetEncoding = '')
118 118
     {
119 119
         if ($charsetEncoding != '') {
120
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
120
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
121 121
         } else {
122 122
             $this->content_type = 'text/xml';
123 123
         }
124 124
         if (PhpXmlRpc::$xmlrpc_null_apache_encoding) {
125
-            $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n";
125
+            $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n";
126 126
         } else {
127 127
             $result = "<methodResponse>\n";
128 128
         }
129 129
         if ($this->errno) {
130 130
             // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars
131
-            $result .= "<fault>\n" .
132
-                "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno .
133
-                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
134
-                Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" .
131
+            $result .= "<fault>\n".
132
+                "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno.
133
+                "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>".
134
+                Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n".
135 135
                 "</struct>\n</value>\n</fault>";
136 136
         } else {
137 137
             if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) {
138 138
                 if (is_string($this->val) && $this->valtyp == 'xml') {
139
-                    $result .= "<params>\n<param>\n" .
140
-                        $this->val .
139
+                    $result .= "<params>\n<param>\n".
140
+                        $this->val.
141 141
                         "</param>\n</params>";
142 142
                 } else {
143 143
                     /// @todo try to build something serializable?
144 144
                     throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values');
145 145
                 }
146 146
             } else {
147
-                $result .= "<params>\n<param>\n" .
148
-                    $this->val->serialize($charsetEncoding) .
147
+                $result .= "<params>\n<param>\n".
148
+                    $this->val->serialize($charsetEncoding).
149 149
                     "</param>\n</params>";
150 150
             }
151 151
         }
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
     public function xml_header($charsetEncoding = '')
39 39
     {
40 40
         if ($charsetEncoding != '') {
41
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
41
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
42 42
         } else {
43
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
43
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
44 44
         }
45 45
     }
46 46
 
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
     public function createPayload($charsetEncoding = '')
53 53
     {
54 54
         if ($charsetEncoding != '') {
55
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
55
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
56 56
         } else {
57 57
             $this->content_type = 'text/xml';
58 58
         }
59 59
         $this->payload = $this->xml_header($charsetEncoding);
60
-        $this->payload .= '<methodName>' . Charset::instance()->encodeEntities(
61
-            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
60
+        $this->payload .= '<methodName>'.Charset::instance()->encodeEntities(
61
+            $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
62 62
         $this->payload .= "<params>\n";
63 63
         foreach ($this->params as $p) {
64
-            $this->payload .= "<param>\n" . $p->serialize($charsetEncoding) .
64
+            $this->payload .= "<param>\n".$p->serialize($charsetEncoding).
65 65
                 "</param>\n";
66 66
         }
67 67
         $this->payload .= "</params>\n";
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
187 187
 
188 188
         if ($data == '') {
189
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': no response received from server.');
189
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': no response received from server.');
190 190
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
191 191
         }
192 192
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $httpParser = new Http();
196 196
             try {
197 197
                 $this->httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug);
198
-            } catch(\Exception $e) {
198
+            } catch (\Exception $e) {
199 199
                 $r = new Response(0, $e->getCode(), $e->getMessage());
200 200
                 // failed processing of HTTP response headers
201 201
                 // save into response obj the full payload received, for debugging
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         // idea from Luca Mariano <[email protected]> originally in PEARified version of the lib
215 215
         $pos = strrpos($data, '</methodResponse>');
216 216
         if ($pos !== false) {
217
-            $data = substr($data, 0, $pos + 17);
217
+            $data = substr($data, 0, $pos+17);
218 218
         }
219 219
 
220 220
         // try to 'guestimate' the character encoding of the received response
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
             if ($start) {
226 226
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
227 227
                 $end = strpos($data, '-->', $start);
228
-                $comments = substr($data, $start, $end - $start);
229
-                Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t" .
230
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", $respEncoding);
228
+                $comments = substr($data, $start, $end-$start);
229
+                Logger::instance()->debugMessage("---SERVER DEBUG INFO (DECODED) ---\n\t".
230
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", $respEncoding);
231 231
             }
232 232
         }
233 233
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
                     if (extension_loaded('mbstring')) {
255 255
                         $data = mb_convert_encoding($data, 'UTF-8', $respEncoding);
256 256
                     } else {
257
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding);
257
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$respEncoding);
258 258
                     }
259 259
                 }
260 260
             }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
         $xmlRpcParser->parse($data, $returnType, XMLParser::ACCEPT_RESPONSE);
275 275
 
276 276
         // first error check: xml not well formed
277
-        if ($xmlRpcParser->_xh['isf'] > 2) {
277
+        if ($xmlRpcParser->_xh['isf']>2) {
278 278
 
279 279
             // BC break: in the past for some cases we used the error message: 'XML error at line 1, check URL'
280 280
 
281 281
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
282
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
282
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
283 283
 
284 284
             if ($this->debug) {
285 285
                 print $xmlRpcParser->_xh['isf_reason'];
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
             }
293 293
 
294 294
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
295
-                PhpXmlRpc::$xmlrpcstr['invalid_return'] . ' ' . $xmlRpcParser->_xh['isf_reason']);
295
+                PhpXmlRpc::$xmlrpcstr['invalid_return'].' '.$xmlRpcParser->_xh['isf_reason']);
296 296
         }
297 297
         // third error check: parsing of the response has somehow gone boink.
298 298
         // NB: shall we omit this check, since we trust the parsing code?
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_return'],
304 304
                 PhpXmlRpc::$xmlrpcstr['invalid_return']);
305 305
         } else {
306
-            if ($this->debug > 1) {
306
+            if ($this->debug>1) {
307 307
                 Logger::instance()->debugMessage(
308 308
                     "---PARSED---\n".var_export($xmlRpcParser->_xh['value'], true)."\n---END---"
309 309
                 );
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
@@ -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/Wrapper.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
             $callable = explode('::', $callable);
160 160
         }
161 161
         if (is_array($callable)) {
162
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
162
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
164 164
                 return false;
165 165
             }
166 166
             if (is_string($callable[0])) {
167 167
                 $plainFuncName = implode('::', $callable);
168 168
             } elseif (is_object($callable[0])) {
169
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
169
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
170 170
             }
171 171
             $exists = method_exists($callable[0], $callable[1]);
172 172
         } else if ($callable instanceof \Closure) {
173 173
             // we do not support creating code which wraps closures, as php does not allow to serialize them
174 174
             if (!$buildIt) {
175
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
175
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
176 176
                 return false;
177 177
             }
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         if (!$exists) {
187
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
187
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
188 188
             return false;
189 189
         }
190 190
 
@@ -228,23 +228,23 @@  discard block
 block discarded – undo
228 228
         if (is_array($callable)) {
229 229
             $func = new \ReflectionMethod($callable[0], $callable[1]);
230 230
             if ($func->isPrivate()) {
231
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
231
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
232 232
                 return false;
233 233
             }
234 234
             if ($func->isProtected()) {
235
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
235
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
236 236
                 return false;
237 237
             }
238 238
             if ($func->isConstructor()) {
239
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
239
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
240 240
                 return false;
241 241
             }
242 242
             if ($func->isDestructor()) {
243
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
243
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
244 244
                 return false;
245 245
             }
246 246
             if ($func->isAbstract()) {
247
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
247
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
248 248
                 return false;
249 249
             }
250 250
             /// @todo add more checks for static vs. nonstatic?
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         if ($func->isInternal()) {
255 255
             // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
256 256
             // instead of getparameters to fully reflect internal php functions ?
257
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
257
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
258 258
             return false;
259 259
         }
260 260
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         $i = 0;
307 307
         foreach ($func->getParameters() as $paramObj) {
308 308
             $params[$i] = array();
309
-            $params[$i]['name'] = '$' . $paramObj->getName();
309
+            $params[$i]['name'] = '$'.$paramObj->getName();
310 310
             $params[$i]['isoptional'] = $paramObj->isOptional();
311 311
             $i++;
312 312
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             // build a signature
372 372
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
373 373
             $pSig = array($funcDesc['returnsDocs']);
374
-            for ($i = 0; $i < count($pars); $i++) {
374
+            for ($i = 0; $i<count($pars); $i++) {
375 375
                 $name = strtolower($funcDesc['params'][$i]['name']);
376 376
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
377 377
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                 }
427 427
             }
428 428
             $numPars = $req->getNumParams();
429
-            if ($numPars < $minPars || $numPars > $maxPars) {
429
+            if ($numPars<$minPars || $numPars>$maxPars) {
430 430
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
431 431
             }
432 432
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
             $result = call_user_func_array($callable, $params);
441 441
 
442
-            if (! is_a($result, $responseClass)) {
442
+            if (!is_a($result, $responseClass)) {
443 443
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
444 444
                     $result = new $valueClass($result, $funcDesc['returns']);
445 445
                 } else {
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
         if ($newFuncName == '') {
475 475
             if (is_array($callable)) {
476 476
                 if (is_string($callable[0])) {
477
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
477
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
478 478
                 } else {
479
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
479
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
480 480
                 }
481 481
             } else {
482 482
                 if ($callable instanceof \Closure) {
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
     {
513 513
         $namespace = '\\PhpXmlRpc\\';
514 514
 
515
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
516
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
515
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
516
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
517 517
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
518 518
 
519 519
         $i = 0;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         // build body of new function
549 549
 
550 550
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
551
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
551
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
552 552
 
553 553
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
554 554
         if ($decodePhpObjects) {
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
         if (is_array($callable) && is_object($callable[0])) {
563 563
             self::$objHolder[$newFuncName] = $callable[0];
564 564
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
565
-            $realFuncName = '$obj->' . $callable[1];
565
+            $realFuncName = '$obj->'.$callable[1];
566 566
         } else {
567 567
             $realFuncName = $plainFuncName;
568 568
         }
569 569
         foreach ($parsVariations as $i => $pars) {
570
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
571
-            if ($i < (count($parsVariations) - 1))
570
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
571
+            if ($i<(count($parsVariations)-1))
572 572
                 $innerCode .= "else\n";
573 573
         }
574 574
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         // if($func->returnsReference())
586 586
         //     return false;
587 587
 
588
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
588
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
589 589
 
590 590
         return $code;
591 591
     }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                         if ($methodWrap) {
623 623
                             if (is_object($className)) {
624 624
                                 $realClassName = get_class($className);
625
-                            }else {
625
+                            } else {
626 626
                                 $realClassName = $className;
627 627
                             }
628 628
                             $results[$prefix."$realClassName.$mName"] = $methodWrap;
@@ -723,21 +723,21 @@  discard block
 block discarded – undo
723 723
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
724 724
     {
725 725
         $namespace = '\\PhpXmlRpc\\';
726
-        $reqClass = $namespace . 'Request';
727
-        $valClass = $namespace . 'Value';
728
-        $decoderClass = $namespace . 'Encoder';
726
+        $reqClass = $namespace.'Request';
727
+        $valClass = $namespace.'Value';
728
+        $decoderClass = $namespace.'Encoder';
729 729
 
730 730
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
731
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
731
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
732 732
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
733
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
733
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
734 734
 
735 735
         $req = new $reqClass('system.methodSignature');
736 736
         $req->addparam(new $valClass($methodName));
737 737
         $client->setDebug($debug);
738 738
         $response = $client->send($req, $timeout, $protocol);
739 739
         if ($response->faultCode()) {
740
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
740
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
741 741
             return false;
742 742
         }
743 743
 
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
             $mSig = $decoder->decode($mSig);
748 748
         }
749 749
 
750
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
751
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
750
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
751
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
752 752
             return false;
753 753
         }
754 754
 
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
765 765
     {
766 766
         $namespace = '\\PhpXmlRpc\\';
767
-        $reqClass = $namespace . 'Request';
768
-        $valClass = $namespace . 'Value';
767
+        $reqClass = $namespace.'Request';
768
+        $valClass = $namespace.'Value';
769 769
 
770 770
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
771
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
771
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
772 772
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
773 773
 
774 774
         $mDesc = '';
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
         $clientClone = clone $client;
803 803
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
804 804
         {
805
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
805
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
806 806
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
807
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
808
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
807
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
808
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
809 809
             if (isset($extraOptions['return_on_fault'])) {
810 810
                 $decodeFault = true;
811 811
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -814,9 +814,9 @@  discard block
 block discarded – undo
814 814
             }
815 815
 
816 816
             $namespace = '\\PhpXmlRpc\\';
817
-            $reqClass = $namespace . 'Request';
818
-            $encoderClass = $namespace . 'Encoder';
819
-            $valueClass = $namespace . 'Value';
817
+            $reqClass = $namespace.'Request';
818
+            $encoderClass = $namespace.'Encoder';
819
+            $valueClass = $namespace.'Value';
820 820
 
821 821
             $encoder = new $encoderClass();
822 822
             $encodeOptions = array();
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
             }
840 840
 
841 841
             $xmlrpcArgs = array();
842
-            foreach($currentArgs as $i => $arg) {
842
+            foreach ($currentArgs as $i => $arg) {
843 843
                 if ($i == $maxArgs) {
844 844
                     break;
845 845
                 }
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
      * @param string $mDesc
888 888
      * @return string[] keys: source, docstring
889 889
      */
890
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
890
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
891 891
     {
892
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
892
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
893 893
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
894
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
895
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
896
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
894
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
895
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
896
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
897 897
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
898 898
         if (isset($extraOptions['return_on_fault'])) {
899 899
             $decodeFault = true;
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
         $namespace = '\\PhpXmlRpc\\';
907 907
 
908 908
         $code = "function $newFuncName (";
909
-        if ($clientCopyMode < 2) {
909
+        if ($clientCopyMode<2) {
910 910
             // client copy mode 0 or 1 == full / partial client copy in emitted code
911 911
             $verbatimClientCopy = !$clientCopyMode;
912 912
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 
922 922
         if ($mDesc != '') {
923 923
             // take care that PHP comment is not terminated unwillingly by method description
924
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
924
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
925 925
         } else {
926 926
             $mDesc = "/**\nFunction $newFuncName\n";
927 927
         }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
931 931
         $plist = array();
932 932
         $pCount = count($mSig);
933
-        for ($i = 1; $i < $pCount; $i++) {
933
+        for ($i = 1; $i<$pCount; $i++) {
934 934
             $plist[] = "\$p$i";
935 935
             $pType = $mSig[$i];
936 936
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -946,19 +946,19 @@  discard block
 block discarded – undo
946 946
                 }
947 947
             }
948 948
             $innerCode .= "\$req->addparam(\$p$i);\n";
949
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
949
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
950 950
         }
951
-        if ($clientCopyMode < 2) {
951
+        if ($clientCopyMode<2) {
952 952
             $plist[] = '$debug=0';
953 953
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
954 954
         }
955 955
         $plist = implode(', ', $plist);
956
-        $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n";
956
+        $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n";
957 957
 
958 958
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
959 959
         if ($decodeFault) {
960 960
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
961
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
961
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
962 962
             } else {
963 963
                 $respCode = var_export($faultResponse, true);
964 964
             }
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
972 972
         }
973 973
 
974
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
974
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
975 975
 
976 976
         return array('source' => $code, 'docstring' => $mDesc);
977 977
     }
@@ -997,23 +997,23 @@  discard block
 block discarded – undo
997 997
     public function wrapXmlrpcServer($client, $extraOptions = array())
998 998
     {
999 999
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1000
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1000
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1001 1001
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1002 1002
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1003
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1004
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1003
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1004
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1005 1005
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1006 1006
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1007 1007
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1008 1008
         $namespace = '\\PhpXmlRpc\\';
1009 1009
 
1010
-        $reqClass = $namespace . 'Request';
1011
-        $decoderClass = $namespace . 'Encoder';
1010
+        $reqClass = $namespace.'Request';
1011
+        $decoderClass = $namespace.'Encoder';
1012 1012
 
1013 1013
         $req = new $reqClass('system.listMethods');
1014 1014
         $response = $client->send($req, $timeout, $protocol);
1015 1015
         if ($response->faultCode()) {
1016
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1016
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1017 1017
 
1018 1018
             return false;
1019 1019
         } else {
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
                 $mList = $decoder->decode($mList);
1024 1024
             }
1025 1025
             if (!is_array($mList) || !count($mList)) {
1026
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1026
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1027 1027
 
1028 1028
                 return false;
1029 1029
             } else {
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
                 if ($newClassName != '') {
1032 1032
                     $xmlrpcClassName = $newClassName;
1033 1033
                 } else {
1034
-                    $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
-                            array('_', ''), $client->server) . '_client';
1034
+                    $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
+                            array('_', ''), $client->server).'_client';
1036 1036
                 }
1037 1037
                 while ($buildIt && class_exists($xmlrpcClassName)) {
1038 1038
                     $xmlrpcClassName .= 'x';
@@ -1063,20 +1063,20 @@  discard block
 block discarded – undo
1063 1063
                             if (!$buildIt) {
1064 1064
                                 $source .= $methodWrap['docstring'];
1065 1065
                             }
1066
-                            $source .= $methodWrap['source'] . "\n";
1066
+                            $source .= $methodWrap['source']."\n";
1067 1067
                         } else {
1068
-                            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1068
+                            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1069 1069
                         }
1070 1070
                     }
1071 1071
                 }
1072 1072
                 $source .= "}\n";
1073 1073
                 if ($buildIt) {
1074 1074
                     $allOK = 0;
1075
-                    eval($source . '$allOK=1;');
1075
+                    eval($source.'$allOK=1;');
1076 1076
                     if ($allOK) {
1077 1077
                         return $xmlrpcClassName;
1078 1078
                     } else {
1079
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1079
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1080 1080
                         return false;
1081 1081
                     }
1082 1082
                 } else {
@@ -1097,10 +1097,10 @@  discard block
 block discarded – undo
1097 1097
      *
1098 1098
      * @return string
1099 1099
      */
1100
-    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1100
+    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1101 1101
     {
1102
-        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1103
-            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1102
+        $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path).
1103
+            "', '".str_replace("'", "\'", $client->server)."', $client->port);\n";
1104 1104
 
1105 1105
         // copy all client fields to the client that will be generated runtime
1106 1106
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
tests/parse_args.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         // check for command line (env vars) vs. web page input params
45 45
         if (!isset($_SERVER['REQUEST_METHOD'])) {
46
-            foreach($_SERVER as $key => $val) {
46
+            foreach ($_SERVER as $key => $val) {
47 47
                 if (array_key_exists($key, $args)) {
48 48
                     $$key = $val;
49 49
                 }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             }
88 88
         }
89 89
         if ($HTTPURI[0] != '/') {
90
-            $HTTPURI = '/' . $HTTPURI;
90
+            $HTTPURI = '/'.$HTTPURI;
91 91
         }
92 92
         $args['HTTPURI'] = $HTTPURI;
93 93
 
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         if (isset($HTTPSIGNOREPEER)) {
104
-            $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER;
104
+            $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER;
105 105
         }
106 106
 
107 107
         if (isset($HTTPSVERIFYHOST)) {
108
-            $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
108
+            $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST;
109 109
         }
110 110
 
111 111
         if (isset($SSLVERSION)) {
112
-            $args['SSLVERSION'] = (int)$SSLVERSION;
112
+            $args['SSLVERSION'] = (int) $SSLVERSION;
113 113
         }
114 114
 
115 115
         if (isset($PROXYSERVER)) {
116 116
             $arr = explode(':', $PROXYSERVER);
117 117
             $args['PROXYSERVER'] = $arr[0];
118
-            if (count($arr) > 1) {
118
+            if (count($arr)>1) {
119 119
                 $args['PROXYPORT'] = $arr[1];
120 120
             } else {
121 121
                 $args['PROXYPORT'] = 8080;
Please login to merge, or discard this patch.
tests/benchmark.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 use PhpXmlRpc\Response;
20 20
 use PhpXmlRpc\Encoder;
21 21
 
22
-include_once __DIR__ . '/../vendor/autoload.php';
22
+include_once __DIR__.'/../vendor/autoload.php';
23 23
 
24
-include __DIR__ . '/parse_args.php';
24
+include __DIR__.'/parse_args.php';
25 25
 $args = argParser::getArgs();
26 26
 
27 27
 function begin_test($test_name, $test_case)
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     if (!isset($test_results[$test_name][$test_case])) {
42 42
         trigger_error('ending test that was not started');
43 43
     }
44
-    $test_results[$test_name][$test_case]['time'] = $end - $test_results[$test_name][$test_case]['time'];
44
+    $test_results[$test_name][$test_case]['time'] = $end-$test_results[$test_name][$test_case]['time'];
45 45
     $test_results[$test_name][$test_case]['result'] = $test_result;
46 46
     echo '.';
47 47
     flush();
@@ -75,24 +75,24 @@  discard block
 block discarded – undo
75 75
 }
76 76
 
77 77
 if ($is_web) {
78
-    echo "<h3>Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "</h3>\n";
78
+    echo "<h3>Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."</h3>\n";
79 79
     if ($xd) {
80
-        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: " . htmlspecialchars(xdebug_get_profiler_filename()) . "</h4>\n";
80
+        echo "<h4>XDEBUG profiling enabled: skipping remote tests. Trace file is: ".htmlspecialchars(xdebug_get_profiler_filename())."</h4>\n";
81 81
     }
82 82
     flush();
83 83
     ob_flush();
84 84
 } else {
85
-    echo "Using lib version: " . PhpXmlRpc::$xmlrpcVersion . " on PHP version: " . phpversion() . "\n";
85
+    echo "Using lib version: ".PhpXmlRpc::$xmlrpcVersion." on PHP version: ".phpversion()."\n";
86 86
     if ($xd) {
87
-        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: " . xdebug_get_profiler_filename() . "\n";
87
+        echo "XDEBUG profiling enabled: skipping remote tests\nTrace file is: ".xdebug_get_profiler_filename()."\n";
88 88
     }
89 89
 }
90 90
 
91 91
 // test 'manual style' data encoding vs. 'automatic style' encoding
92 92
 begin_test('Data encoding (large array)', 'manual encoding');
93
-for ($i = 0; $i < $num_tests; $i++) {
93
+for ($i = 0; $i<$num_tests; $i++) {
94 94
     $vals = array();
95
-    for ($j = 0; $j < 10; $j++) {
95
+    for ($j = 0; $j<10; $j++) {
96 96
         $valarray = array();
97 97
         foreach ($data[$j] as $key => $val) {
98 98
             $values = array();
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 begin_test('Data encoding (large array)', 'automatic encoding');
119 119
 $encoder = new Encoder();
120
-for ($i = 0; $i < $num_tests; $i++) {
120
+for ($i = 0; $i<$num_tests; $i++) {
121 121
     $value = $encoder->encode($data, array('auto_dates'));
122 122
     $out = $value->serialize();
123 123
 }
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 
126 126
 if (function_exists('xmlrpc_set_type')) {
127 127
     begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
128
-    for ($i = 0; $i < $num_tests; $i++) {
129
-        for ($j = 0; $j < 10; $j++) {
128
+    for ($i = 0; $i<$num_tests; $i++) {
129
+        for ($j = 0; $j<10; $j++) {
130 130
             foreach ($keys as $k) {
131 131
                 xmlrpc_set_type($data[$j][$k][4], 'datetime');
132 132
                 xmlrpc_set_type($data[$j][$k][8], 'datetime');
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 // test 'old style' data decoding vs. 'automatic style' decoding
141 141
 $dummy = new Request('');
142 142
 $out = new Response($value);
143
-$in = '<?xml version="1.0" ?>' . "\n" . $out->serialize();
143
+$in = '<?xml version="1.0" ?>'."\n".$out->serialize();
144 144
 
145 145
 begin_test('Data decoding (large array)', 'manual decoding');
146
-for ($i = 0; $i < $num_tests; $i++) {
146
+for ($i = 0; $i<$num_tests; $i++) {
147 147
     $response = $dummy->ParseResponse($in, true);
148 148
     $value = $response->value();
149 149
     $result = array();
150
-    foreach($value as $val1) {
150
+    foreach ($value as $val1) {
151 151
         $out = array();
152
-        foreach($val1 as $name => $val) {
152
+        foreach ($val1 as $name => $val) {
153 153
             $out[$name] = array();
154
-            foreach($val as $data) {
154
+            foreach ($val as $data) {
155 155
                 $out[$name][] = $data->scalarval();
156 156
             }
157 157
         }
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 end_test('Data decoding (large array)', 'manual decoding', $result);
162 162
 
163 163
 begin_test('Data decoding (large array)', 'manual decoding deprecated');
164
-for ($i = 0; $i < $num_tests; $i++) {
164
+for ($i = 0; $i<$num_tests; $i++) {
165 165
     $response = $dummy->ParseResponse($in, true);
166 166
     $value = $response->value();
167 167
     $result = array();
168 168
     $l = $value->arraysize();
169
-    for ($k = 0; $k < $l; $k++) {
169
+    for ($k = 0; $k<$l; $k++) {
170 170
         $val1 = $value->arraymem($k);
171 171
         $out = array();
172
-        foreach($val1 as $name => $val) {
172
+        foreach ($val1 as $name => $val) {
173 173
             $out[$name] = array();
174 174
             $m = $val->arraysize();
175
-            for ($j = 0; $j < $m; $j++) {
175
+            for ($j = 0; $j<$m; $j++) {
176 176
                 $data = $val->arraymem($j);
177 177
                 $out[$name][] = $data->scalarval();
178 178
             }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 end_test('Data decoding (large array)', 'manual decoding deprecated', $result);
184 184
 
185 185
 begin_test('Data decoding (large array)', 'automatic decoding');
186
-for ($i = 0; $i < $num_tests; $i++) {
186
+for ($i = 0; $i<$num_tests; $i++) {
187 187
     $response = $dummy->ParseResponse($in, true, 'phpvals');
188 188
     $value = $response->value();
189 189
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
 if (function_exists('xmlrpc_decode')) {
193 193
     begin_test('Data decoding (large array)', 'xmlrpc-epi decoding');
194
-    for ($i = 0; $i < $num_tests; $i++) {
194
+    for ($i = 0; $i<$num_tests; $i++) {
195 195
         $response = $dummy->ParseResponse($in, true, 'xml');
196 196
         $value = xmlrpc_decode($response->value());
197 197
     }
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
     $value = $encoder->encode($data1, array('auto_dates'));
208 208
     $req = new Request('interopEchoTests.echoValue', array($value));
209 209
     $reqs = array();
210
-    for ($i = 0; $i < $num_tests; $i++) {
210
+    for ($i = 0; $i<$num_tests; $i++) {
211 211
         $reqs[] = $req;
212 212
     }
213 213
     $server = explode(':', $args['HTTPSERVER']);
214
-    if (count($server) > 1) {
215
-        $srv = $server[1] . '://' . $server[0] . $args['HTTPURI'];
214
+    if (count($server)>1) {
215
+        $srv = $server[1].'://'.$server[0].$args['HTTPURI'];
216 216
         $c = new Client($args['HTTPURI'], $server[0], $server[1]);
217 217
     } else {
218
-        $srv = $args['HTTPSERVER'] . $args['HTTPURI'];
218
+        $srv = $args['HTTPSERVER'].$args['HTTPURI'];
219 219
         $c = new Client($args['HTTPURI'], $args['HTTPSERVER']);
220 220
     }
221 221
     // do not interfere with http compression
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     }
230 230
     begin_test($testName, 'http 10');
231 231
     $response = array();
232
-    for ($i = 0; $i < $num_tests; $i++) {
232
+    for ($i = 0; $i<$num_tests; $i++) {
233 233
         $resp = $c->send($req);
234 234
         $response[] = $resp->value();
235 235
     }
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     if (function_exists('curl_init')) {
239 239
         begin_test($testName, 'http 11 w. keep-alive');
240 240
         $response = array();
241
-        for ($i = 0; $i < $num_tests; $i++) {
241
+        for ($i = 0; $i<$num_tests; $i++) {
242 242
             $resp = $c->send($req, 10, 'http11');
243 243
             $response[] = $resp->value();
244 244
         }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $c->keepalive = false;
248 248
         begin_test($testName, 'http 11');
249 249
         $response = array();
250
-        for ($i = 0; $i < $num_tests; $i++) {
250
+        for ($i = 0; $i<$num_tests; $i++) {
251 251
             $resp = $c->send($req, 10, 'http11');
252 252
             $response[] = $resp->value();
253 253
         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
         begin_test($testName, 'http 10 w. compression');
269 269
         $response = array();
270
-        for ($i = 0; $i < $num_tests; $i++) {
270
+        for ($i = 0; $i<$num_tests; $i++) {
271 271
             $resp = $c->send($req);
272 272
             $response[] = $resp->value();
273 273
         }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         if (function_exists('curl_init')) {
277 277
             begin_test($testName, 'http 11 w. keep-alive and compression');
278 278
             $response = array();
279
-            for ($i = 0; $i < $num_tests; $i++) {
279
+            for ($i = 0; $i<$num_tests; $i++) {
280 280
                 $resp = $c->send($req, 10, 'http11');
281 281
                 $response[] = $resp->value();
282 282
             }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
             $c->keepalive = false;
286 286
             begin_test($testName, 'http 11 w. compression');
287 287
             $response = array();
288
-            for ($i = 0; $i < $num_tests; $i++) {
288
+            for ($i = 0; $i<$num_tests; $i++) {
289 289
                 $resp = $c->send($req, 10, 'http11');
290 290
                 $response[] = $resp->value();
291 291
             }
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 foreach ($test_results as $test => $results) {
307 307
     echo "\nTEST: $test\n";
308 308
     foreach ($results as $case => $data) {
309
-        echo "  $case: {$data['time']} secs - Output data CRC: " . crc32(serialize($data['result'])) . "\n";
309
+        echo "  $case: {$data['time']} secs - Output data CRC: ".crc32(serialize($data['result']))."\n";
310 310
     }
311 311
 }
312 312
 
Please login to merge, or discard this patch.
demo/server/discuss.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . "/_prepend.php";
3
+require_once __DIR__."/_prepend.php";
4 4
 
5 5
 use PhpXmlRpc\Value;
6 6
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
             $count = 0;
32 32
         }
33 33
         // add the new comment in
34
-        dba_insert($msgID . "_comment_${count}", $comment, $dbh);
35
-        dba_insert($msgID . "_name_${count}", $name, $dbh);
34
+        dba_insert($msgID."_comment_${count}", $comment, $dbh);
35
+        dba_insert($msgID."_name_${count}", $name, $dbh);
36 36
         $count++;
37 37
         dba_replace($countID, $count, $dbh);
38 38
         dba_close($dbh);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $countID = "${msgID}_count";
66 66
         if (dba_exists($countID, $dbh)) {
67 67
             $count = dba_fetch($countID, $dbh);
68
-            for ($i = 0; $i < $count; $i++) {
68
+            for ($i = 0; $i<$count; $i++) {
69 69
                 $name = dba_fetch("${msgID}_name_${i}", $dbh);
70 70
                 $comment = dba_fetch("${msgID}_comment_${i}", $dbh);
71 71
                 // push a new struct onto the return array
@@ -101,4 +101,4 @@  discard block
 block discarded – undo
101 101
     ),
102 102
 ));
103 103
 
104
-require_once __DIR__ . "/_append.php";
104
+require_once __DIR__."/_append.php";
Please login to merge, or discard this patch.
demo/server/server.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * Please do not copy this file verbatim into your production server.
10 10
  **/
11 11
 
12
-require_once __DIR__ . "/_prepend.php";
12
+require_once __DIR__."/_prepend.php";
13 13
 
14 14
 use PhpXmlRpc\Value;
15 15
 
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
     // extract the value of the state number
106 106
     $snv = $sno->scalarval();
107 107
     // look it up in our array (zero-based)
108
-    if (isset($stateNames[$snv - 1])) {
109
-        $stateName = $stateNames[$snv - 1];
108
+    if (isset($stateNames[$snv-1])) {
109
+        $stateName = $stateNames[$snv-1];
110 110
     } else {
111 111
         // not there, so complain
112
-        $err = "I don't have a state for the index '" . $snv . "'";
112
+        $err = "I don't have a state for the index '".$snv."'";
113 113
     }
114 114
 
115 115
     // if we generated an error, create an error return response
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 {
136 136
     global $stateNames;
137 137
 
138
-    if (isset($stateNames[$stateNo - 1])) {
139
-        return $stateNames[$stateNo - 1];
138
+    if (isset($stateNames[$stateNo-1])) {
139
+        return $stateNames[$stateNo-1];
140 140
     } else {
141 141
         // not, there so complain
142
-        throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
142
+        throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
143 143
     }
144 144
 }
145 145
 
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
 eval($findstate9_sig['source']);
170 170
 
171 171
 $findstate10_sig = array(
172
-    "function" => function ($req) { return findState($req); },
172
+    "function" => function($req) { return findState($req); },
173 173
     "signature" => $findstate_sig,
174 174
     "docstring" => $findstate_doc,
175 175
 );
176 176
 
177
-$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return inner_findstate($stateNo); });
177
+$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return inner_findstate($stateNo); });
178 178
 
179 179
 $c = new xmlrpcServerMethodsContainer;
180 180
 $moreSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'tests.', 'method_type' => 'all'));
181 181
 
182
-$returnObj_sig =  $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
182
+$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
183 183
 
184 184
 // used to test signatures with NULL params
185 185
 $findstate12_sig = array(
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     $s = $req->getParam(0);
206 206
     $t = $req->getParam(1);
207 207
 
208
-    return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt));
208
+    return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt));
209 209
 }
210 210
 
211 211
 $addtwodouble_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble, Value::$xmlrpcDouble));
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     $s = $req->getParam(0);
216 216
     $t = $req->getParam(1);
217 217
 
218
-    return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble));
218
+    return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble));
219 219
 }
220 220
 
221 221
 $stringecho_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString));
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 function echoBack($req)
232 232
 {
233 233
     // just sends back a string with what i got sent to me, just escaped, that's all
234
-    $s = "I got the following message:\n" . $req->serialize();
234
+    $s = "I got the following message:\n".$req->serialize();
235 235
 
236 236
     return new PhpXmlRpc\Response(new Value($s));
237 237
 }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         return 0;
289 289
     }
290 290
 
291
-    return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
291
+    return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1;
292 292
 }
293 293
 
294 294
 $agesorter_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
     // hack, must make global as uksort() won't
335 335
     // allow us to pass any other auxiliary information
336 336
     uksort($agesorter_arr, 'agesorter_compare');
337
-    foreach($agesorter_arr as $key => $val) {
337
+    foreach ($agesorter_arr as $key => $val) {
338 338
         // recreate each struct element
339 339
         $v[] = new Value(
340 340
             array(
@@ -389,17 +389,17 @@  discard block
 block discarded – undo
389 389
         $err = "Error, no 'From' field specified";
390 390
     }
391 391
 
392
-    $msgHdr = "From: " . $mFrom->scalarval() . "\n";
393
-    $msgHdr .= "To: " . $mTo->scalarval() . "\n";
392
+    $msgHdr = "From: ".$mFrom->scalarval()."\n";
393
+    $msgHdr .= "To: ".$mTo->scalarval()."\n";
394 394
 
395 395
     if ($mCc->scalarval() != "") {
396
-        $msgHdr .= "Cc: " . $mCc->scalarval() . "\n";
396
+        $msgHdr .= "Cc: ".$mCc->scalarval()."\n";
397 397
     }
398 398
     if ($mBcc->scalarval() != "") {
399
-        $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n";
399
+        $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n";
400 400
     }
401 401
     if ($mMime->scalarval() != "") {
402
-        $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n";
402
+        $msgHdr .= "Content-type: ".$mMime->scalarval()."\n";
403 403
     }
404 404
     $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
405 405
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     $moe = $sno["moe"];
490 490
     $larry = $sno["larry"];
491 491
     $curly = $sno["curly"];
492
-    $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval();
492
+    $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval();
493 493
 
494 494
     return new PhpXmlRpc\Response(new Value($num, Value::$xmlrpcInt));
495 495
 }
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
     $ar = $req->getParam(0);
532 532
     $sz = $ar->count();
533 533
     $first = $ar[0];
534
-    $last = $ar[$sz - 1];
534
+    $last = $ar[$sz-1];
535 535
 
536
-    return new PhpXmlRpc\Response(new Value($first->scalarval() .
536
+    return new PhpXmlRpc\Response(new Value($first->scalarval().
537 537
         $last->scalarval(), Value::$xmlrpcString));
538 538
 }
539 539
 
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
     $larry = $fools["larry"];
568 568
     $moe = $fools["moe"];
569 569
 
570
-    return new PhpXmlRpc\Response(new Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), Value::$xmlrpcInt));
570
+    return new PhpXmlRpc\Response(new Value($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), Value::$xmlrpcInt));
571 571
 }
572 572
 
573 573
 $v1_countTheEntities_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcString));
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
     $ap = 0;
582 582
     $qu = 0;
583 583
     $amp = 0;
584
-    for ($i = 0; $i < strlen($str); $i++) {
584
+    for ($i = 0; $i<strlen($str); $i++) {
585 585
         $c = substr($str, $i, 1);
586 586
         switch ($c) {
587 587
             case ">":
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
     ),
784 784
     // Greek word 'kosme'. NB: NOT a valid ISO8859 string!
785 785
     // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods
786
-    "tests.utf8methodname." . 'κόσμε' => array(
786
+    "tests.utf8methodname.".'κόσμε' => array(
787 787
         "function" => "stringEcho",
788 788
         "signature" => $stringecho_sig,
789 789
         "docstring" => $stringecho_doc,
@@ -976,4 +976,4 @@  discard block
 block discarded – undo
976 976
 $s->service();
977 977
 // That should do all we need!
978 978
 
979
-require_once __DIR__ . "/_append.php";
979
+require_once __DIR__."/_append.php";
Please login to merge, or discard this patch.