Passed
Push — master ( d641b4...052fbc )
by Gaetano
05:20
created
lib/xmlrpc.inc 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $val = reset($ar);
96 96
         $typ = key($ar);
97 97
 
98
-        return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
98
+        return '<value>'.$this->serializedata($typ, $val)."</value>\n";
99 99
         //}
100 100
     }
101 101
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         // preserve back compatibility
115 115
 
116 116
         if (is_array($b)) {
117
-            foreach($b as $id => $cont) {
117
+            foreach ($b as $id => $cont) {
118 118
                 $b[$id] = $cont->scalarval();
119 119
             }
120 120
         }
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
         // add support for structures directly encoding php objects
123 123
         if (is_object($b)) {
124 124
             $t = get_object_vars($b);
125
-            foreach($t as $id => $cont) {
125
+            foreach ($t as $id => $cont) {
126 126
                 $t[$id] = $cont->scalarval();
127 127
             }
128
-            foreach($t as $id => $cont) {
128
+            foreach ($t as $id => $cont) {
129 129
                 @$b->$id = $cont;
130 130
             }
131 131
         }
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 /* Expose as global functions the ones which are now class methods */
161 161
 
162 162
 /// Wrong speling, but we are adamant on backwards compatibility!
163
-function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='')
163
+function xmlrpc_encode_entitites($data, $srcEncoding = '', $destEncoding = '')
164 164
 {
165 165
     return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding);
166 166
 }
167 167
 
168
-function iso8601_encode($timeT, $utc=0)
168
+function iso8601_encode($timeT, $utc = 0)
169 169
 {
170 170
     return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc);
171 171
 }
172 172
 
173
-function iso8601_decode($iDate, $utc=0)
173
+function iso8601_decode($iDate, $utc = 0)
174 174
 {
175 175
     return PhpXmlRpc\Helper\Date::iso8601Decode($iDate, $utc);
176 176
 }
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
     return PhpXmlRpc\Helper\Http::decodeChunked($buffer);
181 181
 }
182 182
 
183
-function php_xmlrpc_decode($xmlrpcVal, $options=array())
183
+function php_xmlrpc_decode($xmlrpcVal, $options = array())
184 184
 {
185 185
     $encoder = new PhpXmlRpc\Encoder();
186 186
     return $encoder->decode($xmlrpcVal, $options);
187 187
 }
188 188
 
189
-function php_xmlrpc_encode($phpVal, $options=array())
189
+function php_xmlrpc_encode($phpVal, $options = array())
190 190
 {
191 191
     $encoder = new PhpXmlRpc\Encoder();
192 192
     return $encoder->encode($phpVal, $options);
193 193
 }
194 194
 
195
-function php_xmlrpc_decode_xml($xmlVal, $options=array())
195
+function php_xmlrpc_decode_xml($xmlVal, $options = array())
196 196
 {
197 197
     $encoder = new PhpXmlRpc\Encoder();
198 198
     return $encoder->decodeXml($xmlVal, $options);
199 199
 }
200 200
 
201
-function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null)
201
+function guess_encoding($httpHeader = '', $xmlChunk = '', $encodingPrefs = null)
202 202
 {
203 203
     return PhpXmlRpc\Helper\XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs);
204 204
 }
Please login to merge, or discard this patch.
lib/xmlrpcs.inc 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function echoInput()
54 54
     {
55
-        $r = new PhpXmlRpc\Response(new PhpXmlRpc\Value("'Aha said I: '" . file_get_contents('php://input'), 'string'));
55
+        $r = new PhpXmlRpc\Response(new PhpXmlRpc\Value("'Aha said I: '".file_get_contents('php://input'), 'string'));
56 56
         print $r->serialize();
57 57
     }
58 58
 }
@@ -68,30 +68,30 @@  discard block
 block discarded – undo
68 68
     PhpXmlRpc\Server::xmlrpc_debugmsg($m);
69 69
 }
70 70
 
71
-function _xmlrpcs_getCapabilities($server, $m=null)
71
+function _xmlrpcs_getCapabilities($server, $m = null)
72 72
 {
73 73
     return PhpXmlRpc\Server::_xmlrpcs_getCapabilities($server, $m);
74 74
 }
75 75
 
76
-$_xmlrpcs_listMethods_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray));
77
-$_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
78
-$_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
79
-function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
76
+$_xmlrpcs_listMethods_sig = array(array(\PhpXmlRpc\Value::$xmlrpcArray));
77
+$_xmlrpcs_listMethods_doc = 'This method lists all the methods that the XML-RPC server knows how to dispatch';
78
+$_xmlrpcs_listMethods_sdoc = array(array('list of method names'));
79
+function _xmlrpcs_listMethods($server, $m = null) // if called in plain php values mode, second param is missing
80 80
 {
81 81
     return PhpXmlRpc\Server::_xmlrpcs_listMethods($server, $m);
82 82
 }
83 83
 
84
-$_xmlrpcs_methodSignature_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray, $GLOBALS['xmlrpcString']));
85
-$_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
86
-$_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
84
+$_xmlrpcs_methodSignature_sig = array(array(\PhpXmlRpc\Value::$xmlrpcArray, $GLOBALS['xmlrpcString']));
85
+$_xmlrpcs_methodSignature_doc = 'Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
86
+$_xmlrpcs_methodSignature_sdoc = array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
87 87
 function _xmlrpcs_methodSignature($server, $m)
88 88
 {
89 89
     return PhpXmlRpc\Server::_xmlrpcs_methodSignature($server, $m);
90 90
 }
91 91
 
92
-$_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
93
-$_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
94
-$_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));
92
+$_xmlrpcs_methodHelp_sig = array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
93
+$_xmlrpcs_methodHelp_doc = 'Returns help text if defined for the method passed, otherwise returns an empty string';
94
+$_xmlrpcs_methodHelp_sdoc = array(array('method description', 'name of the method to be described'));
95 95
 function _xmlrpcs_methodHelp($server, $m)
96 96
 {
97 97
     return PhpXmlRpc\Server::_xmlrpcs_methodHelp($server, $m);
Please login to merge, or discard this patch.
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.
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.
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/_append.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 // Out-of-band information: let the client manipulate the server operations.
4 4
 // We do this to help the testsuite script: do not reproduce in production!
5 5
 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
6
-    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
6
+    include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
7 7
 }
Please login to merge, or discard this patch.