@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | ); |
58 | 58 | } |
59 | 59 | |
60 | - public static function getOpts($args=array(), $cliOpts=array()) |
|
60 | + public static function getOpts($args = array(), $cliOpts = array()) |
|
61 | 61 | { |
62 | - if (count($args) > 0) |
|
62 | + if (count($args)>0) |
|
63 | 63 | // throw new \Exception('Missing library version argument'); |
64 | 64 | self::$libVersion = $args[0]; |
65 | 65 | |
@@ -157,17 +157,17 @@ discard block |
||
157 | 157 | $out = ''; |
158 | 158 | while (($start = strpos($content, $startTag, $last)) !== false) { |
159 | 159 | $end = strpos($content, $endTag, $start); |
160 | - $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag)); |
|
161 | - if ($code[strlen($code) - 1] == "\n") { |
|
160 | + $code = substr($content, $start+strlen($startTag), $end-$start-strlen($startTag)); |
|
161 | + if ($code[strlen($code)-1] == "\n") { |
|
162 | 162 | $code = substr($code, 0, -1); |
163 | 163 | } |
164 | 164 | |
165 | 165 | $code = str_replace(array('>', '<'), array('>', '<'), $code); |
166 | - $code = highlight_string('<?php ' . $code, true); |
|
166 | + $code = highlight_string('<?php '.$code, true); |
|
167 | 167 | $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code); |
168 | 168 | |
169 | - $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag; |
|
170 | - $last = $end + strlen($endTag); |
|
169 | + $out = $out.substr($content, $last, $start+strlen($startTag)-$last).$code.$endTag; |
|
170 | + $last = $end+strlen($endTag); |
|
171 | 171 | } |
172 | 172 | $out .= substr($content, $last, strlen($content)); |
173 | 173 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | use PhpXmlRpc\Builder; |
183 | 183 | |
184 | -function run_default($task=null, $args=array(), $cliOpts=array()) |
|
184 | +function run_default($task = null, $args = array(), $cliOpts = array()) |
|
185 | 185 | { |
186 | 186 | echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n"; |
187 | 187 | echo "\n"; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | echo " --zip=ZIP Location of the zip tool\n"; |
199 | 199 | } |
200 | 200 | |
201 | -function run_getopts($task=null, $args=array(), $cliOpts=array()) |
|
201 | +function run_getopts($task = null, $args = array(), $cliOpts = array()) |
|
202 | 202 | { |
203 | 203 | Builder::getOpts($args, $cliOpts); |
204 | 204 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * Downloads source code in the build workspace directory, optionally checking out the given branch/tag |
208 | 208 | */ |
209 | -function run_init($task=null, $args=array(), $cliOpts=array()) |
|
209 | +function run_init($task = null, $args = array(), $cliOpts = array()) |
|
210 | 210 | { |
211 | 211 | // download the current version into the workspace |
212 | 212 | $targetDir = Builder::workspaceDir(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * (does nothing by itself, as all the steps are managed via task dependencies) |
236 | 236 | */ |
237 | -function run_build($task=null, $args=array(), $cliOpts=array()) |
|
237 | +function run_build($task = null, $args = array(), $cliOpts = array()) |
|
238 | 238 | { |
239 | 239 | } |
240 | 240 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | /** |
251 | 251 | * Generates documentation in all formats |
252 | 252 | */ |
253 | -function run_doc($task=null, $args=array(), $cliOpts=array()) |
|
253 | +function run_doc($task = null, $args = array(), $cliOpts = array()) |
|
254 | 254 | { |
255 | 255 | $docDir = Builder::workspaceDir().'/doc'; |
256 | 256 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | /** |
319 | 319 | * Creates the tarballs for a release |
320 | 320 | */ |
321 | -function run_dist($task=null, $args=array(), $cliOpts=array()) |
|
321 | +function run_dist($task = null, $args = array(), $cliOpts = array()) |
|
322 | 322 | { |
323 | 323 | // copy workspace dir into dist dir, without git |
324 | 324 | pake_mkdirs(Builder::distDir()); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | // create tarballs |
333 | 333 | $cwd = getcwd(); |
334 | 334 | chdir(dirname(Builder::distDir())); |
335 | - foreach(Builder::distFiles() as $distFile) { |
|
335 | + foreach (Builder::distFiles() as $distFile) { |
|
336 | 336 | // php can not really create good zip files via phar: they are not compressed! |
337 | 337 | if (substr($distFile, -4) == '.zip') { |
338 | 338 | $cmd = Builder::tool('zip'); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | chdir($cwd); |
351 | 351 | } |
352 | 352 | |
353 | -function run_clean_workspace($task=null, $args=array(), $cliOpts=array()) |
|
353 | +function run_clean_workspace($task = null, $args = array(), $cliOpts = array()) |
|
354 | 354 | { |
355 | 355 | pake_remove_dir(Builder::workspaceDir()); |
356 | 356 | } |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | * Cleans up the whole build directory |
360 | 360 | * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources |
361 | 361 | */ |
362 | -function run_clean($task=null, $args=array(), $cliOpts=array()) |
|
362 | +function run_clean($task = null, $args = array(), $cliOpts = array()) |
|
363 | 363 | { |
364 | 364 | pake_remove_dir(Builder::buildDir()); |
365 | 365 | } |
366 | 366 | |
367 | 367 | // helper task: display help text |
368 | -pake_task( 'default' ); |
|
368 | +pake_task('default'); |
|
369 | 369 | // internal task: parse cli options |
370 | 370 | pake_task('getopts'); |
371 | 371 | pake_task('init', 'getopts'); |
@@ -27,8 +27,9 @@ discard block |
||
27 | 27 | |
28 | 28 | public static function libVersion() |
29 | 29 | { |
30 | - if (self::$libVersion == null) |
|
31 | - throw new \Exception('Missing library version argument'); |
|
30 | + if (self::$libVersion == null) { |
|
31 | + throw new \Exception('Missing library version argument'); |
|
32 | + } |
|
32 | 33 | return self::$libVersion; |
33 | 34 | } |
34 | 35 | |
@@ -59,9 +60,10 @@ discard block |
||
59 | 60 | |
60 | 61 | public static function getOpts($args=array(), $cliOpts=array()) |
61 | 62 | { |
62 | - if (count($args) > 0) |
|
63 | - // throw new \Exception('Missing library version argument'); |
|
63 | + if (count($args) > 0) { |
|
64 | + // throw new \Exception('Missing library version argument'); |
|
64 | 65 | self::$libVersion = $args[0]; |
66 | + } |
|
65 | 67 | |
66 | 68 | foreach (self::$tools as $name => $binary) { |
67 | 69 | if (isset($cliOpts[$name])) { |
@@ -338,8 +340,7 @@ discard block |
||
338 | 340 | $cmd = Builder::tool('zip'); |
339 | 341 | $extra = '-9 -r'; |
340 | 342 | pake_sh("$cmd $distFile $extra ".basename(Builder::distDir())); |
341 | - } |
|
342 | - else { |
|
343 | + } else { |
|
343 | 344 | $finder = pakeFinder::type('any')->pattern(basename(Builder::distDir()).'/**'); |
344 | 345 | // see https://bugs.php.net/bug.php?id=58852 |
345 | 346 | $pharFile = str_replace(Builder::libVersion(), '_LIBVERSION_', $distFile); |
@@ -367,7 +367,9 @@ |
||
367 | 367 | echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
368 | 368 | if ($x->count() > 1) { |
369 | 369 | foreach($x as $k => $y) { |
370 | - if ($k == 0) continue; |
|
370 | + if ($k == 0) { |
|
371 | + continue; |
|
372 | + } |
|
371 | 373 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
372 | 374 | if ($wstype != 1) { |
373 | 375 | $type = $y->scalarval(); |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | <body> |
92 | 92 | <?php |
93 | 93 | |
94 | -include __DIR__ . '/common.php'; |
|
94 | +include __DIR__.'/common.php'; |
|
95 | 95 | |
96 | 96 | if ($action) { |
97 | 97 | |
98 | 98 | // make sure the script waits long enough for the call to complete... |
99 | 99 | if ($timeout) { |
100 | - set_time_limit($timeout + 10); |
|
100 | + set_time_limit($timeout+10); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | if ($wstype == 1) { |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | $server = "$host$path"; |
123 | 123 | } |
124 | 124 | if ($protocol == 2) { |
125 | - $server = 'https://' . $server; |
|
125 | + $server = 'https://'.$server; |
|
126 | 126 | } else { |
127 | - $server = 'http://' . $server; |
|
127 | + $server = 'http://'.$server; |
|
128 | 128 | } |
129 | 129 | if ($proxy != '') { |
130 | 130 | $pproxy = explode(':', $proxy); |
131 | - if (count($pproxy) > 1) { |
|
131 | + if (count($pproxy)>1) { |
|
132 | 132 | $pport = $pproxy[1]; |
133 | 133 | } else { |
134 | 134 | $pport = 8080; |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | case 'wrap': |
198 | 198 | $msg[0] = new $requestClass('system.methodHelp', array(), $id); |
199 | 199 | $msg[0]->addparam(new PhpXmlRpc\Value($method)); |
200 | - $msg[1] = new $requestClass('system.methodSignature', array(), (int)$id + 1); |
|
200 | + $msg[1] = new $requestClass('system.methodSignature', array(), (int) $id+1); |
|
201 | 201 | $msg[1]->addparam(new PhpXmlRpc\Value($method)); |
202 | - $actionname = 'Description of method "' . $method . '"'; |
|
202 | + $actionname = 'Description of method "'.$method.'"'; |
|
203 | 203 | break; |
204 | 204 | case 'list': |
205 | 205 | $msg[0] = new $requestClass('system.listMethods', array(), $id); |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | $msg[0] = new $requestClass($method, array(), $id); |
213 | 213 | // hack! build xml payload by hand |
214 | 214 | if ($wstype == 1) { |
215 | - $msg[0]->payload = "{\n" . |
|
216 | - '"method": "' . $method . "\",\n\"params\": [" . |
|
217 | - $payload . |
|
215 | + $msg[0]->payload = "{\n". |
|
216 | + '"method": "'.$method."\",\n\"params\": [". |
|
217 | + $payload. |
|
218 | 218 | "\n],\n\"id\": "; |
219 | 219 | // fix: if user gave an empty string, use NULL, or we'll break json syntax |
220 | 220 | if ($id == "") { |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | } |
228 | 228 | } |
229 | 229 | } else { |
230 | - $msg[0]->payload = $msg[0]->xml_header($inputcharset) . |
|
231 | - '<methodName>' . $method . "</methodName>\n<params>" . |
|
232 | - $payload . |
|
233 | - "</params>\n" . $msg[0]->xml_footer(); |
|
230 | + $msg[0]->payload = $msg[0]->xml_header($inputcharset). |
|
231 | + '<methodName>'.$method."</methodName>\n<params>". |
|
232 | + $payload. |
|
233 | + "</params>\n".$msg[0]->xml_footer(); |
|
234 | 234 | } |
235 | - $actionname = 'Execution of method ' . $method; |
|
235 | + $actionname = 'Execution of method '.$method; |
|
236 | 236 | break; |
237 | 237 | default: // give a warning |
238 | - $actionname = '[ERROR: unknown action] "' . $action . '"'; |
|
238 | + $actionname = '[ERROR: unknown action] "'.$action.'"'; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // Before calling execute, echo out brief description of action taken + date and time ??? |
242 | 242 | // this gives good user feedback for long-running methods... |
243 | - echo '<h2>' . htmlspecialchars($actionname, ENT_COMPAT, $inputcharset) . ' on server ' . htmlspecialchars($server, ENT_COMPAT, $inputcharset) . " ...</h2>\n"; |
|
243 | + echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset)." ...</h2>\n"; |
|
244 | 244 | flush(); |
245 | 245 | |
246 | 246 | $response = null; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | break; |
259 | 259 | } |
260 | 260 | } |
261 | - $time = microtime(true) - $time; |
|
261 | + $time = microtime(true)-$time; |
|
262 | 262 | if ($debug) { |
263 | 263 | echo "</div>\n"; |
264 | 264 | } |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | // call failed! echo out error msg! |
269 | 269 | //echo '<h2>'.htmlspecialchars($actionname, ENT_COMPAT, $inputcharset).' on server '.htmlspecialchars($server, ENT_COMPAT, $inputcharset).'</h2>'; |
270 | 270 | echo "<h3>$protoName call FAILED!</h3>\n"; |
271 | - echo "<p>Fault code: [" . htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
272 | - "] Reason: '" . htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "'</p>\n"; |
|
271 | + echo "<p>Fault code: [".htmlspecialchars($response->faultCode(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
272 | + "] Reason: '".htmlspecialchars($response->faultString(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."'</p>\n"; |
|
273 | 273 | echo(strftime("%d/%b/%Y:%H:%M:%S\n")); |
274 | 274 | } else { |
275 | 275 | // call succeeded: parse results |
@@ -285,36 +285,36 @@ discard block |
||
285 | 285 | $max = $v->count(); |
286 | 286 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
287 | 287 | echo "<thead>\n<tr><th>Method ($max)</th><th>Description</th></tr>\n</thead>\n<tbody>\n"; |
288 | - foreach($v as $i => $rec) { |
|
288 | + foreach ($v as $i => $rec) { |
|
289 | 289 | if ($i % 2) { |
290 | 290 | $class = ' class="oddrow"'; |
291 | 291 | } else { |
292 | 292 | $class = ' class="evenrow"'; |
293 | 293 | } |
294 | - echo("<tr><td$class>" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">" . |
|
295 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
296 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
297 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
298 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
299 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
300 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
301 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
302 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
303 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
304 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
305 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
306 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
307 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
308 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
309 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
310 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
311 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
312 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
313 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
314 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "\" />" . |
|
315 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
316 | - "<input type=\"hidden\" name=\"action\" value=\"describe\" />" . |
|
317 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
294 | + echo("<tr><td$class>".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."</td><td$class><form action=\"controller.php\" method=\"get\" target=\"frmcontroller\">". |
|
295 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
296 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
297 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
298 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
299 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
300 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
301 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
302 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
303 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
304 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
305 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
306 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
307 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
308 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
309 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
310 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
311 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
312 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
313 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
314 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($rec->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."\" />". |
|
315 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
316 | + "<input type=\"hidden\" name=\"action\" value=\"describe\" />". |
|
317 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
318 | 318 | "<input type=\"submit\" value=\"Describe\" /></form></td>"); |
319 | 319 | //echo("</tr>\n"); |
320 | 320 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $r2 = $resp[1]->value(); |
342 | 342 | |
343 | 343 | echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; |
344 | - echo "<thead>\n<tr><th>Method</th><th>" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
344 | + echo "<thead>\n<tr><th>Method</th><th>".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."</th><th> </th><th> </th></tr>\n</thead>\n<tbody>\n"; |
|
345 | 345 | $desc = htmlspecialchars($r1->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
346 | 346 | if ($desc == "") { |
347 | 347 | $desc = "-"; |
@@ -351,41 +351,41 @@ discard block |
||
351 | 351 | if ($r2->kindOf() != "array") { |
352 | 352 | echo "<tr><td class=\"oddrow\">Signature</td><td class=\"oddrow\">Unknown</td><td class=\"oddrow\"> </td></tr>\n"; |
353 | 353 | } else { |
354 | - foreach($r2 as $i => $x) { |
|
354 | + foreach ($r2 as $i => $x) { |
|
355 | 355 | $payload = ""; |
356 | 356 | $alt_payload = ""; |
357 | - if ($i + 1 % 2) { |
|
357 | + if ($i+1 % 2) { |
|
358 | 358 | $class = ' class="oddrow"'; |
359 | 359 | } else { |
360 | 360 | $class = ' class="evenrow"'; |
361 | 361 | } |
362 | - echo "<tr><td$class>Signature " . ($i + 1) . "</td><td$class>"; |
|
362 | + echo "<tr><td$class>Signature ".($i+1)."</td><td$class>"; |
|
363 | 363 | if ($x->kindOf() == "array") { |
364 | 364 | $ret = $x[0]; |
365 | - echo "<code>OUT: " . htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . "<br />IN: ("; |
|
366 | - if ($x->count() > 1) { |
|
367 | - foreach($x as $k => $y) { |
|
365 | + echo "<code>OUT: ".htmlspecialchars($ret->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding)."<br />IN: ("; |
|
366 | + if ($x->count()>1) { |
|
367 | + foreach ($x as $k => $y) { |
|
368 | 368 | if ($k == 0) continue; |
369 | 369 | echo htmlspecialchars($y->scalarval(), ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding); |
370 | 370 | if ($wstype != 1) { |
371 | 371 | $type = $y->scalarval(); |
372 | 372 | $payload .= '<param><value>'; |
373 | - switch($type) { |
|
373 | + switch ($type) { |
|
374 | 374 | case 'undefined': |
375 | 375 | break; |
376 | 376 | case 'null'; |
377 | 377 | $type = 'nil'; |
378 | 378 | // fall thru intentionally |
379 | 379 | default: |
380 | - $payload .= '<' . |
|
381 | - htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
382 | - '></' . htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding) . |
|
380 | + $payload .= '<'. |
|
381 | + htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
382 | + '></'.htmlspecialchars($type, ENT_COMPAT, \PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding). |
|
383 | 383 | '>'; |
384 | 384 | } |
385 | 385 | $payload .= "</value></param>\n"; |
386 | 386 | } |
387 | 387 | $alt_payload .= $y->scalarval(); |
388 | - if ($k < $x->count() - 1) { |
|
388 | + if ($k<$x->count()-1) { |
|
389 | 389 | $alt_payload .= ';'; |
390 | 390 | echo ", "; |
391 | 391 | } |
@@ -398,63 +398,63 @@ discard block |
||
398 | 398 | echo '</td>'; |
399 | 399 | // button to test this method |
400 | 400 | //$payload="<methodCall>\n<methodName>$method</methodName>\n<params>\n$payload</params>\n</methodCall>"; |
401 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
402 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
403 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
404 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
405 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
406 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
407 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
408 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
409 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
410 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
411 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
412 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
413 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
414 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
415 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
416 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
417 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
418 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
419 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
420 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
421 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
422 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
423 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
424 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
401 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
402 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
403 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
404 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
405 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
406 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
407 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
408 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
409 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
410 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
411 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
412 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
413 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
414 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
415 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
416 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
417 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
418 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
419 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
420 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
421 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
422 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
423 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
424 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
425 | 425 | "<input type=\"hidden\" name=\"action\" value=\"execute\" />"; |
426 | 426 | if ($wstype != 1) { |
427 | 427 | echo "<input type=\"submit\" value=\"Load method synopsis\" />"; |
428 | 428 | } |
429 | 429 | echo "</form></td>\n"; |
430 | 430 | |
431 | - echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">" . |
|
432 | - "<input type=\"hidden\" name=\"host\" value=\"" . htmlspecialchars($host, ENT_COMPAT, $inputcharset) . "\" />" . |
|
433 | - "<input type=\"hidden\" name=\"port\" value=\"" . htmlspecialchars($port, ENT_COMPAT, $inputcharset) . "\" />" . |
|
434 | - "<input type=\"hidden\" name=\"path\" value=\"" . htmlspecialchars($path, ENT_COMPAT, $inputcharset) . "\" />" . |
|
435 | - "<input type=\"hidden\" name=\"id\" value=\"" . htmlspecialchars($id, ENT_COMPAT, $inputcharset) . "\" />" . |
|
436 | - "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />" . |
|
437 | - "<input type=\"hidden\" name=\"username\" value=\"" . htmlspecialchars($username, ENT_COMPAT, $inputcharset) . "\" />" . |
|
438 | - "<input type=\"hidden\" name=\"password\" value=\"" . htmlspecialchars($password, ENT_COMPAT, $inputcharset) . "\" />" . |
|
439 | - "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />" . |
|
440 | - "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />" . |
|
441 | - "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />" . |
|
442 | - "<input type=\"hidden\" name=\"cainfo\" value=\"" . htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset) . "\" />" . |
|
443 | - "<input type=\"hidden\" name=\"proxy\" value=\"" . htmlspecialchars($proxy, ENT_COMPAT, $inputcharset) . "\" />" . |
|
444 | - "<input type=\"hidden\" name=\"proxyuser\" value=\"" . htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset) . "\" />" . |
|
445 | - "<input type=\"hidden\" name=\"proxypwd\" value=\"" . htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset) . "\" />" . |
|
446 | - "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />" . |
|
447 | - "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />" . |
|
448 | - "<input type=\"hidden\" name=\"clientcookies\" value=\"" . htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset) . "\" />" . |
|
449 | - "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />" . |
|
450 | - "<input type=\"hidden\" name=\"timeout\" value=\"" . htmlspecialchars($timeout, ENT_COMPAT, $inputcharset) . "\" />" . |
|
451 | - "<input type=\"hidden\" name=\"method\" value=\"" . htmlspecialchars($method, ENT_COMPAT, $inputcharset) . "\" />" . |
|
452 | - "<input type=\"hidden\" name=\"methodsig\" value=\"" . $i . "\" />" . |
|
453 | - "<input type=\"hidden\" name=\"methodpayload\" value=\"" . htmlspecialchars($payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
454 | - "<input type=\"hidden\" name=\"altmethodpayload\" value=\"" . htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset) . "\" />" . |
|
455 | - "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />" . |
|
456 | - "<input type=\"hidden\" name=\"run\" value=\"now\" />" . |
|
457 | - "<input type=\"hidden\" name=\"action\" value=\"wrap\" />" . |
|
431 | + echo "<td$class><form action=\"controller.php\" target=\"frmcontroller\" method=\"get\">". |
|
432 | + "<input type=\"hidden\" name=\"host\" value=\"".htmlspecialchars($host, ENT_COMPAT, $inputcharset)."\" />". |
|
433 | + "<input type=\"hidden\" name=\"port\" value=\"".htmlspecialchars($port, ENT_COMPAT, $inputcharset)."\" />". |
|
434 | + "<input type=\"hidden\" name=\"path\" value=\"".htmlspecialchars($path, ENT_COMPAT, $inputcharset)."\" />". |
|
435 | + "<input type=\"hidden\" name=\"id\" value=\"".htmlspecialchars($id, ENT_COMPAT, $inputcharset)."\" />". |
|
436 | + "<input type=\"hidden\" name=\"debug\" value=\"$debug\" />". |
|
437 | + "<input type=\"hidden\" name=\"username\" value=\"".htmlspecialchars($username, ENT_COMPAT, $inputcharset)."\" />". |
|
438 | + "<input type=\"hidden\" name=\"password\" value=\"".htmlspecialchars($password, ENT_COMPAT, $inputcharset)."\" />". |
|
439 | + "<input type=\"hidden\" name=\"authtype\" value=\"$authtype\" />". |
|
440 | + "<input type=\"hidden\" name=\"verifyhost\" value=\"$verifyhost\" />". |
|
441 | + "<input type=\"hidden\" name=\"verifypeer\" value=\"$verifypeer\" />". |
|
442 | + "<input type=\"hidden\" name=\"cainfo\" value=\"".htmlspecialchars($cainfo, ENT_COMPAT, $inputcharset)."\" />". |
|
443 | + "<input type=\"hidden\" name=\"proxy\" value=\"".htmlspecialchars($proxy, ENT_COMPAT, $inputcharset)."\" />". |
|
444 | + "<input type=\"hidden\" name=\"proxyuser\" value=\"".htmlspecialchars($proxyuser, ENT_COMPAT, $inputcharset)."\" />". |
|
445 | + "<input type=\"hidden\" name=\"proxypwd\" value=\"".htmlspecialchars($proxypwd, ENT_COMPAT, $inputcharset)."\" />". |
|
446 | + "<input type=\"hidden\" name=\"responsecompression\" value=\"$responsecompression\" />". |
|
447 | + "<input type=\"hidden\" name=\"requestcompression\" value=\"$requestcompression\" />". |
|
448 | + "<input type=\"hidden\" name=\"clientcookies\" value=\"".htmlspecialchars($clientcookies, ENT_COMPAT, $inputcharset)."\" />". |
|
449 | + "<input type=\"hidden\" name=\"protocol\" value=\"$protocol\" />". |
|
450 | + "<input type=\"hidden\" name=\"timeout\" value=\"".htmlspecialchars($timeout, ENT_COMPAT, $inputcharset)."\" />". |
|
451 | + "<input type=\"hidden\" name=\"method\" value=\"".htmlspecialchars($method, ENT_COMPAT, $inputcharset)."\" />". |
|
452 | + "<input type=\"hidden\" name=\"methodsig\" value=\"".$i."\" />". |
|
453 | + "<input type=\"hidden\" name=\"methodpayload\" value=\"".htmlspecialchars($payload, ENT_COMPAT, $inputcharset)."\" />". |
|
454 | + "<input type=\"hidden\" name=\"altmethodpayload\" value=\"".htmlspecialchars($alt_payload, ENT_COMPAT, $inputcharset)."\" />". |
|
455 | + "<input type=\"hidden\" name=\"wstype\" value=\"$wstype\" />". |
|
456 | + "<input type=\"hidden\" name=\"run\" value=\"now\" />". |
|
457 | + "<input type=\"hidden\" name=\"action\" value=\"wrap\" />". |
|
458 | 458 | "<input type=\"submit\" value=\"Generate method call stub code\" />"; |
459 | 459 | echo "</form></td></tr>\n"; |
460 | 460 | } |
@@ -466,14 +466,14 @@ discard block |
||
466 | 466 | case 'wrap': |
467 | 467 | $r1 = $resp[0]->value(); |
468 | 468 | $r2 = $resp[1]->value(); |
469 | - if ($r2->kindOf() != "array" || $r2->count() <= $methodsig) { |
|
469 | + if ($r2->kindOf() != "array" || $r2->count()<=$methodsig) { |
|
470 | 470 | echo "Error: signature unknown\n"; |
471 | 471 | } else { |
472 | 472 | $mdesc = $r1->scalarval(); |
473 | 473 | $encoder = new PhpXmlRpc\Encoder(); |
474 | 474 | $msig = $encoder->decode($r2); |
475 | 475 | $msig = $msig[$methodsig]; |
476 | - $proto = $protocol == 2 ? 'https' : ( $protocol == 1 ? 'http11' : '' ); |
|
476 | + $proto = $protocol == 2 ? 'https' : ($protocol == 1 ? 'http11' : ''); |
|
477 | 477 | if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && |
478 | 478 | $clientcookies == '' |
479 | 479 | ) { |
@@ -487,11 +487,11 @@ discard block |
||
487 | 487 | $prefix = 'xmlrpc'; |
488 | 488 | } |
489 | 489 | $wrapper = new PhpXmlRpc\Wrapper(); |
490 | - $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc); |
|
490 | + $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix.'_'.$method), $msig, $mdesc); |
|
491 | 491 | //if ($code) |
492 | 492 | //{ |
493 | 493 | echo "<div id=\"phpcode\">\n"; |
494 | - highlight_string("<?php\n" . $code['docstring'] . $code['source'] . '?>'); |
|
494 | + highlight_string("<?php\n".$code['docstring'].$code['source'].'?>'); |
|
495 | 495 | echo "\n</div>"; |
496 | 496 | //} |
497 | 497 | //else |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | break; |
503 | 503 | |
504 | 504 | case 'execute': |
505 | - echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>'; |
|
505 | + echo '<div id="response"><h2>Response:</h2>'.htmlspecialchars($response->serialize()).'</div>'; |
|
506 | 506 | break; |
507 | 507 | |
508 | 508 | default: // give a warning |
@@ -3,7 +3,7 @@ |
||
3 | 3 | if (isset($_GET['run'])) { |
4 | 4 | $path = parse_url($_GET['run']); |
5 | 5 | if (isset($path['query'])) { |
6 | - $query = '?' . $path['query']; |
|
6 | + $query = '?'.$path['query']; |
|
7 | 7 | } |
8 | 8 | } |
9 | 9 | ?> |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @license code licensed under the BSD License: see file license.txt |
7 | 7 | **/ |
8 | 8 | |
9 | -$coverageFile = realpath(__DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
9 | +$coverageFile = realpath(__DIR__."/../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/phpunit_coverage.php"); |
|
10 | 10 | |
11 | 11 | // has to be the same value as used in server.php |
12 | 12 | $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage'; |
@@ -561,8 +561,9 @@ discard block |
||
561 | 561 | } |
562 | 562 | foreach ($parsVariations as $i => $pars) { |
563 | 563 | $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
564 | - if ($i < (count($parsVariations) - 1)) |
|
565 | - $innerCode .= "else\n"; |
|
564 | + if ($i < (count($parsVariations) - 1)) { |
|
565 | + $innerCode .= "else\n"; |
|
566 | + } |
|
566 | 567 | } |
567 | 568 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
568 | 569 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
@@ -615,7 +616,7 @@ discard block |
||
615 | 616 | if ($methodWrap) { |
616 | 617 | if (is_object($className)) { |
617 | 618 | $realClassName = get_class($className); |
618 | - }else { |
|
619 | + } else { |
|
619 | 620 | $realClassName = $className; |
620 | 621 | } |
621 | 622 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -167,20 +167,20 @@ discard block |
||
167 | 167 | $callable = explode('::', $callable); |
168 | 168 | } |
169 | 169 | if (is_array($callable)) { |
170 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
171 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
170 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
171 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
172 | 172 | return false; |
173 | 173 | } |
174 | 174 | if (is_string($callable[0])) { |
175 | 175 | $plainFuncName = implode('::', $callable); |
176 | 176 | } elseif (is_object($callable[0])) { |
177 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
177 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
178 | 178 | } |
179 | 179 | $exists = method_exists($callable[0], $callable[1]); |
180 | 180 | } else if ($callable instanceof \Closure) { |
181 | 181 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
182 | 182 | if (!$buildIt) { |
183 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
183 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | if (!$exists) { |
195 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
195 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | |
@@ -236,23 +236,23 @@ discard block |
||
236 | 236 | if (is_array($callable)) { |
237 | 237 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
238 | 238 | if ($func->isPrivate()) { |
239 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
239 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | if ($func->isProtected()) { |
243 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
243 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 | if ($func->isConstructor()) { |
247 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
247 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
248 | 248 | return false; |
249 | 249 | } |
250 | 250 | if ($func->isDestructor()) { |
251 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
251 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
252 | 252 | return false; |
253 | 253 | } |
254 | 254 | if ($func->isAbstract()) { |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
256 | 256 | return false; |
257 | 257 | } |
258 | 258 | /// @todo add more checks for static vs. nonstatic? |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | if ($func->isInternal()) { |
263 | 263 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
264 | 264 | // instead of getparameters to fully reflect internal php functions ? |
265 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
265 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
266 | 266 | return false; |
267 | 267 | } |
268 | 268 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $i = 0; |
315 | 315 | foreach ($func->getParameters() as $paramObj) { |
316 | 316 | $params[$i] = array(); |
317 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
317 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
318 | 318 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
319 | 319 | $i++; |
320 | 320 | } |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | // build a signature |
380 | 380 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
381 | 381 | $pSig = array($funcDesc['returnsDocs']); |
382 | - for ($i = 0; $i < count($pars); $i++) { |
|
382 | + for ($i = 0; $i<count($pars); $i++) { |
|
383 | 383 | $name = strtolower($funcDesc['params'][$i]['name']); |
384 | 384 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
385 | 385 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | } |
436 | 436 | $numPars = $req->getNumParams(); |
437 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
437 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
438 | 438 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
439 | 439 | } |
440 | 440 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | |
448 | 448 | $result = call_user_func_array($callable, $params); |
449 | 449 | |
450 | - if (! is_a($result, $responseClass)) { |
|
450 | + if (!is_a($result, $responseClass)) { |
|
451 | 451 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
452 | 452 | $result = new $valueClass($result, $funcDesc['returns']); |
453 | 453 | } else { |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | if ($newFuncName == '') { |
483 | 483 | if (is_array($callable)) { |
484 | 484 | if (is_string($callable[0])) { |
485 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
485 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
486 | 486 | } else { |
487 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
487 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
488 | 488 | } |
489 | 489 | } else { |
490 | 490 | if ($callable instanceof \Closure) { |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | { |
521 | 521 | $namespace = '\\PhpXmlRpc\\'; |
522 | 522 | |
523 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
524 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
523 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
524 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
525 | 525 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
526 | 526 | |
527 | 527 | $i = 0; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | // build body of new function |
557 | 557 | |
558 | 558 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
559 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
559 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
560 | 560 | |
561 | 561 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
562 | 562 | if ($decodePhpObjects) { |
@@ -570,13 +570,13 @@ discard block |
||
570 | 570 | if (is_array($callable) && is_object($callable[0])) { |
571 | 571 | self::$objHolder[$newFuncName] = $callable[0]; |
572 | 572 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
573 | - $realFuncName = '$obj->' . $callable[1]; |
|
573 | + $realFuncName = '$obj->'.$callable[1]; |
|
574 | 574 | } else { |
575 | 575 | $realFuncName = $plainFuncName; |
576 | 576 | } |
577 | 577 | foreach ($parsVariations as $i => $pars) { |
578 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
579 | - if ($i < (count($parsVariations) - 1)) |
|
578 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
579 | + if ($i<(count($parsVariations)-1)) |
|
580 | 580 | $innerCode .= "else\n"; |
581 | 581 | } |
582 | 582 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | // if($func->returnsReference()) |
594 | 594 | // return false; |
595 | 595 | |
596 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
596 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
597 | 597 | |
598 | 598 | return $code; |
599 | 599 | } |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | if ($methodWrap) { |
631 | 631 | if (is_object($className)) { |
632 | 632 | $realClassName = get_class($className); |
633 | - }else { |
|
633 | + } else { |
|
634 | 634 | $realClassName = $className; |
635 | 635 | } |
636 | 636 | $results[$prefix."$realClassName.$mName"] = $methodWrap; |
@@ -731,21 +731,21 @@ discard block |
||
731 | 731 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
732 | 732 | { |
733 | 733 | $namespace = '\\PhpXmlRpc\\'; |
734 | - $reqClass = $namespace . 'Request'; |
|
735 | - $valClass = $namespace . 'Value'; |
|
736 | - $decoderClass = $namespace . 'Encoder'; |
|
734 | + $reqClass = $namespace.'Request'; |
|
735 | + $valClass = $namespace.'Value'; |
|
736 | + $decoderClass = $namespace.'Encoder'; |
|
737 | 737 | |
738 | 738 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
739 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
739 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
740 | 740 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
741 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
741 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
742 | 742 | |
743 | 743 | $req = new $reqClass('system.methodSignature'); |
744 | 744 | $req->addparam(new $valClass($methodName)); |
745 | 745 | $client->setDebug($debug); |
746 | 746 | $response = $client->send($req, $timeout, $protocol); |
747 | 747 | if ($response->faultCode()) { |
748 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
748 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
749 | 749 | return false; |
750 | 750 | } |
751 | 751 | |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | $mSig = $decoder->decode($mSig); |
756 | 756 | } |
757 | 757 | |
758 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
759 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
758 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
759 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
760 | 760 | return false; |
761 | 761 | } |
762 | 762 | |
@@ -772,11 +772,11 @@ discard block |
||
772 | 772 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
773 | 773 | { |
774 | 774 | $namespace = '\\PhpXmlRpc\\'; |
775 | - $reqClass = $namespace . 'Request'; |
|
776 | - $valClass = $namespace . 'Value'; |
|
775 | + $reqClass = $namespace.'Request'; |
|
776 | + $valClass = $namespace.'Value'; |
|
777 | 777 | |
778 | 778 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
779 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
779 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
780 | 780 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
781 | 781 | |
782 | 782 | $mDesc = ''; |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | $clientClone = clone $client; |
811 | 811 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
812 | 812 | { |
813 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
813 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
814 | 814 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
815 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
816 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
815 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
816 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
817 | 817 | if (isset($extraOptions['return_on_fault'])) { |
818 | 818 | $decodeFault = true; |
819 | 819 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -822,9 +822,9 @@ discard block |
||
822 | 822 | } |
823 | 823 | |
824 | 824 | $namespace = '\\PhpXmlRpc\\'; |
825 | - $reqClass = $namespace . 'Request'; |
|
826 | - $encoderClass = $namespace . 'Encoder'; |
|
827 | - $valueClass = $namespace . 'Value'; |
|
825 | + $reqClass = $namespace.'Request'; |
|
826 | + $encoderClass = $namespace.'Encoder'; |
|
827 | + $valueClass = $namespace.'Value'; |
|
828 | 828 | |
829 | 829 | $encoder = new $encoderClass(); |
830 | 830 | $encodeOptions = array(); |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | } |
848 | 848 | |
849 | 849 | $xmlrpcArgs = array(); |
850 | - foreach($currentArgs as $i => $arg) { |
|
850 | + foreach ($currentArgs as $i => $arg) { |
|
851 | 851 | if ($i == $maxArgs) { |
852 | 852 | break; |
853 | 853 | } |
@@ -895,13 +895,13 @@ discard block |
||
895 | 895 | * @param string $mDesc |
896 | 896 | * @return string[] keys: source, docstring |
897 | 897 | */ |
898 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
898 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
899 | 899 | { |
900 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
900 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
901 | 901 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
902 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
903 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
904 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
902 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
903 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
904 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
905 | 905 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
906 | 906 | if (isset($extraOptions['return_on_fault'])) { |
907 | 907 | $decodeFault = true; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | $namespace = '\\PhpXmlRpc\\'; |
915 | 915 | |
916 | 916 | $code = "function $newFuncName ("; |
917 | - if ($clientCopyMode < 2) { |
|
917 | + if ($clientCopyMode<2) { |
|
918 | 918 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
919 | 919 | $verbatimClientCopy = !$clientCopyMode; |
920 | 920 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | |
930 | 930 | if ($mDesc != '') { |
931 | 931 | // take care that PHP comment is not terminated unwillingly by method description |
932 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
932 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
933 | 933 | } else { |
934 | 934 | $mDesc = "/**\nFunction $newFuncName\n"; |
935 | 935 | } |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
939 | 939 | $plist = array(); |
940 | 940 | $pCount = count($mSig); |
941 | - for ($i = 1; $i < $pCount; $i++) { |
|
941 | + for ($i = 1; $i<$pCount; $i++) { |
|
942 | 942 | $plist[] = "\$p$i"; |
943 | 943 | $pType = $mSig[$i]; |
944 | 944 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -954,19 +954,19 @@ discard block |
||
954 | 954 | } |
955 | 955 | } |
956 | 956 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
957 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
957 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
958 | 958 | } |
959 | - if ($clientCopyMode < 2) { |
|
959 | + if ($clientCopyMode<2) { |
|
960 | 960 | $plist[] = '$debug=0'; |
961 | 961 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
962 | 962 | } |
963 | 963 | $plist = implode(', ', $plist); |
964 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
964 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
965 | 965 | |
966 | 966 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
967 | 967 | if ($decodeFault) { |
968 | 968 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
969 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
969 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
970 | 970 | } else { |
971 | 971 | $respCode = var_export($faultResponse, true); |
972 | 972 | } |
@@ -979,7 +979,7 @@ discard block |
||
979 | 979 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
980 | 980 | } |
981 | 981 | |
982 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
982 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
983 | 983 | |
984 | 984 | return array('source' => $code, 'docstring' => $mDesc); |
985 | 985 | } |
@@ -1005,23 +1005,23 @@ discard block |
||
1005 | 1005 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1006 | 1006 | { |
1007 | 1007 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1008 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1008 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1009 | 1009 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1010 | 1010 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1011 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1012 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1011 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1012 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1013 | 1013 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1014 | 1014 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1015 | 1015 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1016 | 1016 | $namespace = '\\PhpXmlRpc\\'; |
1017 | 1017 | |
1018 | - $reqClass = $namespace . 'Request'; |
|
1019 | - $decoderClass = $namespace . 'Encoder'; |
|
1018 | + $reqClass = $namespace.'Request'; |
|
1019 | + $decoderClass = $namespace.'Encoder'; |
|
1020 | 1020 | |
1021 | 1021 | $req = new $reqClass('system.listMethods'); |
1022 | 1022 | $response = $client->send($req, $timeout, $protocol); |
1023 | 1023 | if ($response->faultCode()) { |
1024 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1024 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1025 | 1025 | |
1026 | 1026 | return false; |
1027 | 1027 | } else { |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | $mList = $decoder->decode($mList); |
1032 | 1032 | } |
1033 | 1033 | if (!is_array($mList) || !count($mList)) { |
1034 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1034 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1035 | 1035 | |
1036 | 1036 | return false; |
1037 | 1037 | } else { |
@@ -1039,8 +1039,8 @@ discard block |
||
1039 | 1039 | if ($newClassName != '') { |
1040 | 1040 | $xmlrpcClassName = $newClassName; |
1041 | 1041 | } else { |
1042 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1043 | - array('_', ''), $client->server) . '_client'; |
|
1042 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1043 | + array('_', ''), $client->server).'_client'; |
|
1044 | 1044 | } |
1045 | 1045 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1046 | 1046 | $xmlrpcClassName .= 'x'; |
@@ -1071,20 +1071,20 @@ discard block |
||
1071 | 1071 | if (!$buildIt) { |
1072 | 1072 | $source .= $methodWrap['docstring']; |
1073 | 1073 | } |
1074 | - $source .= $methodWrap['source'] . "\n"; |
|
1074 | + $source .= $methodWrap['source']."\n"; |
|
1075 | 1075 | } else { |
1076 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1076 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | $source .= "}\n"; |
1081 | 1081 | if ($buildIt) { |
1082 | 1082 | $allOK = 0; |
1083 | - eval($source . '$allOK=1;'); |
|
1083 | + eval($source.'$allOK=1;'); |
|
1084 | 1084 | if ($allOK) { |
1085 | 1085 | return $xmlrpcClassName; |
1086 | 1086 | } else { |
1087 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1087 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1088 | 1088 | return false; |
1089 | 1089 | } |
1090 | 1090 | } else { |
@@ -1105,10 +1105,10 @@ discard block |
||
1105 | 1105 | * |
1106 | 1106 | * @return string |
1107 | 1107 | */ |
1108 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1108 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1109 | 1109 | { |
1110 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1111 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1110 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1111 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1112 | 1112 | |
1113 | 1113 | // copy all client fields to the client that will be generated runtime |
1114 | 1114 | // (this provides for future expansion or subclassing of client obj) |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - if (is_file($file = __DIR__ . str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
32 | + if (is_file($file = __DIR__.str_replace(array('PhpXmlRpc\\', '\\'), '/', $class).'.php')) { |
|
33 | 33 | require $file; |
34 | 34 | } |
35 | 35 | } |
@@ -141,9 +141,9 @@ |
||
141 | 141 | * @deprecated |
142 | 142 | */ |
143 | 143 | function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName, |
144 | - $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
145 | - $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
146 | - $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
144 | + $mSig, $mDesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc', |
|
145 | + $decodePhpObjects = false, $encodePhpObjects = false, $decodeFault = false, |
|
146 | + $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
|
147 | 147 | { |
148 | 148 | $code = "function $xmlrpcFuncName ("; |
149 | 149 | if ($clientCopyMode < 2) { |
@@ -41,10 +41,10 @@ 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 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
47 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
48 | 48 | // backwards compat: return string instead of callable |
49 | 49 | $extraOptions['return_source'] = true; |
50 | 50 | $wrapped = $wrapper->wrapPhpFunction($funcName, $newFuncName, $extraOptions); |
@@ -64,17 +64,17 @@ 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; |
71 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
71 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
72 | 72 | // backwards compat: return string instead of callable |
73 | 73 | $extraOptions['return_source'] = true; |
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 | { |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $wrapper = new PhpXmlRpc\Wrapper(); |
110 | 110 | |
111 | - if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
111 | + if (!isset($extraOptions['return_source']) || $extraOptions['return_source'] == false) { |
|
112 | 112 | // backwards compat: return string instead of callable |
113 | 113 | $extraOptions['return_source'] = true; |
114 | 114 | $wrapped = $wrapper->wrapXmlrpcMethod($client, $methodName, $extraOptions); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param array $extraOptions |
127 | 127 | * @return mixed |
128 | 128 | */ |
129 | -function wrap_xmlrpc_server($client, $extraOptions=array()) |
|
129 | +function wrap_xmlrpc_server($client, $extraOptions = array()) |
|
130 | 130 | { |
131 | 131 | $wrapper = new PhpXmlRpc\Wrapper(); |
132 | 132 | return $wrapper->wrapXmlrpcServer($client, $extraOptions); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $faultResponse = '', $namespace = '\\PhpXmlRpc\\') |
147 | 147 | { |
148 | 148 | $code = "function $xmlrpcFuncName ("; |
149 | - if ($clientCopyMode < 2) { |
|
149 | + if ($clientCopyMode<2) { |
|
150 | 150 | // client copy mode 0 or 1 == partial / full client copy in emitted code |
151 | 151 | $innerCode = build_client_wrapper_code($client, $clientCopyMode, $prefix, $namespace); |
152 | 152 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | if ($mDesc != '') { |
162 | 162 | // take care that PHP comment is not terminated unwillingly by method description |
163 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
163 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
164 | 164 | } else { |
165 | 165 | $mDesc = "/**\nFunction $xmlrpcFuncName\n"; |
166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
170 | 170 | $plist = array(); |
171 | 171 | $pCount = count($mSig); |
172 | - for ($i = 1; $i < $pCount; $i++) { |
|
172 | + for ($i = 1; $i<$pCount; $i++) { |
|
173 | 173 | $plist[] = "\$p$i"; |
174 | 174 | $pType = $mSig[$i]; |
175 | 175 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
188 | - $mDesc .= '* @param ' . xmlrpc_2_php_type($pType) . " \$p$i\n"; |
|
188 | + $mDesc .= '* @param '.xmlrpc_2_php_type($pType)." \$p$i\n"; |
|
189 | 189 | } |
190 | - if ($clientCopyMode < 2) { |
|
190 | + if ($clientCopyMode<2) { |
|
191 | 191 | $plist[] = '$debug=0'; |
192 | 192 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
193 | 193 | } |
194 | 194 | $plist = implode(', ', $plist); |
195 | - $mDesc .= '* @return ' . xmlrpc_2_php_type($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
195 | + $mDesc .= '* @return '.xmlrpc_2_php_type($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
196 | 196 | |
197 | 197 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
198 | 198 | if ($decodeFault) { |
199 | 199 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
200 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
200 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
201 | 201 | } else { |
202 | 202 | $respCode = var_export($faultResponse, true); |
203 | 203 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
211 | 211 | } |
212 | 212 | |
213 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
213 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
214 | 214 | |
215 | 215 | return array('source' => $code, 'docstring' => $mDesc); |
216 | 216 | } |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * @deprecated |
220 | 220 | */ |
221 | -function build_client_wrapper_code($client, $verbatim_client_copy, $prefix='xmlrpc') |
|
221 | +function build_client_wrapper_code($client, $verbatim_client_copy, $prefix = 'xmlrpc') |
|
222 | 222 | { |
223 | 223 | $code = "\$client = new {$prefix}_client('".str_replace("'", "\'", $client->path). |
224 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
224 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
225 | 225 | |
226 | 226 | // copy all client fields to the client that will be generated runtime |
227 | 227 | // (this provides for future expansion or subclassing of client obj) |
228 | 228 | if ($verbatim_client_copy) |
229 | 229 | { |
230 | - foreach($client as $fld => $val) |
|
230 | + foreach ($client as $fld => $val) |
|
231 | 231 | { |
232 | - if($fld != 'debug' && $fld != 'return_type') |
|
232 | + if ($fld != 'debug' && $fld != 'return_type') |
|
233 | 233 | { |
234 | 234 | $val = var_export($val, true); |
235 | 235 | $code .= "\$client->$fld = $val;\n"; |
@@ -39,10 +39,10 @@ |
||
39 | 39 | $flags = ENT_COMPAT; |
40 | 40 | // avoid warnings on php < 5.4... |
41 | 41 | if (defined('ENT_HTML401')) { |
42 | - $flags = $flags | ENT_HTML401; |
|
42 | + $flags = $flags | ENT_HTML401; |
|
43 | 43 | } |
44 | 44 | if (defined('ENT_SUBSTITUTE')) { |
45 | - $flags = $flags | ENT_SUBSTITUTE; |
|
45 | + $flags = $flags | ENT_SUBSTITUTE; |
|
46 | 46 | } |
47 | 47 | if ($encoding != null) { |
48 | 48 | print "<PRE>\n".htmlentities($message, $flags, $encoding)."\n</PRE>"; |
@@ -117,35 +117,35 @@ |
||
117 | 117 | public function serialize($charsetEncoding = '') |
118 | 118 | { |
119 | 119 | if ($charsetEncoding != '') { |
120 | - $this->content_type = 'text/xml; charset=' . $charsetEncoding; |
|
120 | + $this->content_type = 'text/xml; charset='.$charsetEncoding; |
|
121 | 121 | } else { |
122 | 122 | $this->content_type = 'text/xml'; |
123 | 123 | } |
124 | 124 | if (PhpXmlRpc::$xmlrpc_null_apache_encoding) { |
125 | - $result = "<methodResponse xmlns:ex=\"" . PhpXmlRpc::$xmlrpc_null_apache_encoding_ns . "\">\n"; |
|
125 | + $result = "<methodResponse xmlns:ex=\"".PhpXmlRpc::$xmlrpc_null_apache_encoding_ns."\">\n"; |
|
126 | 126 | } else { |
127 | 127 | $result = "<methodResponse>\n"; |
128 | 128 | } |
129 | 129 | if ($this->errno) { |
130 | 130 | // Let non-ASCII response messages be tolerated by clients by xml-encoding non ascii chars |
131 | - $result .= "<fault>\n" . |
|
132 | - "<value>\n<struct><member><name>faultCode</name>\n<value><int>" . $this->errno . |
|
133 | - "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" . |
|
134 | - Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</string></value>\n</member>\n" . |
|
131 | + $result .= "<fault>\n". |
|
132 | + "<value>\n<struct><member><name>faultCode</name>\n<value><int>".$this->errno. |
|
133 | + "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>". |
|
134 | + Charset::instance()->encodeEntities($this->errstr, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding)."</string></value>\n</member>\n". |
|
135 | 135 | "</struct>\n</value>\n</fault>"; |
136 | 136 | } else { |
137 | 137 | if (!is_object($this->val) || !is_a($this->val, 'PhpXmlRpc\Value')) { |
138 | 138 | if (is_string($this->val) && $this->valtyp == 'xml') { |
139 | - $result .= "<params>\n<param>\n" . |
|
140 | - $this->val . |
|
139 | + $result .= "<params>\n<param>\n". |
|
140 | + $this->val. |
|
141 | 141 | "</param>\n</params>"; |
142 | 142 | } else { |
143 | 143 | /// @todo try to build something serializable? |
144 | 144 | throw new \Exception('cannot serialize xmlrpc response objects whose content is native php values'); |
145 | 145 | } |
146 | 146 | } else { |
147 | - $result .= "<params>\n<param>\n" . |
|
148 | - $this->val->serialize($charsetEncoding) . |
|
147 | + $result .= "<params>\n<param>\n". |
|
148 | + $this->val->serialize($charsetEncoding). |
|
149 | 149 | "</param>\n</params>"; |
150 | 150 | } |
151 | 151 | } |