Passed
Push — master ( 8ff19d...02b7f4 )
by Gaetano
05:49
created
tests/12ExtraFilesTest.php 1 patch
Spacing   +3 added lines, -3 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__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'extras' directory.
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
         $this->args = argParser::getArgs();
13 13
 
14 14
         // assumes HTTPURI to be in the form /tests/index.php?etc...
15
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
15
+        $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
17 17
     }
18 18
 
19 19
     public function testBenchmark()
Please login to merge, or discard this patch.
tests/07ClientTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4 4
 
5
-include_once __DIR__ . '/parse_args.php';
5
+include_once __DIR__.'/parse_args.php';
6 6
 
7
-include_once __DIR__ . '/PolyfillTestCase.php';
7
+include_once __DIR__.'/PolyfillTestCase.php';
8 8
 
9 9
 use PHPUnit\Runner\BaseTestRunner;
10 10
 
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
         $this->client->setDebug($this->args['DEBUG']);
27 27
 
28 28
         // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors
29
-        if ($this->args['DEBUG'] >= 1)
29
+        if ($this->args['DEBUG']>=1)
30 30
             ob_start();
31 31
     }
32 32
 
33 33
     protected function tear_down()
34 34
     {
35
-        if ($this->args['DEBUG'] < 1)
35
+        if ($this->args['DEBUG']<1)
36 36
             return;
37 37
         $out = ob_get_clean();
38 38
         $status = $this->getStatus();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $this->client->server .= 'XXX';
60 60
         $dnsinfo = @dns_get_record($this->client->server);
61 61
         if ($dnsinfo) {
62
-            $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found');
62
+            $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found');
63 63
         } else {
64 64
             $r = $this->client->send($m, 5);
65 65
             // make sure there's no freaking catchall DNS in effect
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
         // now test a successful connection
88 88
         $server = explode(':', $this->args['HTTPSERVER']);
89
-        if (count($server) > 1) {
89
+        if (count($server)>1) {
90 90
             $this->client->port = $server[1];
91 91
         }
92 92
         $this->client->server = $server[0];
Please login to merge, or discard this patch.
tests/08ServerTest.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
11 11
 use PHPUnit\Framework\TestResult;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         // (but only if not called from subclass objects / multitests)
43 43
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
44 44
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
45
-            for ($i = 0; $i < count($trace); $i++) {
45
+            for ($i = 0; $i<count($trace); $i++) {
46 46
                 if (strpos($trace[$i]['function'], 'test') === 0) {
47 47
                     self::$failed_tests[$trace[$i]['function']] = true;
48 48
                     break;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function _run($result = NULL)
67 67
     {
68
-        $this->testId = get_class($this) . '__' . $this->getName();
68
+        $this->testId = get_class($this).'__'.$this->getName();
69 69
 
70 70
         if ($result === NULL) {
71 71
             $result = $this->createResult();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->args = argParser::getArgs();
97 97
 
98 98
         $server = explode(':', $this->args['HTTPSERVER']);
99
-        if (count($server) > 1) {
99
+        if (count($server)>1) {
100 100
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]);
101 101
         } else {
102 102
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']);
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
         $this->client->request_compression = $this->request_compression;
107 107
         $this->client->accepted_compression = $this->accepted_compression;
108 108
 
109
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
109
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
110 110
 
111 111
         // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors
112
-        if ($this->args['DEBUG'] >= 1)
112
+        if ($this->args['DEBUG']>=1)
113 113
             ob_start();
114 114
     }
115 115
 
116 116
     protected function tear_down()
117 117
     {
118
-        if ($this->args['DEBUG'] < 1)
118
+        if ($this->args['DEBUG']<1)
119 119
             return;
120 120
         $out = ob_get_clean();
121 121
         $status = $this->getStatus();
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
         }
145 145
         $this->validateResponse($r);
146 146
         if (is_array($errorCode)) {
147
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
147
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
148 148
         } else {
149
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
149
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
150 150
         }
151 151
         if (!$r->faultCode()) {
152 152
             if ($returnResponse) {
@@ -173,20 +173,20 @@  discard block
 block discarded – undo
173 173
         $query = parse_url($this->client->path, PHP_URL_QUERY);
174 174
         parse_str($query, $vars);
175 175
         $query = http_build_query(array_merge($vars, $data));
176
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
176
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
177 177
     }
178 178
 
179 179
     public function testString()
180 180
     {
181
-        $sendString = "here are 3 \"entities\": < > & " .
182
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
183
-            " - isn't that great? \\\"hackery\\\" at it's best " .
184
-            " also don't want to miss out on \$item[0]. " .
185
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
186
-            "a simple CR here" . chr(13) .
187
-            "a simple LF here" . chr(10) .
188
-            "and then LFCR" . chr(10) . chr(13) .
189
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
181
+        $sendString = "here are 3 \"entities\": < > & ".
182
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
183
+            " - isn't that great? \\\"hackery\\\" at it's best ".
184
+            " also don't want to miss out on \$item[0]. ".
185
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
186
+            "a simple CR here".chr(13).
187
+            "a simple LF here".chr(10).
188
+            "and then LFCR".chr(10).chr(13).
189
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
190 190
         $m = new xmlrpcmsg('examples.stringecho', array(
191 191
             new xmlrpcval($sendString, 'string'),
192 192
         ));
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     public function testLatin1String()
208 208
     {
209 209
         $sendString =
210
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
210
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
211 211
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
212 212
             $sendString.
213 213
             '</value></param></params></methodCall>';
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
     public function testUtf8Method()
317 317
     {
318 318
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
319
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
319
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
320 320
             new xmlrpcval('hello')
321 321
         ));
322 322
         $v = $this->send($m);
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
         ));
339 339
         $v = $this->send($m);
340 340
         if ($v) {
341
-            $this->assertEquals($a + $b, $v->scalarval());
341
+            $this->assertEquals($a+$b, $v->scalarval());
342 342
         }
343 343
     }
344 344
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
         ));
351 351
         $v = $this->send($m);
352 352
         if ($v) {
353
-            $this->assertEquals(12 - 23, $v->scalarval());
353
+            $this->assertEquals(12-23, $v->scalarval());
354 354
         }
355 355
     }
356 356
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         if ($v) {
390 390
             $sz = $v->arraysize();
391 391
             $got = '';
392
-            for ($i = 0; $i < $sz; $i++) {
392
+            for ($i = 0; $i<$sz; $i++) {
393 393
                 $b = $v->arraymem($i);
394 394
                 if ($b->scalarval()) {
395 395
                     $got .= '1';
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             $got = '';
453 453
             $expected = '37210';
454 454
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
455
-            foreach($expect_array as $val) {
455
+            foreach ($expect_array as $val) {
456 456
                 $b = $v->structmem($val);
457 457
                 $got .= $b->me['int'];
458 458
             }
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
     {
948 948
         // make a 'deep client copy' as the original one might have many properties set
949 949
         // also for speed only wrap one method of the whole server
950
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
950
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
951 951
         if ($class == '') {
952 952
             $this->fail('Registration of remote server failed');
953 953
         } else {
@@ -986,9 +986,9 @@  discard block
 block discarded – undo
986 986
         $cookies = array(
987 987
             //'c1' => array(),
988 988
             'c2' => array('value' => 'c2'),
989
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
990
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
991
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
989
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
990
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
991
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
992 992
         );
993 993
         $cookiesval = php_xmlrpc_encode($cookies);
994 994
         $m = new xmlrpcmsg('tests.setcookies', array($cookiesval));
@@ -1036,10 +1036,10 @@  discard block
 block discarded – undo
1036 1036
         $m = new xmlrpcmsg('tests.getcookies', array());
1037 1037
         foreach ($cookies as $cookie => $val) {
1038 1038
             $this->client->setCookie($cookie, $val);
1039
-            $cookies[$cookie] = (string)$cookies[$cookie];
1039
+            $cookies[$cookie] = (string) $cookies[$cookie];
1040 1040
         }
1041 1041
         $r = $this->client->send($m, $this->timeout, $this->method);
1042
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
1042
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
1043 1043
         if (!$r->faultCode()) {
1044 1044
             $v = $r->value();
1045 1045
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.
demo/server/server.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     }
25 25
 }
26 26
 
27
-require_once __DIR__ . "/_prepend.php";
27
+require_once __DIR__."/_prepend.php";
28 28
 
29 29
 use PhpXmlRpc\PhpXmlRpc;
30 30
 use PhpXmlRpc\Server;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         } elseif ($_GET['FORCE_AUTH'] == 'Digest') {
84 84
             if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
85 85
                 header('HTTP/1.1 401 Unauthorized');
86
-                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"');
86
+                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"');
87 87
                 die('Text visible if user hits Cancel button');
88 88
             }
89 89
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     if (isset($_GET['FORCE_REDIRECT'])) {
92 92
         header('HTTP/1.0 302 Found');
93 93
         unset($_GET['FORCE_REDIRECT']);
94
-        header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : ''));
94
+        header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : ''));
95 95
         die();
96 96
     }
97 97
 }
Please login to merge, or discard this patch.
demo/client/_prepend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 }
9 9
 
10 10
 // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer
11
-include_once __DIR__ . '/../../src/Autoloader.php';
11
+include_once __DIR__.'/../../src/Autoloader.php';
12 12
 PhpXmlRpc\Autoloader::register();
13 13
 
14 14
 // Let unit tests run against localhost, 'plain' demos against a known public server
@@ -22,5 +22,5 @@  discard block
 block discarded – undo
22 22
 function output($text)
23 23
 {
24 24
     /// @todo we should only strip html tags, and let through all xml tags
25
-    echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>','<br>'), "\n", $text)) : $text;
25
+    echo PHP_SAPI == 'cli' ? strip_tags(str_replace(array('<br/>', '<br>'), "\n", $text)) : $text;
26 26
 }
Please login to merge, or discard this patch.
demo/client/loggerinjection.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 /**
5 5
  * Demoing how to inject a custom logger for use by the library
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
     // logger API
23 23
     public function debug($message, $context = array())
24 24
     {
25
-        $this->debugBuffer .= $message . "\n";
25
+        $this->debugBuffer .= $message."\n";
26 26
     }
27 27
 
28 28
     // logger API
29 29
     public function error($message, $context = array())
30 30
     {
31
-        $this->errorBuffer .= $message . "\n";
31
+        $this->errorBuffer .= $message."\n";
32 32
     }
33 33
 
34 34
     public function getDebug()
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
 
60 60
 $input = array(
61 61
     array('name' => 'Dave', 'age' => 24),
62
-    array('name' => 'Edd',  'age' => 45),
63
-    array('name' => 'Joe',  'age' => 37),
62
+    array('name' => 'Edd', 'age' => 45),
63
+    array('name' => 'Joe', 'age' => 37),
64 64
     array('name' => 'Fred', 'age' => 27),
65 65
 );
66 66
 
@@ -79,5 +79,5 @@  discard block
 block discarded – undo
79 79
 $response = $client->send($request);
80 80
 output("Response received.<br>");
81 81
 
82
-output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>");
83
-output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>");
82
+output("The client error info is:<pre>\n".$logger->getError()."\n</pre>");
83
+output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>");
Please login to merge, or discard this patch.
src/Encoder.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
                                 'scalar' => $val,
58 58
                                 'timestamp' => \PhpXmlRpc\Helper\Date::iso8601Decode($val)
59 59
                             );
60
-                            return (object)$xmlrpcVal;
60
+                            return (object) $xmlrpcVal;
61 61
                         case 'base64':
62 62
                             $xmlrpcVal = array(
63 63
                                 'xmlrpc_type' => 'base64',
64 64
                                 'scalar' => $val
65 65
                             );
66
-                            return (object)$xmlrpcVal;
66
+                            return (object) $xmlrpcVal;
67 67
                         case 'string':
68 68
                             if (isset($options['extension_api_encoding'])) {
69 69
                                 // if iconv is not available, we use mb_convert_encoding
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             case 'msg':
137 137
                 $paramCount = $xmlrpcVal->getNumParams();
138 138
                 $arr = array();
139
-                for ($i = 0; $i < $paramCount; $i++) {
139
+                for ($i = 0; $i<$paramCount; $i++) {
140 140
                     $arr[] = $this->decode($xmlrpcVal->getParam($i), $options);
141 141
                 }
142 142
                 return $arr;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                 break;
262 262
             case 'resource':
263 263
                 if (in_array('extension_api', $options)) {
264
-                    $xmlrpcVal = new Value((int)$phpVal, Value::$xmlrpcInt);
264
+                    $xmlrpcVal = new Value((int) $phpVal, Value::$xmlrpcInt);
265 265
                 } else {
266 266
                     $xmlrpcVal = new Value();
267 267
                 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     if ($valEncoding == 'ISO-8859-1') {
311 311
                         $xmlVal = utf8_encode($xmlVal);
312 312
                     } else {
313
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of xml text: ' . $valEncoding);
313
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': invalid charset encoding of xml text: '.$valEncoding);
314 314
                     }
315 315
                 }
316 316
             }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             $parserOptions
333 333
         );
334 334
 
335
-        if ($xmlRpcParser->_xh['isf'] > 1) {
335
+        if ($xmlRpcParser->_xh['isf']>1) {
336 336
             // test that $xmlrpc->_xh['value'] is an obj, too???
337 337
 
338 338
             $this->getLogger()->error($xmlRpcParser->_xh['isf_reason']);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
             case 'methodcall':
358 358
                 $req = new Request($xmlRpcParser->_xh['method']);
359
-                for ($i = 0; $i < count($xmlRpcParser->_xh['params']); $i++) {
359
+                for ($i = 0; $i<count($xmlRpcParser->_xh['params']); $i++) {
360 360
                     $req->addParam($xmlRpcParser->_xh['params'][$i]);
361 361
                 }
362 362
                 return $req;
Please login to merge, or discard this patch.
src/Helper/Http.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
         // read chunk-size, chunk-extension (if any) and crlf
28 28
         // get the position of the linebreak
29
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
29
+        $chunkEnd = strpos($buffer, "\r\n")+2;
30 30
         $temp = substr($buffer, 0, $chunkEnd);
31 31
         $chunkSize = hexdec(trim($temp));
32 32
         $chunkStart = $chunkEnd;
33
-        while ($chunkSize > 0) {
34
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
33
+        while ($chunkSize>0) {
34
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
35 35
 
36 36
             // just in case we got a broken connection
37 37
             if ($chunkEnd == false) {
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
             }
44 44
 
45 45
             // read chunk-data and crlf
46
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
46
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
47 47
             // append chunk-data to entity-body
48 48
             $new .= $chunk;
49 49
             // length := length + chunk-size
50 50
             $length += strlen($chunk);
51 51
             // read chunk-size and crlf
52
-            $chunkStart = $chunkEnd + 2;
52
+            $chunkStart = $chunkEnd+2;
53 53
 
54
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
54
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
55 55
             if ($chunkEnd == false) {
56 56
                 break; // just in case we got a broken connection
57 57
             }
58
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
58
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
59 59
             $chunkSize = hexdec(trim($temp));
60 60
             $chunkStart = $chunkEnd;
61 61
         }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             // Look for CR/LF or simple LF as line separator (even though it is not valid http)
85 85
             $pos = strpos($data, "\r\n\r\n");
86 86
             if ($pos || is_int($pos)) {
87
-                $bd = $pos + 4;
87
+                $bd = $pos+4;
88 88
             } else {
89 89
                 $pos = strpos($data, "\n\n");
90 90
                 if ($pos || is_int($pos)) {
91
-                    $bd = $pos + 2;
91
+                    $bd = $pos+2;
92 92
                 } else {
93 93
                     // No separation between response headers and body: fault?
94 94
                     $bd = 0;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 // this filters out all http headers from proxy. maybe we could take them into account, too?
99 99
                 $data = substr($data, $bd);
100 100
             } else {
101
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
102
-                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
101
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
102
+                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
103 103
             }
104 104
         }
105 105
 
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         if ($httpResponse['status_code'] !== '200') {
135
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
136
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
137
-            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
135
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
136
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
137
+            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
138 138
         }
139 139
 
140 140
         // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http)
141 141
         $pos = strpos($data, "\r\n\r\n");
142 142
         if ($pos || is_int($pos)) {
143
-            $bd = $pos + 4;
143
+            $bd = $pos+4;
144 144
         } else {
145 145
             $pos = strpos($data, "\n\n");
146 146
             if ($pos || is_int($pos)) {
147
-                $bd = $pos + 2;
147
+                $bd = $pos+2;
148 148
             } else {
149 149
                 // No separation between response headers and body: fault?
150 150
                 // we could take some action here instead of going on...
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         foreach ($ar as $line) {
159 159
             // take care of multi-line headers and cookies
160 160
             $arr = explode(':', $line, 2);
161
-            if (count($arr) > 1) {
161
+            if (count($arr)>1) {
162 162
                 $headerName = strtolower(trim($arr[0]));
163 163
                 /// @todo some other headers (the ones that allow a CSV list of values) do allow many values to be
164 164
                 ///       passed using multiple header lines.
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                     foreach ($cookies as $cookie) {
176 176
                         // glue together all received cookies, using a comma to separate them (same as php does with getallheaders())
177 177
                         if (isset($httpResponse['headers'][$headerName])) {
178
-                            $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
178
+                            $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
179 179
                         } else {
180 180
                             $httpResponse['headers'][$headerName] = trim($cookie);
181 181
                         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 }
205 205
             } elseif (isset($headerName)) {
206 206
                 /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
207
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
207
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
208 208
             }
209 209
         }
210 210
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             // Decode chunked encoding sent by http 1.1 servers
228 228
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
229 229
                 if (!$data = static::decodeChunked($data)) {
230
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
230
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
231 231
                     throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']);
232 232
                 }
233 233
             }
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
243 243
                             $data = $degzdata;
244 244
                             if ($debug) {
245
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
245
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
246 246
                             }
247 247
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
248 248
                             $data = $degzdata;
249 249
                             if ($debug) {
250
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
250
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
251 251
                             }
252 252
                         } else {
253
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
253
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
254 254
                             throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']);
255 255
                         }
256 256
                     } else {
257
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
257
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
258 258
                         throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']);
259 259
                     }
260 260
                 }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     public function parseAcceptHeader($header)
275 275
     {
276 276
         $accepted = array();
277
-        foreach(explode(',', $header) as $c) {
277
+        foreach (explode(',', $header) as $c) {
278 278
             if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) {
279 279
                 $c = $matches[1];
280 280
                 $w = $matches[2];
Please login to merge, or discard this patch.
src/Value.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                     $this->me['struct'] = $val;
94 94
                     break;
95 95
                 default:
96
-                    $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
96
+                    $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)");
97 97
             }
98 98
         }
99 99
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
 
119 119
         if ($typeOf !== 1) {
120
-            $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
120
+            $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
121 121
             return 0;
122 122
         }
123 123
 
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 
135 135
         switch ($this->mytype) {
136 136
             case 1:
137
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value');
137
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value');
138 138
                 return 0;
139 139
             case 3:
140
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value');
140
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value');
141 141
                 return 0;
142 142
             case 2:
143 143
                 // we're adding a scalar value to an array here
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
             return 1;
181 181
         } else {
182
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
182
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
183 183
             return 0;
184 184
         }
185 185
     }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
             return 1;
211 211
         } else {
212
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
212
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']');
213 213
             return 0;
214 214
         }
215 215
     }
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
             case 1:
252 252
                 switch ($typ) {
253 253
                     case static::$xmlrpcBase64:
254
-                        $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>";
254
+                        $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>";
255 255
                         break;
256 256
                     case static::$xmlrpcBoolean:
257
-                        $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>";
257
+                        $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>";
258 258
                         break;
259 259
                     case static::$xmlrpcString:
260 260
                         // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml
261
-                        $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>";
261
+                        $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>";
262 262
                         break;
263 263
                     case static::$xmlrpcInt:
264 264
                     case static::$xmlrpcI4:
265 265
                     case static::$xmlrpcI8:
266
-                        $rs .= "<{$typ}>" . (int)$val . "</{$typ}>";
266
+                        $rs .= "<{$typ}>".(int) $val."</{$typ}>";
267 267
                         break;
268 268
                     case static::$xmlrpcDouble:
269 269
                         // avoid using standard conversion of float to string because it is locale-dependent,
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
                         // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14.
272 272
                         // The code below tries its best at keeping max precision while avoiding exp notation,
273 273
                         // but there is of course no limit in the number of decimal places to be used...
274
-                        $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>";
274
+                        $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>";
275 275
                         break;
276 276
                     case static::$xmlrpcDateTime:
277 277
                         if (is_string($val)) {
278 278
                             $rs .= "<{$typ}>{$val}</{$typ}>";
279 279
                         // DateTimeInterface is not present in php 5.4...
280 280
                         } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) {
281
-                            $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>";
281
+                            $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>";
282 282
                         } elseif (is_int($val)) {
283
-                            $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>";
283
+                            $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>";
284 284
                         } else {
285 285
                             // not really a good idea here: but what should we output anyway? left for backward compat...
286 286
                             $rs .= "<{$typ}>{$val}</{$typ}>";
@@ -302,14 +302,14 @@  discard block
 block discarded – undo
302 302
             case 3:
303 303
                 // struct
304 304
                 if ($this->_php_class) {
305
-                    $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
305
+                    $rs .= '<struct php_class="'.$this->_php_class."\">\n";
306 306
                 } else {
307 307
                     $rs .= "<struct>\n";
308 308
                 }
309 309
                 $charsetEncoder = $this->getCharsetEncoder();
310 310
                 /** @var Value $val2 */
311 311
                 foreach ($val as $key2 => $val2) {
312
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
312
+                    $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n";
313 313
                     //$rs.=$this->serializeval($val2);
314 314
                     $rs .= $val2->serialize($charsetEncoding);
315 315
                     $rs .= "</member>\n";
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $val = reset($this->me);
345 345
         $typ = key($this->me);
346 346
 
347
-        return '<value>' . $this->serializedata($typ, $val, $charsetEncoding) . "</value>\n";
347
+        return '<value>'.$this->serializedata($typ, $val, $charsetEncoding)."</value>\n";
348 348
     }
349 349
 
350 350
     /**
Please login to merge, or discard this patch.