Passed
Push — master ( 55c666...d911f1 )
by Gaetano
12:22 queued 02:19
created
tests/parse_args.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         // check for command line params (passed as env vars) vs. web page input params (passed as GET/POST)
47 47
         // Note that the only use-case for web-page mode is when this is used by benchmark.php
48 48
         if (!isset($_SERVER['REQUEST_METHOD'])) {
49
-            foreach($_SERVER as $key => $val) {
49
+            foreach ($_SERVER as $key => $val) {
50 50
                 if (array_key_exists($key, $args)) {
51 51
                     $$key = $val;
52 52
                 }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             //}
92 92
         }
93 93
         if ($HTTPURI[0] != '/') {
94
-            $HTTPURI = '/' . $HTTPURI;
94
+            $HTTPURI = '/'.$HTTPURI;
95 95
         }
96 96
         $args['HTTPURI'] = $HTTPURI;
97 97
 
@@ -105,21 +105,21 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         if (isset($HTTPSIGNOREPEER)) {
108
-            $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER;
108
+            $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER;
109 109
         }
110 110
 
111 111
         if (isset($HTTPSVERIFYHOST)) {
112
-            $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
112
+            $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST;
113 113
         }
114 114
 
115 115
         if (isset($SSLVERSION)) {
116
-            $args['SSLVERSION'] = (int)$SSLVERSION;
116
+            $args['SSLVERSION'] = (int) $SSLVERSION;
117 117
         }
118 118
 
119 119
         if (isset($PROXYSERVER)) {
120 120
             $arr = explode(':', $PROXYSERVER);
121 121
             $args['PROXYSERVER'] = $arr[0];
122
-            if (count($arr) > 1) {
122
+            if (count($arr)>1) {
123 123
                 $args['PROXYPORT'] = $arr[1];
124 124
             } else {
125 125
                 $args['PROXYPORT'] = 8080;
Please login to merge, or discard this patch.
demo/server/legacy.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@
 block discarded – undo
5 5
  * It mimics server.php, but does not rely on other autoload mechanisms than the loading of xmlrpc.inc and xmlrpcs.inc
6 6
  */
7 7
 
8
-require_once __DIR__ . "/../../lib/xmlrpc.inc";
9
-require_once __DIR__ . "/../../lib/xmlrpcs.inc";
8
+require_once __DIR__."/../../lib/xmlrpc.inc";
9
+require_once __DIR__."/../../lib/xmlrpcs.inc";
10 10
 
11 11
 $signatures1 = include(__DIR__.'/methodProviders/functions.php');
12 12
 $signatures2 = include(__DIR__.'/methodProviders/interop.php');
Please login to merge, or discard this patch.
tests/legacy_loader_test.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@  discard block
 block discarded – undo
4 4
  * A test file designed to test the legacy API class-loading mechanism, ie. not using phpunit/composer's autoload_
5 5
  */
6 6
 
7
-include_once __DIR__ . '/../lib/xmlrpc.inc';
7
+include_once __DIR__.'/../lib/xmlrpc.inc';
8 8
 
9
-include_once __DIR__ . '/parse_args.php';
9
+include_once __DIR__.'/parse_args.php';
10 10
 
11 11
 $args = argParser::getArgs();
12
-$baseurl = 'http://' . $args['HTTPSERVER'] . str_replace('/server.php', '/legacy.php', $args['HTTPURI']);
12
+$baseurl = 'http://'.$args['HTTPSERVER'].str_replace('/server.php', '/legacy.php', $args['HTTPURI']);
13 13
 
14 14
 $randId = uniqid();
15
-file_put_contents(sys_get_temp_dir() . '/phpunit_rand_id.txt', $randId);
15
+file_put_contents(sys_get_temp_dir().'/phpunit_rand_id.txt', $randId);
16 16
 
17 17
 $client = new xmlrpc_client($baseurl);
18 18
 $client->setCookie('PHPUNIT_RANDOM_TEST_ID', $randId);
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $req = new xmlrpcmsg('system.listMethods', array());
21 21
 $resp = $client->send($req);
22 22
 if ($resp->faultCode() !== 0) {
23
-    throw new \Exception("system.listMethods returned fault " . $resp->faultCode());
23
+    throw new \Exception("system.listMethods returned fault ".$resp->faultCode());
24 24
 }
25 25
 
26
-unlink(sys_get_temp_dir() . '/phpunit_rand_id.txt');
26
+unlink(sys_get_temp_dir().'/phpunit_rand_id.txt');
Please login to merge, or discard this patch.
tests/13LegacyAPITest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/ServerAwareTestCase.php';
3
+include_once __DIR__.'/ServerAwareTestCase.php';
4 4
 
5 5
 /**
6 6
  * Long-term, this should replace all testing of the legacy API done via the main test-suite...
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         /// @todo pass on as cli args for the executed script all the args that are already parsed by now, plus $this->testId
13 13
 
14
-        exec('php ' . __DIR__ . '/legacy_loader_test.php', $out, $result);
14
+        exec('php '.__DIR__.'/legacy_loader_test.php', $out, $result);
15 15
 
16 16
         /// @todo dump output if in debug mode or if test fails
17 17
 
Please login to merge, or discard this patch.
src/Request.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             return true;
86 86
         } else {
87
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': value passed in must be a PhpXmlRpc\Value');
87
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': value passed in must be a PhpXmlRpc\Value');
88 88
             return false;
89 89
         }
90 90
     }
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
         $this->logDeprecationUnlessCalledBy('serialize');
135 135
 
136 136
         if ($charsetEncoding != '') {
137
-            $this->content_type = 'text/xml; charset=' . $charsetEncoding;
137
+            $this->content_type = 'text/xml; charset='.$charsetEncoding;
138 138
         } else {
139 139
             $this->content_type = 'text/xml';
140 140
         }
141 141
 
142 142
         $result = $this->xml_header($charsetEncoding);
143
-        $result .= '<methodName>' . $this->getCharsetEncoder()->encodeEntities(
144
-                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</methodName>\n";
143
+        $result .= '<methodName>'.$this->getCharsetEncoder()->encodeEntities(
144
+                $this->methodname, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</methodName>\n";
145 145
         $result .= "<params>\n";
146 146
         foreach ($this->params as $p) {
147
-            $result .= "<param>\n" . $p->serialize($charsetEncoding) .
147
+            $result .= "<param>\n".$p->serialize($charsetEncoding).
148 148
                 "</param>\n";
149 149
         }
150 150
         $result .= "</params>\n";
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
         $this->logDeprecationUnlessCalledBy('createPayload');
165 165
 
166 166
         if ($charsetEncoding != '') {
167
-            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?" . ">\n<methodCall>\n";
167
+            return "<?xml version=\"1.0\" encoding=\"$charsetEncoding\" ?".">\n<methodCall>\n";
168 168
         } else {
169
-            return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
169
+            return "<?xml version=\"1.0\"?".">\n<methodCall>\n";
170 170
         }
171 171
     }
172 172
 
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
      */
229 229
     public function parseResponse($data = '', $headersProcessed = false, $returnType = XMLParser::RETURN_XMLRPCVALS)
230 230
     {
231
-        if ($this->debug > 0) {
231
+        if ($this->debug>0) {
232 232
             $this->getLogger()->debug("---GOT---\n$data\n---END---");
233 233
         }
234 234
 
235 235
         $this->httpResponse = array('raw_data' => $data, 'headers' => array(), 'cookies' => array());
236 236
 
237 237
         if ($data == '') {
238
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': no response received from server.');
238
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': no response received from server.');
239 239
             return new Response(0, PhpXmlRpc::$xmlrpcerr['no_data'], PhpXmlRpc::$xmlrpcstr['no_data']);
240 240
         }
241 241
 
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
         if (substr($data, 0, 4) == 'HTTP') {
244 244
             $httpParser = new Http();
245 245
             try {
246
-                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug > 0);
246
+                $httpResponse = $httpParser->parseResponseHeaders($data, $headersProcessed, $this->debug>0);
247 247
             } catch (HttpException $e) {
248 248
                 // failed processing of HTTP response headers
249 249
                 // save into response obj the full payload received, for debugging
250 250
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data, 'status_code', $e->statusCode()));
251
-            } catch(\Exception $e) {
251
+            } catch (\Exception $e) {
252 252
                 return new Response(0, $e->getCode(), $e->getMessage(), '', array('raw_data' => $data));
253 253
             }
254 254
         } else {
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         // idea from Luca Mariano, originally in PEARified version of the lib
265 265
         $pos = strrpos($data, '</methodResponse>');
266 266
         if ($pos !== false) {
267
-            $data = substr($data, 0, $pos + 17);
267
+            $data = substr($data, 0, $pos+17);
268 268
         }
269 269
 
270 270
         // try to 'guestimate' the character encoding of the received response
@@ -273,21 +273,21 @@  discard block
 block discarded – undo
273 273
             $data
274 274
         );
275 275
 
276
-        if ($this->debug >= 0) {
276
+        if ($this->debug>=0) {
277 277
             $this->httpResponse = $httpResponse;
278 278
         } else {
279 279
             $httpResponse = null;
280 280
         }
281 281
 
282
-        if ($this->debug > 0) {
282
+        if ($this->debug>0) {
283 283
             $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
284 284
             if ($start) {
285 285
                 $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
286 286
                 /// @todo what if there is no end tag?
287 287
                 $end = strpos($data, '-->', $start);
288
-                $comments = substr($data, $start, $end - $start);
289
-                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t" .
290
-                    str_replace("\n", "\n\t", base64_decode($comments)) . "\n---END---", array('encoding' => $respEncoding));
288
+                $comments = substr($data, $start, $end-$start);
289
+                $this->getLogger()->debug("---SERVER DEBUG INFO (DECODED)---\n\t".
290
+                    str_replace("\n", "\n\t", base64_decode($comments))."\n---END---", array('encoding' => $respEncoding));
291 291
             }
292 292
         }
293 293
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
                     if ($respEncoding == 'ISO-8859-1') {
310 310
                         $data = utf8_encode($data);
311 311
                     } else {
312
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': unsupported charset encoding of received response: ' . $respEncoding);
312
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': unsupported charset encoding of received response: '.$respEncoding);
313 313
                     }
314 314
                 }
