@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * Tests involving xml parsing. |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function testI8() |
| 103 | 103 | { |
| 104 | - if (PHP_INT_SIZE == 4 ) { |
|
| 104 | + if (PHP_INT_SIZE == 4) { |
|
| 105 | 105 | $this->markTestSkipped('Can not test i8 as php is compiled in 32 bit mode'); |
| 106 | 106 | return; |
| 107 | 107 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function testUnicodeInMemberName() |
| 178 | 178 | { |
| 179 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
| 179 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
| 180 | 180 | $v = array($str => new xmlrpcval(1)); |
| 181 | 181 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
| 182 | 182 | $r = $r->serialize(); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $response = @utf8_encode( |
| 193 | 193 | '<?xml version="1.0"?> |
| 194 | 194 | <!-- covers what happens when lib receives UTF8 chars in response text and comments --> |
| 195 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
| 195 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
| 196 | 196 | <methodResponse> |
| 197 | 197 | <fault> |
| 198 | 198 | <value> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </member> |
| 204 | 204 | <member> |
| 205 | 205 | <name>faultString</name> |
| 206 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
| 206 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
| 207 | 207 | </member> |
| 208 | 208 | </struct> |
| 209 | 209 | </value> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $m = $this->newRequest('dummy'); |
| 213 | 213 | $r = $m->parseResponse($response); |
| 214 | 214 | $v = $r->faultString(); |
| 215 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
| 215 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public function testBrokenRequests() |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | $i = \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values; |
| 420 | 420 | \PhpXmlRpc\PhpXmlRpc::$xmlrpc_reject_invalid_values = true; |
| 421 | 421 | |
| 422 | - foreach($values as $value) { |
|
| 423 | - $f = '<?xml version="1.0"?><methodResponse><params><param><value>' . $value . '</value></param></params></methodResponse> '; |
|
| 422 | + foreach ($values as $value) { |
|
| 423 | + $f = '<?xml version="1.0"?><methodResponse><params><param><value>'.$value.'</value></param></params></methodResponse> '; |
|
| 424 | 424 | $r = $s->parseResponse($f); |
| 425 | 425 | $v = $r->faultCode(); |
| 426 | 426 | $this->assertEquals(2, $v, "Testing $value"); |
@@ -524,11 +524,11 @@ discard block |
||
| 524 | 524 | |
| 525 | 525 | public function testUTF8Response() |
| 526 | 526 | { |
| 527 | - $string = chr(224) . chr(252) . chr(232); |
|
| 527 | + $string = chr(224).chr(252).chr(232); |
|
| 528 | 528 | |
| 529 | 529 | $s = $this->newRequest('dummy'); |
| 530 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 530 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 531 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 532 | 532 | '; |
| 533 | 533 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 534 | 534 | $v = $r->value(); |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $this->assertEquals($string, $v); |
| 537 | 537 | |
| 538 | 538 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 539 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 539 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . @utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 540 | 540 | '; |
| 541 | 541 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 542 | 542 | $v = $r->value(); |
@@ -552,11 +552,11 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public function testLatin1Response() |
| 554 | 554 | { |
| 555 | - $string = chr(224) . chr(252) . chr(232); |
|
| 555 | + $string = chr(224).chr(252).chr(232); |
|
| 556 | 556 | |
| 557 | 557 | $s = $this->newRequest('dummy'); |
| 558 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 558 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
| 559 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 560 | 560 | '; |
| 561 | 561 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 562 | 562 | $v = $r->value(); |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | $this->assertEquals($string, $v); |
| 565 | 565 | |
| 566 | 566 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
| 567 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 567 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
| 568 | 568 | '; |
| 569 | 569 | $r = $s->parseResponse($f, false, 'phpvals'); |
| 570 | 570 | $v = $r->value(); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/LoggerAwareTestCase.php'; |
|
| 3 | +include_once __DIR__.'/LoggerAwareTestCase.php'; |
|
| 4 | 4 | |
| 5 | 5 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
| 6 | 6 | use PHPUnit\Framework\TestResult; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _run($result = NULL) |
| 30 | 30 | { |
| 31 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
| 31 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
| 32 | 32 | |
| 33 | 33 | if ($result === NULL) { |
| 34 | 34 | $result = $this->createResult(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | parent::set_up(); |
| 60 | 60 | |
| 61 | 61 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
| 62 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 62 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
| 63 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Getstatename demo</title></head> |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | $stateNo = ""; |
| 18 | 18 | |
| 19 | 19 | if (isset($_POST['stateno']) && $_POST['stateno'] != "") { |
| 20 | - $stateNo = (integer)$_POST['stateno']; |
|
| 20 | + $stateNo = (integer) $_POST['stateno']; |
|
| 21 | 21 | $method = 'examples.getStateName'; |
| 22 | 22 | $arguments = array( |
| 23 | 23 | new Value($stateNo, Value::$xmlrpcInt), |
| 24 | 24 | ); |
| 25 | 25 | $req = new Request($method, $arguments); |
| 26 | - output("Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . |
|
| 26 | + output("Sending the following request:<pre>\n\n".htmlentities($req->serialize()). |
|
| 27 | 27 | "\n\n</pre>Debug info of server data follows...\n\n"); |
| 28 | 28 | $client = new Client(XMLRPCSERVER); |
| 29 | 29 | $client->setOption(Client::OPT_DEBUG, 1); |
@@ -32,12 +32,12 @@ discard block |
||
| 32 | 32 | $val = $resp->value(); |
| 33 | 33 | // NB: we are _assuming_ that the server did return a scalar xml-rpc value here. |
| 34 | 34 | // If the server is not trusted, we might check that via `$val->kindOf() == 'scalar'` |
| 35 | - output('<br/>State number <b>' . $stateNo . '</b> is <b>' |
|
| 36 | - . htmlspecialchars($val->scalarval()) . '</b><br/><br/>'); |
|
| 35 | + output('<br/>State number <b>'.$stateNo.'</b> is <b>' |
|
| 36 | + . htmlspecialchars($val->scalarval()).'</b><br/><br/>'); |
|
| 37 | 37 | } else { |
| 38 | 38 | output('An error occurred: '); |
| 39 | - output('<pre>Code: ' . htmlspecialchars($resp->faultCode()) |
|
| 40 | - . " Reason: '" . htmlspecialchars($resp->faultString()) . "'</pre>"); |
|
| 39 | + output('<pre>Code: '.htmlspecialchars($resp->faultCode()) |
|
| 40 | + . " Reason: '".htmlspecialchars($resp->faultString())."'</pre>"); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Webservice wrapper demo</title></head> |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $client->setOption(\PhpXmlRpc\Client::OPT_RETURN_TYPE, 'phpvals'); // let client give us back php values instead of xmlrpcvals |
| 21 | 21 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
| 22 | 22 | if ($resp->faultCode()) { |
| 23 | - output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"); |
|
| 23 | + output("<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"); |
|
| 24 | 24 | } else { |
| 25 | 25 | output("<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"); |
| 26 | 26 | flush(); |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | if ($methodName == 'examples.getStateName') { |
| 33 | 33 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
| 34 | 34 | if ($callable) { |
| 35 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"); |
|
| 35 | + output("<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"); |
|
| 36 | 36 | } else { |
| 37 | - output("<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"); |
|
| 37 | + output("<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"); |
|
| 38 | 38 | } |
| 39 | 39 | break; |
| 40 | 40 | } |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | if (count($this->xml_iso88591_Entities['in'])) { |
| 77 | 77 | return; |
| 78 | 78 | } |
| 79 | - for ($i = 0; $i < 32; $i++) { |
|
| 79 | + for ($i = 0; $i<32; $i++) { |
|
| 80 | 80 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 81 | 81 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 85 | 85 | |
| 86 | - for ($i = 160; $i < 256; $i++) { |
|
| 86 | + for ($i = 160; $i<256; $i++) { |
|
| 87 | 87 | $this->xml_iso88591_Entities["in"][] = chr($i); |
| 88 | 88 | $this->xml_iso88591_Entities["out"][] = "&#{$i};"; |
| 89 | 89 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | break;*/ |
| 112 | 112 | |
| 113 | 113 | default: |
| 114 | - throw new ValueErrorException('Unsupported table: ' . $tableName); |
|
| 114 | + throw new ValueErrorException('Unsupported table: '.$tableName); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $srcEncoding = 'UTF-8'; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $conversion = strtoupper($srcEncoding . '_' . $destEncoding); |
|
| 166 | + $conversion = strtoupper($srcEncoding.'_'.$destEncoding); |
|
| 167 | 167 | |
| 168 | 168 | // list ordered with (expected) most common scenarios first |
| 169 | 169 | switch ($conversion) { |
@@ -181,20 +181,20 @@ discard block |
||
| 181 | 181 | // NB: this will choke on invalid UTF-8, going most likely beyond EOF |
| 182 | 182 | $escapedData = ''; |
| 183 | 183 | // be kind to users creating string xml-rpc values out of different php types |
| 184 | - $data = (string)$data; |
|
| 184 | + $data = (string) $data; |
|
| 185 | 185 | $ns = strlen($data); |
| 186 | - for ($nn = 0; $nn < $ns; $nn++) { |
|
| 186 | + for ($nn = 0; $nn<$ns; $nn++) { |
|
| 187 | 187 | $ch = $data[$nn]; |
| 188 | 188 | $ii = ord($ch); |
| 189 | 189 | // 7 bits in 1 byte: 0bbbbbbb (127) |
| 190 | - if ($ii < 32) { |
|
| 190 | + if ($ii<32) { |
|
| 191 | 191 | if ($conversion == 'UTF-8_US-ASCII') { |
| 192 | 192 | $escapedData .= sprintf('&#%d;', $ii); |
| 193 | 193 | } else { |
| 194 | 194 | $escapedData .= $ch; |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | - else if ($ii < 128) { |
|
| 197 | + else if ($ii<128) { |
|
| 198 | 198 | /// @todo shall we replace this with a (supposedly) faster str_replace? |
| 199 | 199 | /// @todo to be 'print safe', should we encode as well character 127 (DEL) ? |
| 200 | 200 | switch ($ii) { |
@@ -219,25 +219,25 @@ discard block |
||
| 219 | 219 | } // 11 bits in 2 bytes: 110bbbbb 10bbbbbb (2047) |
| 220 | 220 | elseif ($ii >> 5 == 6) { |
| 221 | 221 | $b1 = ($ii & 31); |
| 222 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 223 | - $ii = ($b1 * 64) + $b2; |
|
| 222 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 223 | + $ii = ($b1 * 64)+$b2; |
|
| 224 | 224 | $escapedData .= sprintf('&#%d;', $ii); |
| 225 | 225 | $nn += 1; |
| 226 | 226 | } // 16 bits in 3 bytes: 1110bbbb 10bbbbbb 10bbbbbb |
| 227 | 227 | elseif ($ii >> 4 == 14) { |
| 228 | 228 | $b1 = ($ii & 15); |
| 229 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 230 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 231 | - $ii = ((($b1 * 64) + $b2) * 64) + $b3; |
|
| 229 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 230 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 231 | + $ii = ((($b1 * 64)+$b2) * 64)+$b3; |
|
| 232 | 232 | $escapedData .= sprintf('&#%d;', $ii); |
| 233 | 233 | $nn += 2; |
| 234 | 234 | } // 21 bits in 4 bytes: 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
| 235 | 235 | elseif ($ii >> 3 == 30) { |
| 236 | 236 | $b1 = ($ii & 7); |
| 237 | - $b2 = (ord($data[$nn + 1]) & 63); |
|
| 238 | - $b3 = (ord($data[$nn + 2]) & 63); |
|
| 239 | - $b4 = (ord($data[$nn + 3]) & 63); |
|
| 240 | - $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4; |
|
| 237 | + $b2 = (ord($data[$nn+1]) & 63); |
|
| 238 | + $b3 = (ord($data[$nn+2]) & 63); |
|
| 239 | + $b4 = (ord($data[$nn+3]) & 63); |
|
| 240 | + $ii = ((((($b1 * 64)+$b2) * 64)+$b3) * 64)+$b4; |
|
| 241 | 241 | $escapedData .= sprintf('&#%d;', $ii); |
| 242 | 242 | $nn += 3; |
| 243 | 243 | } |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // If src is UTF8, we run htmlspecialchars before converting to the target charset, as |
| 291 | 291 | // htmlspecialchars has limited charset support, but it groks utf8 |
| 292 | 292 | if ($srcEncoding === 'UTF-8') { |
| 293 | - $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
| 293 | + $data = htmlspecialchars($data, defined('ENT_XML1') ? ENT_XML1 | ENT_QUOTES : ENT_QUOTES, 'UTF-8'); |
|
| 294 | 294 | } |
| 295 | 295 | if ($srcEncoding !== $destEncoding) { |
| 296 | 296 | try { |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | if ($data === false) { |
| 304 | 304 | $escapedData = ''; |
| 305 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
| 305 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding via mbstring: failed..."); |
|
| 306 | 306 | } else { |
| 307 | 307 | if ($srcEncoding === 'UTF-8') { |
| 308 | 308 | $escapedData = $data; |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | } else { |
| 314 | 314 | $escapedData = ''; |
| 315 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 315 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.": Converting from $srcEncoding to $destEncoding: not supported..."); |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | if (function_exists('mb_list_encodings')) { |
| 331 | 331 | $knownCharsets = array_unique(array_merge($knownCharsets, array_diff(mb_list_encodings(), array( |
| 332 | 332 | 'pass', 'auto', 'wchar', 'BASE64', 'UUENCODE', 'ASCII', 'HTML-ENTITIES', 'Quoted-Printable', |
| 333 | - '7bit','8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
| 333 | + '7bit', '8bit', 'byte2be', 'byte2le', 'byte4be', 'byte4le' |
|
| 334 | 334 | )))); |
| 335 | 335 | } |
| 336 | 336 | return $knownCharsets; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function isValidCharset($encoding, $validList) |
| 349 | 349 | { |
| 350 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 350 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 351 | 351 | |
| 352 | 352 | if (is_string($validList)) { |
| 353 | 353 | $validList = explode(',', $validList); |
@@ -377,14 +377,14 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function getEntities($charset) |
| 379 | 379 | { |
| 380 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 380 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 381 | 381 | |
| 382 | 382 | switch ($charset) |
| 383 | 383 | { |
| 384 | 384 | case 'iso88591': |
| 385 | 385 | return $this->xml_iso88591_Entities; |
| 386 | 386 | default: |
| 387 | - throw new ValueErrorException('Unsupported charset: ' . $charset); |
|
| 387 | + throw new ValueErrorException('Unsupported charset: '.$charset); |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->me['struct'] = $val; |
| 97 | 97 | break; |
| 98 | 98 | default: |
| 99 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a known type ($type)"); |
|
| 99 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a known type ($type)"); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | if ($typeOf !== 1) { |
| 129 | - $this->getLogger()->error("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)"); |
|
| 129 | + $this->getLogger()->error("XML-RPC: ".__METHOD__.": not a scalar type ($type)"); |
|
| 130 | 130 | return 0; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | switch ($this->mytype) { |
| 145 | 145 | case 1: |
| 146 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': scalar xmlrpc value can have only one value'); |
|
| 146 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': scalar xmlrpc value can have only one value'); |
|
| 147 | 147 | return 0; |
| 148 | 148 | case 3: |
| 149 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 149 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpc value'); |
|
| 150 | 150 | return 0; |
| 151 | 151 | case 2: |
| 152 | 152 | // we're adding a scalar value to an array here |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | return 1; |
| 192 | 192 | } else { |
| 193 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 193 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 194 | 194 | return 0; |
| 195 | 195 | } |
| 196 | 196 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | return 1; |
| 223 | 223 | } else { |
| 224 | - $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']'); |
|
| 224 | + $this->getLogger()->error('XML-RPC: '.__METHOD__.': already initialized as a ['.$this->kindOf().']'); |
|
| 225 | 225 | return 0; |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -265,19 +265,19 @@ discard block |
||
| 265 | 265 | case 1: |
| 266 | 266 | switch ($typ) { |
| 267 | 267 | case static::$xmlrpcBase64: |
| 268 | - $rs .= "<{$typ}>" . base64_encode($val) . "</{$typ}>"; |
|
| 268 | + $rs .= "<{$typ}>".base64_encode($val)."</{$typ}>"; |
|
| 269 | 269 | break; |
| 270 | 270 | case static::$xmlrpcBoolean: |
| 271 | - $rs .= "<{$typ}>" . ($val ? '1' : '0') . "</{$typ}>"; |
|
| 271 | + $rs .= "<{$typ}>".($val ? '1' : '0')."</{$typ}>"; |
|
| 272 | 272 | break; |
| 273 | 273 | case static::$xmlrpcString: |
| 274 | 274 | // Do NOT use htmlentities, since it will produce named html entities, which are invalid xml |
| 275 | - $rs .= "<{$typ}>" . $this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</{$typ}>"; |
|
| 275 | + $rs .= "<{$typ}>".$this->getCharsetEncoder()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</{$typ}>"; |
|
| 276 | 276 | break; |
| 277 | 277 | case static::$xmlrpcInt: |
| 278 | 278 | case static::$xmlrpcI4: |
| 279 | 279 | case static::$xmlrpcI8: |
| 280 | - $rs .= "<{$typ}>" . (int)$val . "</{$typ}>"; |
|
| 280 | + $rs .= "<{$typ}>".(int) $val."</{$typ}>"; |
|
| 281 | 281 | break; |
| 282 | 282 | case static::$xmlrpcDouble: |
| 283 | 283 | // avoid using standard conversion of float to string because it is locale-dependent, |
@@ -285,16 +285,16 @@ discard block |
||
| 285 | 285 | // sprintf('%F') could be most likely ok, but it fails e.g. on 2e-14. |
| 286 | 286 | // The code below tries its best at keeping max precision while avoiding exp notation, |
| 287 | 287 | // but there is of course no limit in the number of decimal places to be used... |
| 288 | - $rs .= "<{$typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, PhpXmlRpc::$xmlpc_double_precision, '.', '')) . "</{$typ}>"; |
|
| 288 | + $rs .= "<{$typ}>".preg_replace('/\\.?0+$/', '', number_format((double) $val, PhpXmlRpc::$xmlpc_double_precision, '.', ''))."</{$typ}>"; |
|
| 289 | 289 | break; |
| 290 | 290 | case static::$xmlrpcDateTime: |
| 291 | 291 | if (is_string($val)) { |
| 292 | 292 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
| 293 | 293 | // DateTimeInterface is not present in php 5.4... |
| 294 | 294 | } elseif (is_a($val, 'DateTimeInterface') || is_a($val, 'DateTime')) { |
| 295 | - $rs .= "<{$typ}>" . $val->format('Ymd\TH:i:s') . "</{$typ}>"; |
|
| 295 | + $rs .= "<{$typ}>".$val->format('Ymd\TH:i:s')."</{$typ}>"; |
|
| 296 | 296 | } elseif (is_int($val)) { |
| 297 | - $rs .= "<{$typ}>" . date('Ymd\TH:i:s', $val) . "</{$typ}>"; |
|
| 297 | + $rs .= "<{$typ}>".date('Ymd\TH:i:s', $val)."</{$typ}>"; |
|
| 298 | 298 | } else { |
| 299 | 299 | // not really a good idea here: but what should we output anyway? left for backward compat... |
| 300 | 300 | $rs .= "<{$typ}>{$val}</{$typ}>"; |
@@ -316,14 +316,14 @@ discard block |
||
| 316 | 316 | case 3: |
| 317 | 317 | // struct |
| 318 | 318 | if ($this->_php_class) { |
| 319 | - $rs .= '<struct php_class="' . $this->_php_class . "\">\n"; |
|
| 319 | + $rs .= '<struct php_class="'.$this->_php_class."\">\n"; |
|
| 320 | 320 | } else { |
| 321 | 321 | $rs .= "<struct>\n"; |
| 322 | 322 | } |
| 323 | 323 | $charsetEncoder = $this->getCharsetEncoder(); |
| 324 | 324 | /** @var Value $val2 */ |
| 325 | 325 | foreach ($val as $key2 => $val2) { |
| 326 | - $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n"; |
|
| 326 | + $rs .= '<member><name>'.$charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</name>\n"; |
|
| 327 | 327 | //$rs.=$this->serializeval($val2); |
| 328 | 328 | $rs .= $val2->serialize($charsetEncoding); |
| 329 | 329 | $rs .= "</member>\n"; |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $val = reset($this->me); |
| 359 | 359 | $typ = key($this->me); |
| 360 | 360 | |
| 361 | - return '<value>' . $this->serializeData($typ, $val, $charsetEncoding) . "</value>\n"; |
|
| 361 | + return '<value>'.$this->serializeData($typ, $val, $charsetEncoding)."</value>\n"; |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | /** |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | public function structMemExists($key) |
| 375 | 375 | { |
| 376 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 376 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 377 | 377 | |
| 378 | 378 | return array_key_exists($key, $this->me['struct']); |
| 379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function structMem($key) |
| 391 | 391 | { |
| 392 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 392 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 393 | 393 | |
| 394 | 394 | return $this->me['struct'][$key]; |
| 395 | 395 | } |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | public function structReset() |
| 404 | 404 | { |
| 405 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 405 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 406 | 406 | |
| 407 | 407 | reset($this->me['struct']); |
| 408 | 408 | } |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | public function structEach() |
| 419 | 419 | { |
| 420 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 420 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 421 | 421 | |
| 422 | 422 | return @each($this->me['struct']); |
| 423 | 423 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | */ |
| 463 | 463 | public function arrayMem($key) |
| 464 | 464 | { |
| 465 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 465 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 466 | 466 | |
| 467 | 467 | return $this->me['array'][$key]; |
| 468 | 468 | } |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | public function arraySize() |
| 478 | 478 | { |
| 479 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 479 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 480 | 480 | |
| 481 | 481 | return count($this->me['array']); |
| 482 | 482 | } |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | public function structSize() |
| 492 | 492 | { |
| 493 | - $this->logDeprecation('Method ' . __METHOD__ . ' is deprecated'); |
|
| 493 | + $this->logDeprecation('Method '.__METHOD__.' is deprecated'); |
|
| 494 | 494 | |
| 495 | 495 | return count($this->me['struct']); |
| 496 | 496 | } |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
| 4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
| 3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
| 4 | +include_once __DIR__.'/../lib/xmlrpcs.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\Runner\BaseTestRunner; |
| 11 | 11 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | protected function tear_down() |
| 34 | 34 | { |
| 35 | - if ($this->args['DEBUG'] > 0) { |
|
| 35 | + if ($this->args['DEBUG']>0) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function debug($message, $context = array()) |
| 52 | 52 | { |
| 53 | - $this->buffer .= $message . "\n"; |
|
| 53 | + $this->buffer .= $message."\n"; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function error($message, $context = array()) |
| 57 | 57 | { |
| 58 | - $this->buffer .= $message . "\n"; |
|
| 58 | + $this->buffer .= $message."\n"; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function warning($message, $context = array()) |
| 62 | 62 | { |
| 63 | - $this->buffer .= $message . "\n"; |
|
| 63 | + $this->buffer .= $message."\n"; |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 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 |
@@ -21,17 +21,17 @@ discard block |
||
| 21 | 21 | // logger API |
| 22 | 22 | public function debug($message, $context = array()) |
| 23 | 23 | { |
| 24 | - $this->debugBuffer .= $message . "\n"; |
|
| 24 | + $this->debugBuffer .= $message."\n"; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function error($message, $context = array()) |
| 28 | 28 | { |
| 29 | - $this->errorBuffer .= $message . "\n"; |
|
| 29 | + $this->errorBuffer .= $message."\n"; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function warning($message, $context = array()) |
| 33 | 33 | { |
| 34 | - $this->warningBuffer .= $message . "\n"; |
|
| 34 | + $this->warningBuffer .= $message."\n"; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function getDebug() |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $input = array( |
| 64 | 64 | array('name' => 'Dave', 'age' => 24), |
| 65 | - array('name' => 'Edd', 'age' => 45), |
|
| 66 | - array('name' => 'Joe', 'age' => 37), |
|
| 65 | + array('name' => 'Edd', 'age' => 45), |
|
| 66 | + array('name' => 'Joe', 'age' => 37), |
|
| 67 | 67 | array('name' => 'Fred', 'age' => 27), |
| 68 | 68 | ); |
| 69 | 69 | |
@@ -85,6 +85,6 @@ discard block |
||
| 85 | 85 | $response = $client->send($request); |
| 86 | 86 | output("Response received.<br>"); |
| 87 | 87 | |
| 88 | -output("The client error info is:<pre>\n" . $logger->getError() . "\n</pre>"); |
|
| 89 | -output("The client warning info is:<pre>\n" . $logger->getWarning() . "\n</pre>"); |
|
| 90 | -output("The client debug info is:<pre>\n" . $logger->getDebug() . "\n</pre>"); |
|
| 88 | +output("The client error info is:<pre>\n".$logger->getError()."\n</pre>"); |
|
| 89 | +output("The client warning info is:<pre>\n".$logger->getWarning()."\n</pre>"); |
|
| 90 | +output("The client debug info is:<pre>\n".$logger->getDebug()."\n</pre>"); |
|
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | if ($response->faultCode()) { |
| 29 | 29 | throw new HttpException(502, $response->faultString()); |
| 30 | 30 | } else { |
| 31 | - return new Response("<html><body>State number $stateNo is: " . $response->value()->scalarVal() . '</body></html>'); |
|
| 31 | + return new Response("<html><body>State number $stateNo is: ".$response->value()->scalarVal().'</body></html>'); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | } |