@@ -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 | } |
@@ -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 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $val = reset($ar); |
| 130 | 130 | $typ = key($ar); |
| 131 | 131 | |
| 132 | - return '<value>' . $this->serializeData($typ, $val) . "</value>\n"; |
|
| 132 | + return '<value>'.$this->serializeData($typ, $val)."</value>\n"; |
|
| 133 | 133 | //} |
| 134 | 134 | } |
| 135 | 135 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | // preserve back compatibility |
| 149 | 149 | |
| 150 | 150 | if (is_array($b)) { |
| 151 | - foreach($b as $id => $cont) { |
|
| 151 | + foreach ($b as $id => $cont) { |
|
| 152 | 152 | $b[$id] = $cont->scalarVal(); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | // add support for structures directly encoding php objects |
| 157 | 157 | if (is_object($b)) { |
| 158 | 158 | $t = get_object_vars($b); |
| 159 | - foreach($t as $id => $cont) { |
|
| 159 | + foreach ($t as $id => $cont) { |
|
| 160 | 160 | $t[$id] = $cont->scalarVal(); |
| 161 | 161 | } |
| 162 | - foreach($t as $id => $cont) { |
|
| 162 | + foreach ($t as $id => $cont) { |
|
| 163 | 163 | @$b->$id = $cont; |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -201,17 +201,17 @@ discard block |
||
| 201 | 201 | /* Expose as global functions the ones which are now class methods */ |
| 202 | 202 | |
| 203 | 203 | /// Wrong speling, but we are adamant on backwards compatibility! |
| 204 | -function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='') |
|
| 204 | +function xmlrpc_encode_entitites($data, $srcEncoding = '', $destEncoding = '') |
|
| 205 | 205 | { |
| 206 | 206 | return Charset::instance()->encodeEntities($data, $srcEncoding, $destEncoding); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | -function iso8601_encode($timeT, $utc=0) |
|
| 209 | +function iso8601_encode($timeT, $utc = 0) |
|
| 210 | 210 | { |
| 211 | 211 | return Date::iso8601Encode($timeT, $utc); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | -function iso8601_decode($iDate, $utc=0) |
|
| 214 | +function iso8601_decode($iDate, $utc = 0) |
|
| 215 | 215 | { |
| 216 | 216 | return Date::iso8601Decode($iDate, $utc); |
| 217 | 217 | } |
@@ -221,25 +221,25 @@ discard block |
||
| 221 | 221 | return Http::decodeChunked($buffer); |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | -function php_xmlrpc_decode($xmlrpcVal, $options=array()) |
|
| 224 | +function php_xmlrpc_decode($xmlrpcVal, $options = array()) |
|
| 225 | 225 | { |
| 226 | 226 | $encoder = new Encoder(); |
| 227 | 227 | return $encoder->decode($xmlrpcVal, $options); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | -function php_xmlrpc_encode($phpVal, $options=array()) |
|
| 230 | +function php_xmlrpc_encode($phpVal, $options = array()) |
|
| 231 | 231 | { |
| 232 | 232 | $encoder = new Encoder(); |
| 233 | 233 | return $encoder->encode($phpVal, $options); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | -function php_xmlrpc_decode_xml($xmlVal, $options=array()) |
|
| 236 | +function php_xmlrpc_decode_xml($xmlVal, $options = array()) |
|
| 237 | 237 | { |
| 238 | 238 | $encoder = new Encoder(); |
| 239 | 239 | return $encoder->decodeXml($xmlVal, $options); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | -function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null) |
|
| 242 | +function guess_encoding($httpHeader = '', $xmlChunk = '', $encodingPrefs = null) |
|
| 243 | 243 | { |
| 244 | 244 | return XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs); |
| 245 | 245 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param array $extraOptions |
| 42 | 42 | * @return array|false |
| 43 | 43 | */ |
| 44 | -function wrap_php_function($funcName, $newFuncName='', $extraOptions=array()) |
|
| 44 | +function wrap_php_function($funcName, $newFuncName = '', $extraOptions = array()) |
|
| 45 | 45 | { |
| 46 | 46 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 47 | 47 | if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @param array $extraOptions |
| 65 | 65 | * @return array|false |
| 66 | 66 | */ |
| 67 | -function wrap_php_class($className, $extraOptions=array()) |
|
| 67 | +function wrap_php_class($className, $extraOptions = array()) |
|
| 68 | 68 | { |
| 69 | 69 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 70 | 70 | $fix = false; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $fix = true; |
| 75 | 75 | } |
| 76 | 76 | $wrapped = $wrapper->wrapPhpClass($className, $extraOptions); |
| 77 | - foreach($wrapped as $name => $value) { |
|
| 77 | + foreach ($wrapped as $name => $value) { |
|
| 78 | 78 | if ($fix) { |
| 79 | 79 | eval($value['source']); |
| 80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $newFuncName deprecated, use an option in $extraOptions |
| 94 | 94 | * @return array|callable|false |
| 95 | 95 | */ |
| 96 | -function wrap_xmlrpc_method($client, $methodName, $extraOptions=0, $timeout=0, $protocol='', $newFuncName='') |
|
| 96 | +function wrap_xmlrpc_method($client, $methodName, $extraOptions = 0, $timeout = 0, $protocol = '', $newFuncName = '') |
|
| 97 | 97 | { |
| 98 | 98 | if (!is_array($extraOptions)) |
| 99 | 99 | { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @param array $extraOptions |
| 129 | 129 | * @return mixed |
| 130 | 130 | */ |
| 131 | -function wrap_xmlrpc_server($client, $extraOptions=array()) |
|
| 131 | +function wrap_xmlrpc_server($client, $extraOptions = array()) |
|
| 132 | 132 | { |
| 133 | 133 | $wrapper = new PhpXmlRpc\Wrapper(); |
| 134 | 134 | return $wrapper->wrapXmlrpcServer($client, $extraOptions); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
| 149 | 149 | { |
| 150 | 150 | $code = "function $xmlrpcFuncName ("; |
| 151 | - if ($clientCopyMode < 2) { |
|
| 151 | + if ($clientCopyMode<2) { |
|
| 152 | 152 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
| 153 | 153 | $innerCode = build_client_wrapper_code($client, $clientCopyMode, $prefix); |
| 154 | 154 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | if ($mDesc != '') { |
| 164 | 164 | // take care that PHP comment is not terminated unwillingly by method description |
| 165 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
| 165 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
| 166 | 166 | } else { |
| 167 | 167 | $mDesc = "/**\nFunction $xmlrpcFuncName\n"; |
| 168 | 168 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
| 172 | 172 | $plist = array(); |
| 173 | 173 | $pCount = count($mSig); |
| 174 | - for ($i = 1; $i < $pCount; $i++) { |
|
| 174 | + for ($i = 1; $i<$pCount; $i++) { |
|
| 175 | 175 | $plist[] = "\$p$i"; |
| 176 | 176 | $pType = $mSig[$i]; |
| 177 | 177 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -187,19 +187,19 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
| 190 | - $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; |
|
| 190 | + $mDesc .= '* @param '.xmlrpc_2_php_type($pType)." \$p$i\n"; |
|
| 191 | 191 | } |
| 192 | - if ($clientCopyMode < 2) { |
|
| 192 | + if ($clientCopyMode<2) { |
|
| 193 | 193 | $plist[] = '$debug=0'; |
| 194 | 194 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
| 195 | 195 | } |
| 196 | 196 | $plist = implode(', ', $plist); |
| 197 | - $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 197 | + $mDesc .= '* @return '.xmlrpc_2_php_type($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
| 198 | 198 | |
| 199 | 199 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
| 200 | 200 | if ($decodeFault) { |
| 201 | 201 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
| 202 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
| 202 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
| 203 | 203 | } else { |
| 204 | 204 | $respCode = var_export($faultResponse, true); |
| 205 | 205 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $innerCode .= "if (\$res->faultCode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
| 215 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
| 216 | 216 | |
| 217 | 217 | return array('source' => $code, 'docstring' => $mDesc); |
| 218 | 218 | } |
@@ -220,10 +220,10 @@ discard block |
||
| 220 | 220 | /** |
| 221 | 221 | * @deprecated |
| 222 | 222 | */ |
| 223 | -function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
| 223 | +function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
| 224 | 224 | { |
| 225 | 225 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
| 226 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
| 226 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
| 227 | 227 | |
| 228 | 228 | // copy all client fields to the client that will be generated runtime |
| 229 | 229 | // (this provides for future expansion or subclassing of client obj) |
@@ -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 | use PhpXmlRpc\Encoder; |
| 5 | 5 | use PhpXmlRpc\Client; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $handles = array(); |
| 34 | 34 | $curl = curl_multi_init(); |
| 35 | 35 | |
| 36 | - foreach($requests as $k => $req) { |
|
| 36 | + foreach ($requests as $k => $req) { |
|
| 37 | 37 | $req->setDebug($this->debug); |
| 38 | 38 | $handle = $this->createCurlHandle($req, $method, $this->server, $this->port, $this->path, $opts); |
| 39 | 39 | curl_multi_add_handle($curl, $handle); |
@@ -43,20 +43,20 @@ discard block |
||
| 43 | 43 | $running = 0; |
| 44 | 44 | do { |
| 45 | 45 | curl_multi_exec($curl, $running); |
| 46 | - } while($running > 0); |
|
| 46 | + } while ($running>0); |
|
| 47 | 47 | |
| 48 | 48 | $responses = array(); |
| 49 | 49 | $errors = array(); |
| 50 | - foreach($handles as $k => $h) { |
|
| 50 | + foreach ($handles as $k => $h) { |
|
| 51 | 51 | $responses[$k] = curl_multi_getcontent($handles[$k]); |
| 52 | 52 | |
| 53 | - if ($this->debug > 1) { |
|
| 53 | + if ($this->debug>1) { |
|
| 54 | 54 | $message = "---CURL INFO---\n"; |
| 55 | 55 | foreach (curl_getinfo($h) as $name => $val) { |
| 56 | 56 | if (is_array($val)) { |
| 57 | 57 | $val = implode("\n", $val); |
| 58 | 58 | } |
| 59 | - $message .= $name . ': ' . $val . "\n"; |
|
| 59 | + $message .= $name.': '.$val."\n"; |
|
| 60 | 60 | } |
| 61 | 61 | $message .= '---END---'; |
| 62 | 62 | $this->getLogger()->debugMessage($message); |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | curl_multi_close($curl); |
| 73 | 73 | |
| 74 | - foreach($responses as $k => $resp) { |
|
| 74 | + foreach ($responses as $k => $resp) { |
|
| 75 | 75 | if (!$resp) { |
| 76 | - $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . $errors[$k]); |
|
| 76 | + $responses[$k] = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.$errors[$k]); |
|
| 77 | 77 | } else { |
| 78 | 78 | $responses[$k] = $requests[$k]->parseResponse($resp, true, $this->return_type); |
| 79 | 79 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $value = $encoder->encode($data, array('auto_dates')); |
| 94 | 94 | $req = new Request('interopEchoTests.echoValue', array($value)); |
| 95 | 95 | $reqs = array(); |
| 96 | -for ($i = 0; $i < $num_tests; $i++) { |
|
| 96 | +for ($i = 0; $i<$num_tests; $i++) { |
|
| 97 | 97 | $reqs[] = $req; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -102,40 +102,40 @@ discard block |
||
| 102 | 102 | // avoid storing http info in the responses, to make the checksums comparable |
| 103 | 103 | $client->setDebug(-1); |
| 104 | 104 | |
| 105 | -echo "Making $num_tests calls to method interopEchoTests.echoValue on server " . XMLRPCSERVER . " ...\n"; |
|
| 105 | +echo "Making $num_tests calls to method interopEchoTests.echoValue on server ".XMLRPCSERVER." ...\n"; |
|
| 106 | 106 | flush(); |
| 107 | 107 | |
| 108 | -$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
| 108 | +$client->setOption(Client::OPT_NO_MULTICALL, true); |
|
| 109 | 109 | $t = microtime(true); |
| 110 | 110 | $resp = $client->send($reqs); |
| 111 | -$t = microtime(true) - $t; |
|
| 112 | -echo "Sequential send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 113 | -echo "Response checksum: " . md5(var_export($resp, true)) . "\n"; |
|
| 111 | +$t = microtime(true)-$t; |
|
| 112 | +echo "Sequential send: ".sprintf('%.3f', $t)." secs.\n"; |
|
| 113 | +echo "Response checksum: ".md5(var_export($resp, true))."\n"; |
|
| 114 | 114 | flush(); |
| 115 | 115 | |
| 116 | 116 | if (strpos(XMLRPCSERVER, 'http://') === 0) { |
| 117 | - $client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_ALWAYS); |
|
| 117 | + $client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_ALWAYS); |
|
| 118 | 118 | $t = microtime(true); |
| 119 | 119 | $resp = $client->send($reqs); |
| 120 | - $t = microtime(true) - $t; |
|
| 121 | - echo "Sequential send, curl (w. keepalive): " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 122 | - echo "Response checksum: " . md5(var_export($resp, true)) . "\n"; |
|
| 120 | + $t = microtime(true)-$t; |
|
| 121 | + echo "Sequential send, curl (w. keepalive): ".sprintf('%.3f', $t)." secs.\n"; |
|
| 122 | + echo "Response checksum: ".md5(var_export($resp, true))."\n"; |
|
| 123 | 123 | flush(); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $t = microtime(true); |
| 127 | 127 | $resp = $client->sendParallel($reqs); |
| 128 | -$t = microtime(true) - $t; |
|
| 129 | -echo "Parallel send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 130 | -echo "Response checksum: " . md5(var_export($resp, true)) . "\n"; |
|
| 128 | +$t = microtime(true)-$t; |
|
| 129 | +echo "Parallel send: ".sprintf('%.3f', $t)." secs.\n"; |
|
| 130 | +echo "Response checksum: ".md5(var_export($resp, true))."\n"; |
|
| 131 | 131 | flush(); |
| 132 | 132 | |
| 133 | 133 | $client->setOption(Client::OPT_NO_MULTICALL, false); |
| 134 | 134 | // make sure we don't reuse the keepalive handle |
| 135 | -$client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_NEVER); |
|
| 135 | +$client->setOption(Client::OPT_USE_CURL, Client::USE_CURL_NEVER); |
|
| 136 | 136 | $t = microtime(true); |
| 137 | 137 | $resp = $client->send($reqs); |
| 138 | -$t = microtime(true) - $t; |
|
| 139 | -echo "Multicall send: " . sprintf('%.3f', $t) . " secs.\n"; |
|
| 140 | -echo "Response checksum: " . md5(var_export($resp, true)) . "\n"; |
|
| 138 | +$t = microtime(true)-$t; |
|
| 139 | +echo "Multicall send: ".sprintf('%.3f', $t)." secs.\n"; |
|
| 140 | +echo "Response checksum: ".md5(var_export($resp, true))."\n"; |
|
| 141 | 141 | flush(); |
@@ -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 - Introspect demo</title></head> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | function display_error($r) |
| 18 | 18 | { |
| 19 | 19 | output("An error occurred: "); |
| 20 | - output("Code: " . $r->faultCode() . " Reason: '" . $r->faultString() . "'<br/>"); |
|
| 20 | + output("Code: ".$r->faultCode()." Reason: '".$r->faultString()."'<br/>"); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $client = new Client(XMLRPCSERVER); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $client->setOption(Client::OPT_RETURN_TYPE, XMLRPCParser::RETURN_PHP); |
| 26 | 26 | |
| 27 | 27 | // First off, let's retrieve the list of methods available on the remote server |
| 28 | -output("<h3>methods available at http://" . $client->getUrl(PHP_URL_HOST) . $client->getUrl(PHP_URL_PATH) . "</h3>\n"); |
|
| 28 | +output("<h3>methods available at http://".$client->getUrl(PHP_URL_HOST).$client->getUrl(PHP_URL_PATH)."</h3>\n"); |
|
| 29 | 29 | $req = new Request('system.listMethods'); |
| 30 | 30 | $resp = $client->send($req); |
| 31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // Then, retrieve the signature and help text of each available method |
| 49 | 49 | foreach ($v as $methodName) { |
| 50 | - output("<h4>" . htmlspecialchars($methodName) . "</h4>\n"); |
|
| 50 | + output("<h4>".htmlspecialchars($methodName)."</h4>\n"); |
|
| 51 | 51 | // build requests first, add params later |
| 52 | 52 | $r1 = new PhpXmlRpc\Request('system.methodHelp'); |
| 53 | 53 | $r2 = new PhpXmlRpc\Request('system.methodSignature'); |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | $ret = $sig[0]; |
| 86 | - output("<code>" . htmlspecialchars($ret) . " " |
|
| 87 | - . htmlspecialchars($methodName) . "("); |
|
| 88 | - if (count($sig) > 1) { |
|
| 89 | - for ($k = 1; $k < count($sig); $k++) { |
|
| 86 | + output("<code>".htmlspecialchars($ret)." " |
|
| 87 | + . htmlspecialchars($methodName)."("); |
|
| 88 | + if (count($sig)>1) { |
|
| 89 | + for ($k = 1; $k<count($sig); $k++) { |
|
| 90 | 90 | output(htmlspecialchars($sig[$k])); |
| 91 | - if ($k < count($sig) - 1) { |
|
| 91 | + if ($k<count($sig)-1) { |
|
| 92 | 92 | output(", "); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | return; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - $this->getLogger()->warning('XML-RPC Deprecated: ' . $message); |
|
| 17 | + $this->getLogger()->warning('XML-RPC Deprecated: '.$message); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $this->getLogger()->warning('XML-RPC Deprecated: ' . $trace[1]['class'] . '::' . $trace[1]['function'] . |
|
| 38 | - ' is only supposed to be called by ' . $expectedCaller); |
|
| 37 | + $this->getLogger()->warning('XML-RPC Deprecated: '.$trace[1]['class'].'::'.$trace[1]['function']. |
|
| 38 | + ' is only supposed to be called by '.$expectedCaller); |
|
| 39 | 39 | } |
| 40 | 40 | } |