315 315
             }
@@ -339,16 +339,16 @@  discard block
 block discarded – undo
339 339
             //    there could be proxies meddling with the request, or network data corruption...
340 340
 
341 341
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['invalid_xml'],
342
-                PhpXmlRpc::$xmlrpcstr['invalid_xml'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
342
+                PhpXmlRpc::$xmlrpcstr['invalid_xml'].' '.$_xh['isf_reason'], '', $httpResponse);
343 343
 
344
-            if ($this->debug > 0) {
344
+            if ($this->debug>0) {
345 345
                 $this->getLogger()->debug($_xh['isf_reason']);
346 346
             }
347 347
         }
348 348
         // second error check: xml well-formed but not xml-rpc compliant
349 349
         elseif ($_xh['isf'] == 2) {
350 350
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_not_compliant'],
351
-                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'] . ' ' . $_xh['isf_reason'], '', $httpResponse);
351
+                PhpXmlRpc::$xmlrpcstr['xml_not_compliant'].' '.$_xh['isf_reason'], '', $httpResponse);
352 352
 
353 353
             /// @todo echo something for the user? check if it was already done by the parser...
354 354
             //if ($this->debug > 0) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         // third error check: parsing of the response has somehow gone boink.
359 359
         /// @todo shall we omit the 2nd part of this check, since we trust the parsing code?
360 360
         ///       Either that, or check the fault results too...
361
-        elseif ($_xh['isf'] > 3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
361
+        elseif ($_xh['isf']>3 || ($returnType == XMLParser::RETURN_XMLRPCVALS && !$_xh['isf'] && !is_object($_xh['value']))) {
362 362
             // something odd has happened and it's time to generate a client side error indicating something odd went on
363 363
             $r = new Response(0, PhpXmlRpc::$xmlrpcerr['xml_parsing_error'], PhpXmlRpc::$xmlrpcstr['xml_parsing_error'],
364 364
                 '', $httpResponse
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
             /// @todo echo something for the user?
368 368
         } else {
369
-            if ($this->debug > 1) {
369
+            if ($this->debug>1) {
370 370
                 $this->getLogger()->debug(
371 371
                     "---PARSED---\n".var_export($_xh['value'], true)."\n---END---"
372 372
                 );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
                 if ($errNo == 0) {
391 391
                     // FAULT returned, errno needs to reflect that
392 392
                     /// @todo feature creep - add this code to PhpXmlRpc::$xmlrpcerr
393
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': fault response received with faultCode 0 or null. Converted it to -1');
393
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': fault response received with faultCode 0 or null. Converted it to -1');
394 394
                     /// @todo in Encoder::decodeXML, we use PhpXmlRpc::$xmlrpcerr['invalid_return'] for this case (see
395 395
                     ///       also the todo 17 lines above)
396 396
                     $errNo = -1;
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             case '_php_class':
439 439
             case 'payload':
440 440
             case 'content_type':
441
-                $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
441
+                $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
442 442
                 return $this->$name;
443 443
             case 'httpResponse':
444 444
                 // manually implement the 'protected property' behaviour
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
                     }
451 451
                 }
452 452
                 if ($canAccess) {
453
-                    $this->logDeprecation('Getting property Request::' . $name . ' is deprecated');
453
+                    $this->logDeprecation('Getting property Request::'.$name.' is deprecated');
454 454
                     return $this->httpResponse;
455 455
                 } else {
456
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
456
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
457 457
                 }
458 458
                 break;
459 459
             default:
460 460
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
461 461
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
462
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
462
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
463 463
                 $result = null;
464 464
                 return $result;
465 465
         }
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
             case 'debug':
474 474
             case 'payload':
475 475
             case 'content_type':
476
-                $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
476
+                $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
477 477
                 $this->$name = $value;
478 478
                 break;
479 479
             case 'httpResponse':
@@ -486,16 +486,16 @@  discard block
 block discarded – undo
486 486
                     }
487 487
                 }
488 488
                 if ($canAccess) {
489
-                    $this->logDeprecation('Setting property Request::' . $name . ' is deprecated');
489
+                    $this->logDeprecation('Setting property Request::'.$name.' is deprecated');
490 490
                     $this->httpResponse = $value;
491 491
                 } else {
492
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
492
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
493 493
                 }
494 494
                 break;
495 495
             default:
496 496
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
497 497
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
498
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
498
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
499 499
         }
500 500
     }
501 501
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             case 'debug':
508 508
             case 'payload':
509 509
             case 'content_type':
510
-                $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
510
+                $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
511 511
                 return isset($this->$name);
512 512
             case 'httpResponse':
513 513
                 // manually implement the 'protected property' behaviour
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
                     }
520 520
                 }
521 521
                 if ($canAccess) {
522
-                    $this->logDeprecation('Checking property Request::' . $name . ' is deprecated');
522
+                    $this->logDeprecation('Checking property Request::'.$name.' is deprecated');
523 523
                     return isset($this->httpResponse);
524 524
                 }
525 525
                 // break through voluntarily
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
             case 'debug':
537 537
             case 'payload':
538 538
             case 'content_type':
539
-                $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
539
+                $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
540 540
                 unset($this->$name);
541 541
                 break;
542 542
             case 'httpResponse':
@@ -549,16 +549,16 @@  discard block
 block discarded – undo
549 549
                     }
550 550
                 }
551 551
                 if ($canAccess) {
552
-                    $this->logDeprecation('Unsetting property Request::' . $name . ' is deprecated');
552
+                    $this->logDeprecation('Unsetting property Request::'.$name.' is deprecated');
553 553
                     unset($this->httpResponse);
554 554
                 } else {
555
-                    trigger_error("Cannot access protected property Request::httpResponse in " . __FILE__, E_USER_ERROR);
555
+                    trigger_error("Cannot access protected property Request::httpResponse in ".__FILE__, E_USER_ERROR);
556 556
                 }
557 557
                 break;
558 558
             default:
559 559
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
560 560
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
561
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
561
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
562 562
         }
563 563
     }
564 564
 }
Please login to merge, or discard this patch.
src/Helper/XMLParser.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
             // q: can php be built without ctype? should we use a regexp?
188 188
             if (is_string($key) && !ctype_digit($key)) {
189 189
                 /// @todo on invalid options, throw/error-out instead of logging an error message?
190
-                switch($key) {
190
+                switch ($key) {
191 191
                     case 'target_charset':
192 192
                         if (function_exists('mb_convert_encoding')) {
193 193
                             $this->current_parsing_options['target_charset'] = $val;
194 194
                         } else {
195
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": 'target_charset' option is unsupported without mbstring");
195
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": 'target_charset' option is unsupported without mbstring");
196 196
                         }
197 197
                         break;
198 198
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                         if (is_callable($val)) {
201 201
                             $this->current_parsing_options['methodname_callback'] = $val;
202 202
                         } else {
203
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Callback passed as 'methodname_callback' is not callable");
203
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.": Callback passed as 'methodname_callback' is not callable");
204 204
                         }
205 205
                         break;
206 206
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         break;
212 212
 
213 213
                     default:
214
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": unsupported option: $key");
214
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.": unsupported option: $key");
215 215
                 }
216 216
                 unset($mergedOptions[$key]);
217 217
             }
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 
258 258
         try {
259 259
             // @see ticket #70 - we have to parse big xml docs in chunks to avoid errors
260
-            for ($offset = 0; $offset < $len; $offset += $this->maxChunkLength) {
260
+            for ($offset = 0; $offset<$len; $offset += $this->maxChunkLength) {
261 261
                 $chunk = substr($data, $offset, $this->maxChunkLength);
262 262
                 // error handling: xml not well formed
263
-                if (!xml_parse($parser, $chunk, $offset + $this->maxChunkLength >= $len)) {
263
+                if (!xml_parse($parser, $chunk, $offset+$this->maxChunkLength>=$len)) {
264 264
                     $errCode = xml_get_error_code($parser);
265 265
                     $errStr = sprintf('XML error %s: %s at line %d, column %d', $errCode, xml_error_string($errCode),
266 266
                         xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $this->_xh['isf_reason'] = $errStr;
270 270
                 }
271 271
                 // no need to parse further if we already have a fatal error
272
-                if ($this->_xh['isf'] >= 2) {
272
+                if ($this->_xh['isf']>=2) {
273 273
                     break;
274 274
                 }
275 275
             }
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
     public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false)
315 315
     {
316 316
         // if invalid xml-rpc already detected, skip all processing
317
-        if ($this->_xh['isf'] >= 2) {
317
+        if ($this->_xh['isf']>=2) {
318 318
             return;
319 319
         }
320 320
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
             if ($acceptSingleVals === false) {
329 329
                 $accept = $this->current_parsing_options['accept'];
330 330
             } else {
331
-                $this->logDeprecation('Using argument $acceptSingleVals for method ' . __METHOD__ . ' is deprecated');
331
+                $this->logDeprecation('Using argument $acceptSingleVals for method '.__METHOD__.' is deprecated');
332 332
                 $accept = self::ACCEPT_REQUEST | self::ACCEPT_RESPONSE | self::ACCEPT_VALUE;
333 333
             }
334 334
             if (($name == 'METHODCALL' && ($accept & self::ACCEPT_REQUEST)) ||
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
                 $this->_xh['rt'] = strtolower($name);
339 339
             } else {
340 340
                 $this->_xh['isf'] = 2;
341
-                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: ' . $name;
341
+                $this->_xh['isf_reason'] = 'missing top level xmlrpc element. Found: '.$name;
342 342
 
343 343
                 return;
344 344
             }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 
444 444
             case 'MEMBER':
445 445
                 // set member name to null, in case we do not find in the xml later on
446
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = null;
446
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = null;
447 447
                 //$this->_xh['ac']='';
448 448
                 // Drop trough intentionally
449 449
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
      */
507 507
     public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1)
508 508
     {
509
-        if ($this->_xh['isf'] >= 2) {
509
+        if ($this->_xh['isf']>=2) {
510 510
             return;
511 511
         }
512 512
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
                     $this->_xh['value'] = mb_convert_encoding($this->_xh['value'], $this->current_parsing_options['target_charset'], 'UTF-8');
529 529
                 }
530 530
 
531
-                if ($rebuildXmlrpcvals > 0) {
531
+                if ($rebuildXmlrpcvals>0) {
532 532
                     // build the xml-rpc val out of the data received, and substitute it
533 533
                     $temp = new Value($this->_xh['value'], $this->_xh['vt']);
534 534
                     // in case we got info about underlying php class, save it in the object we're rebuilding
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
                         $temp->_php_class = $this->_xh['php_class'];
537 537
                     }
538 538
                     $this->_xh['value'] = $temp;
539
-                } elseif ($rebuildXmlrpcvals < 0) {
539
+                } elseif ($rebuildXmlrpcvals<0) {
540 540
                     if ($this->_xh['vt'] == Value::$xmlrpcDateTime) {
541
-                        $this->_xh['value'] = (object)array(
541
+                        $this->_xh['value'] = (object) array(
542 542
                             'xmlrpc_type' => 'datetime',
543 543
                             'scalar' => $this->_xh['value'],
544 544
                             'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($this->_xh['value'])
545 545
                         );
546 546
                     } elseif ($this->_xh['vt'] == Value::$xmlrpcBase64) {
547
-                        $this->_xh['value'] = (object)array(
547
+                        $this->_xh['value'] = (object) array(
548 548
                             'xmlrpc_type' => 'base64',
549 549
                             'scalar' => $this->_xh['value']
550 550
                         );
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
                 // check if we are inside an array or struct:
560 560
                 // if value just built is inside an array, let's move it into array on the stack
561 561
                 $vscount = count($this->_xh['valuestack']);
562
-                if ($vscount && $this->_xh['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
563
-                    $this->_xh['valuestack'][$vscount - 1]['values'][] = $this->_xh['value'];
562
+                if ($vscount && $this->_xh['valuestack'][$vscount-1]['type'] == 'ARRAY') {
563
+                    $this->_xh['valuestack'][$vscount-1]['values'][] = $this->_xh['value'];
564 564
                 }
565 565
                 break;
566 566
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
                     // log if receiving something strange, even though we set the value to false anyway
588 588
                     /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL
589 589
                     if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
590
-                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: ' .
590
+                        if (!$this->handleParsingError('invalid data received in BOOLEAN value: '.
591 591
                             $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
592 592
                             return;
593 593
                         }
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                 $this->_xh['vt'] = strtolower($name);
608 608
                 $this->_xh['lv'] = 3; // indicate we've found a value
609 609
                 if (!preg_match(PhpXmlRpc::$xmlrpc_int_format, $this->_xh['ac'])) {
610
-                    if (!$this->handleParsingError('non numeric data received in INT value: ' .
610
+                    if (!$this->handleParsingError('non numeric data received in INT value: '.
611 611
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
612 612
                         return;
613 613
                     }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
616 616
                 } else {
617 617
                     // it's ok, add it on
618
-                    $this->_xh['value'] = (int)$this->_xh['ac'];
618
+                    $this->_xh['value'] = (int) $this->_xh['ac'];
619 619
                 }
620 620
                 break;
621 621
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
                 $this->_xh['vt'] = Value::$xmlrpcDouble;
624 624
                 $this->_xh['lv'] = 3; // indicate we've found a value
625 625
                 if (!preg_match(PhpXmlRpc::$xmlrpc_double_format, $this->_xh['ac'])) {
626
-                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: ' .
626
+                    if (!$this->handleParsingError('non numeric data received in DOUBLE value: '.
627 627
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
628 628
                         return;
629 629
                     }
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
                     $this->_xh['value'] = 'ERROR_NON_NUMERIC_FOUND';
632 632
                 } else {
633 633
                     // it's ok, add it on
634
-                    $this->_xh['value'] = (double)$this->_xh['ac'];
634
+                    $this->_xh['value'] = (double) $this->_xh['ac'];
635 635
                 }
636 636
                 break;
637 637
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
                 $this->_xh['vt'] = Value::$xmlrpcDateTime;
640 640
                 $this->_xh['lv'] = 3; // indicate we've found a value
641 641
                 if (!preg_match(PhpXmlRpc::$xmlrpc_datetime_format, $this->_xh['ac'])) {
642
-                    if (!$this->handleParsingError('invalid data received in DATETIME value: ' .
642
+                    if (!$this->handleParsingError('invalid data received in DATETIME value: '.
643 643
                         $this->truncateValueForLog($this->_xh['ac']), __METHOD__)) {
644 644
                         return;
645 645
                     }
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 
651 651
                     // the default regex used to validate the date string a few lines above should make this case impossible,
652 652
                     // but one never knows...
653
-                    } catch(\Exception $e) {
653
+                    } catch (\Exception $e) {
654 654
                         // what to do? We can not guarantee that a valid date can be created. We return null...
655
-                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error ' .
655
+                        if (!$this->handleParsingError('invalid data received in DATETIME value. Error '.
656 656
                             $e->getMessage(), __METHOD__)) {
657 657
                             return;
658 658
                         }
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
                     $v = base64_decode($this->_xh['ac'], true);
670 670
                     if ($v === false) {
671 671
                         $this->_xh['isf'] = 2;
672
-                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '. $this->truncateValueForLog($this->_xh['ac']);
672
+                        $this->_xh['isf_reason'] = 'Invalid data received in BASE64 value: '.$this->truncateValueForLog($this->_xh['ac']);
673 673
                         return;
674 674
                     }
675 675
                 } else {
676 676
                     $v = base64_decode($this->_xh['ac']);
677 677
                     if ($v === '' && $this->_xh['ac'] !== '') {
678 678
                         // only the empty string should decode to the empty string
679
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid data received in BASE64 value: ' .
679
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid data received in BASE64 value: '.
680 680
                             $this->truncateValueForLog($this->_xh['ac']));
681 681
                     }
682 682
                 }
@@ -684,20 +684,20 @@  discard block
 block discarded – undo
684 684
                 break;
685 685
 
686 686
             case 'NAME':
687
-                $this->_xh['valuestack'][count($this->_xh['valuestack']) - 1]['name'] = $this->_xh['ac'];
687
+                $this->_xh['valuestack'][count($this->_xh['valuestack'])-1]['name'] = $this->_xh['ac'];
688 688
                 break;
689 689
 
690 690
             case 'MEMBER':
691 691
                 // add to array in the stack the last element built, unless no VALUE or no NAME were found
692 692
                 if ($this->_xh['vt']) {
693 693
                     $vscount = count($this->_xh['valuestack']);
694
-                    if ($this->_xh['valuestack'][$vscount - 1]['name'] === null) {
694
+                    if ($this->_xh['valuestack'][$vscount-1]['name'] === null) {
695 695
                         if (!$this->handleParsingError('missing NAME inside STRUCT in received xml', __METHOD__)) {
696 696
                             return;
697 697
                         }
698
-                        $this->_xh['valuestack'][$vscount - 1]['name'] = '';
698
+                        $this->_xh['valuestack'][$vscount-1]['name'] = '';
699 699
                     }
700
-                    $this->_xh['valuestack'][$vscount - 1]['values'][$this->_xh['valuestack'][$vscount - 1]['name']] = $this->_xh['value'];
700
+                    $this->_xh['valuestack'][$vscount-1]['values'][$this->_xh['valuestack'][$vscount-1]['name']] = $this->_xh['value'];
701 701
                 } else {
702 702
                     if (!$this->handleParsingError('missing VALUE inside STRUCT in received xml', __METHOD__)) {
703 703
                         return;
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
     public function xmlrpc_cd($parser, $data)
829 829
     {
830 830
         // skip processing if xml fault already detected
831
-        if ($this->_xh['isf'] >= 2) {
831
+        if ($this->_xh['isf']>=2) {
832 832
             return;
833 833
         }
834 834
 
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     public function xmlrpc_dh($parser, $data)
851 851
     {
852 852
         // skip processing if xml fault already detected
853
-        if ($this->_xh['isf'] >= 2) {
853
+        if ($this->_xh['isf']>=2) {
854 854
             return;
855 855
         }
856 856
 
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
931 931
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
932 932
         // We could be stricter on version number: VersionNum ::= '1.' [0-9]+
933
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
934
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
933
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
934
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
935 935
             $xmlChunk, $matches)) {
936 936
             return strtoupper(substr($matches[2], 1, -1));
937 937
         }
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
950 950
             // IANA also likes better US-ASCII, so go with it
951 951
             if ($enc == 'ASCII') {
952
-                $enc = 'US-' . $enc;
952
+                $enc = 'US-'.$enc;
953 953
             }
954 954
 
955 955
             return $enc;
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
         // SPACE:         (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
991 991
         // EQ:            SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
992 992
         // We could be stricter on version number: VersionNum ::= '1.' [0-9]+
993
-        if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
994
-            '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
993
+        if (preg_match('/^<\?xml\s+version\s*=\s*'."((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
994
+            '\s+encoding\s*=\s*'."((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
995 995
             $xmlChunk)) {
996 996
             return true;
997 997
         }
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
             $this->_xh['isf_reason'] = ucfirst($message);
1012 1012
             return false;
1013 1013
         } else {
1014
-            $this->getLogger()->error('XML-RPC: ' . ($method != '' ? $method . ': ' : '') . $message);
1014
+            $this->getLogger()->error('XML-RPC: '.($method != '' ? $method.': ' : '').$message);
1015 1015
             return true;
1016 1016
         }
1017 1017
     }
@@ -1023,8 +1023,8 @@  discard block
 block discarded – undo
1023 1023
      */
1024 1024
     protected function truncateValueForLog($data)
1025 1025
     {
1026
-        if (strlen($data) > $this->maxLogValueLength) {
1027
-            return substr($data, 0, $this->maxLogValueLength - 3) . '...';
1026
+        if (strlen($data)>$this->maxLogValueLength) {
1027
+            return substr($data, 0, $this->maxLogValueLength-3).'...';
1028 1028
         }
1029 1029
 
1030 1030
         return $data;
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
     public function xmlrpc_se_any($parser, $name, $attrs)
1046 1046
     {
1047 1047
         // this will be spamming the log if this method is in use...
1048
-        $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated');
1048
+        $this->logDeprecation('Method '.__METHOD__.' is deprecated');
1049 1049
 
1050 1050
         $this->xmlrpc_se($parser, $name, $attrs, true);
1051 1051
     }
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
         switch ($name) {
1056 1056
             case '_xh':
1057 1057
             case 'xmlrpc_valid_parents':
1058
-                $this->logDeprecation('Getting property XMLParser::' . $name . ' is deprecated');
1058
+                $this->logDeprecation('Getting property XMLParser::'.$name.' is deprecated');
1059 1059
                 return $this->$name;
1060 1060
             default:
1061 1061
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1062 1062
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1063
-                trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1063
+                trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1064 1064
                 $result = null;
1065 1065
                 return $result;
1066 1066
         }
@@ -1071,18 +1071,18 @@  discard block
 block discarded – undo
1071 1071
         switch ($name) {
1072 1072
             // this should only ever be called by subclasses which overtook `parse()`
1073 1073
             case 'accept':
1074
-                $this->logDeprecation('Setting property XMLParser::' . $name . ' is deprecated');
1074
+                $this->logDeprecation('Setting property XMLParser::'.$name.' is deprecated');
1075 1075
                 $this->current_parsing_options['accept'] = $value;
1076 1076
                 break;
1077 1077
             case '_xh':
1078 1078
             case 'xmlrpc_valid_parents':
1079
-                $this->logDeprecation('Setting property XMLParser::' . $name . ' is deprecated');
1079
+                $this->logDeprecation('Setting property XMLParser::'.$name.' is deprecated');
1080 1080
                 $this->$name = $value;
1081 1081
                 break;
1082 1082
             default:
1083 1083
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1084 1084
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1085
-                trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1085
+                trigger_error('Undefined property via __set(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1086 1086
         }
1087 1087
     }
1088 1088
 
@@ -1090,11 +1090,11 @@  discard block
 block discarded – undo
1090 1090
     {
1091 1091
         switch ($name) {
1092 1092
             case 'accept':
1093
-                $this->logDeprecation('Checking property XMLParser::' . $name . ' is deprecated');
1093
+                $this->logDeprecation('Checking property XMLParser::'.$name.' is deprecated');
1094 1094
                 return isset($this->current_parsing_options['accept']);
1095 1095
             case '_xh':
1096 1096
             case 'xmlrpc_valid_parents':
1097
-                $this->logDeprecation('Checking property XMLParser::' . $name . ' is deprecated');
1097
+                $this->logDeprecation('Checking property XMLParser::'.$name.' is deprecated');
1098 1098
                 return isset($this->$name);
1099 1099
             default:
1100 1100
                 return false;
@@ -1106,18 +1106,18 @@  discard block
 block discarded – undo
1106 1106
         switch ($name) {
1107 1107
             // q: does this make sense at all?
1108 1108
             case 'accept':
1109
-                $this->logDeprecation('Unsetting property XMLParser::' . $name . ' is deprecated');
1109
+                $this->logDeprecation('Unsetting property XMLParser::'.$name.' is deprecated');
1110 1110
                 unset($this->current_parsing_options['accept']);
1111 1111
                 break;
1112 1112
             case '_xh':
1113 1113
             case 'xmlrpc_valid_parents':
1114
-                $this->logDeprecation('Unsetting property XMLParser::' . $name . ' is deprecated');
1114
+                $this->logDeprecation('Unsetting property XMLParser::'.$name.' is deprecated');
1115 1115
                 unset($this->$name);
1116 1116
                 break;
1117 1117
             default:
1118 1118
                 /// @todo throw instead? There are very few other places where the lib trigger errors which can potentially reach stdout...
1119 1119
                 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
1120
-                trigger_error('Undefined property via __unset(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_WARNING);
1120
+                trigger_error('Undefined property via __unset(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'], E_USER_WARNING);
1121 1121
         }
1122 1122
     }
1123 1123
 }
Please login to merge, or discard this patch.