Passed
Push — master ( be282f...ae5a85 )
by Gaetano
08:11
created
demo/server/server.php 2 patches
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,11 +209,12 @@
 block discarded – undo
209 209
     $a = $req->getParam(0);
210 210
     $b = $req->getParam(1);
211 211
 
212
-    if ($a->scalartyp() == Value::$xmlrpcNull)
213
-        return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval())));
214
-    else
215
-        return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval())));
216
-}
212
+    if ($a->scalartyp() == Value::$xmlrpcNull) {
213
+            return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval())));
214
+    } else {
215
+            return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval())));
216
+    }
217
+    }
217 218
 
218 219
 $addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt));
219 220
 $addtwo_doc = 'Add two integers together and return the result';
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * Please do not copy this file verbatim into your production server.
10 10
  **/
11 11
 
12
-require_once __DIR__ . "/_bootstrap.php";
12
+require_once __DIR__."/_bootstrap.php";
13 13
 
14 14
 // out-of-band information: let the client manipulate the server operations.
15 15
 // we do this to help the testsuite script: do not reproduce in production!
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
20 20
     }
21 21
 
22
-    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php";
22
+    include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php";
23 23
 }
24 24
 
25 25
 use PhpXmlRpc\Value;
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
     // extract the value of the state number
117 117
     $snv = $sno->scalarval();
118 118
     // look it up in our array (zero-based)
119
-    if (isset($stateNames[$snv - 1])) {
120
-        $stateName = $stateNames[$snv - 1];
119
+    if (isset($stateNames[$snv-1])) {
120
+        $stateName = $stateNames[$snv-1];
121 121
     } else {
122 122
         // not there, so complain
123
-        $err = "I don't have a state for the index '" . $snv . "'";
123
+        $err = "I don't have a state for the index '".$snv."'";
124 124
     }
125 125
 
126 126
     // if we generated an error, create an error return response
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
 {
147 147
     global $stateNames;
148 148
 
149
-    if (isset($stateNames[$stateNo - 1])) {
150
-        return $stateNames[$stateNo - 1];
149
+    if (isset($stateNames[$stateNo-1])) {
150
+        return $stateNames[$stateNo-1];
151 151
     } else {
152 152
         // not, there so complain
153
-        throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
153
+        throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
154 154
     }
155 155
 }
156 156
 
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 eval($findstate9_sig['source']);
181 181
 
182 182
 $findstate10_sig = array(
183
-    "function" => function ($req) { return findState($req); },
183
+    "function" => function($req) { return findState($req); },
184 184
     "signature" => $findstate_sig,
185 185
     "docstring" => $findstate_doc,
186 186
 );
187 187
 
188
-$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return inner_findstate($stateNo); });
188
+$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return inner_findstate($stateNo); });
189 189
 
190 190
 $c = new xmlrpcServerMethodsContainer;
191 191
 $moreSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'tests.', 'method_type' => 'all'));
192 192
 
193
-$returnObj_sig =  $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
193
+$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true));
194 194
 
195 195
 // used to test signatures with NULL params
196 196
 $findstate12_sig = array(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
     $s = $req->getParam(0);
217 217
     $t = $req->getParam(1);
218 218
 
219
-    return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt));
219
+    return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt));
220 220
 }
221 221
 
222 222
 $addtwodouble_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble, Value::$xmlrpcDouble));
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     $s = $req->getParam(0);
227 227
     $t = $req->getParam(1);
228 228
 
229
-    return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble));
229
+    return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble));
230 230
 }
231 231
 
232 232
 $stringecho_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString));
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 function echoBack($req)
243 243
 {
244 244
     // just sends back a string with what i got sent to me, just escaped, that's all
245
-    $s = "I got the following message:\n" . $req->serialize();
245
+    $s = "I got the following message:\n".$req->serialize();
246 246
 
247 247
     return new PhpXmlRpc\Response(new Value($s));
248 248
 }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         return 0;
300 300
     }
301 301
 
302
-    return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
302
+    return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1;
303 303
 }
304 304
 
305 305
 $agesorter_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     // hack, must make global as uksort() won't
346 346
     // allow us to pass any other auxiliary information
347 347
     uksort($agesorter_arr, 'agesorter_compare');
348
-    foreach($agesorter_arr as $key => $val) {
348
+    foreach ($agesorter_arr as $key => $val) {
349 349
         // recreate each struct element
350 350
         $v[] = new Value(
351 351
             array(
@@ -400,17 +400,17 @@  discard block
 block discarded – undo
400 400
         $err = "Error, no 'From' field specified";
401 401
     }
402 402
 
403
-    $msgHdr = "From: " . $mFrom->scalarval() . "\n";
404
-    $msgHdr .= "To: " . $mTo->scalarval() . "\n";
403
+    $msgHdr = "From: ".$mFrom->scalarval()."\n";
404
+    $msgHdr .= "To: ".$mTo->scalarval()."\n";
405 405
 
406 406
     if ($mCc->scalarval() != "") {
407
-        $msgHdr .= "Cc: " . $mCc->scalarval() . "\n";
407
+        $msgHdr .= "Cc: ".$mCc->scalarval()."\n";
408 408
     }
409 409
     if ($mBcc->scalarval() != "") {
410
-        $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n";
410
+        $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n";
411 411
     }
412 412
     if ($mMime->scalarval() != "") {
413
-        $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n";
413
+        $msgHdr .= "Content-type: ".$mMime->scalarval()."\n";
414 414
     }
415 415
     $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
416 416
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     $moe = $sno["moe"];
501 501
     $larry = $sno["larry"];
502 502
     $curly = $sno["curly"];
503
-    $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval();
503
+    $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval();
504 504
 
505 505
     return new PhpXmlRpc\Response(new Value($num, Value::$xmlrpcInt));
506 506
 }
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
     $ar = $req->getParam(0);
543 543
     $sz = $ar->count();
544 544
     $first = $ar[0];
545
-    $last = $ar[$sz - 1];
545
+    $last = $ar[$sz-1];
546 546
 
547
-    return new PhpXmlRpc\Response(new Value($first->scalarval() .
547
+    return new PhpXmlRpc\Response(new Value($first->scalarval().
548 548
         $last->scalarval(), Value::$xmlrpcString));
549 549
 }
550 550
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     $larry = $fools["larry"];
579 579
     $moe = $fools["moe"];
580 580
 
581
-    return new PhpXmlRpc\Response(new Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), Value::$xmlrpcInt));
581
+    return new PhpXmlRpc\Response(new Value($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), Value::$xmlrpcInt));
582 582
 }
583 583
 
584 584
 $v1_countTheEntities_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcString));
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     $ap = 0;
593 593
     $qu = 0;
594 594
     $amp = 0;
595
-    for ($i = 0; $i < strlen($str); $i++) {
595
+    for ($i = 0; $i<strlen($str); $i++) {
596 596
         $c = substr($str, $i, 1);
597 597
         switch ($c) {
598 598
             case ">":
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
     ),
795 795
     // Greek word 'kosme'. NB: NOT a valid ISO8859 string!
796 796
     // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods
797
-    "tests.utf8methodname." . 'κόσμε' => array(
797
+    "tests.utf8methodname.".'κόσμε' => array(
798 798
         "function" => "stringEcho",
799 799
         "signature" => $stringecho_sig,
800 800
         "docstring" => $stringecho_doc,
@@ -990,5 +990,5 @@  discard block
 block discarded – undo
990 990
 // Out-of-band information: let the client manipulate the server operations.
991 991
 // We do this to help the testsuite script: do not reproduce in production!
992 992
 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
993
-    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
993
+    include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
994 994
 }
Please login to merge, or discard this patch.
src/Wrapper.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -561,8 +561,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
             $callable = explode('::', $callable);
160 160
         }
161 161
         if (is_array($callable)) {
162
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
162
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
164 164
                 return false;
165 165
             }
166 166
             if (is_string($callable[0])) {
167 167
                 $plainFuncName = implode('::', $callable);
168 168
             } elseif (is_object($callable[0])) {
169
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
169
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
170 170
             }
171 171
             $exists = method_exists($callable[0], $callable[1]);
172 172
         } else if ($callable instanceof \Closure) {
173 173
             // we do not support creating code which wraps closures, as php does not allow to serialize them
174 174
             if (!$buildIt) {
175
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
175
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
176 176
                 return false;
177 177
             }
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         if (!$exists) {
187
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
187
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
188 188
             return false;
189 189
         }
190 190
 
@@ -228,23 +228,23 @@  discard block
 block discarded – undo
228 228
         if (is_array($callable)) {
229 229
             $func = new \ReflectionMethod($callable[0], $callable[1]);
230 230
             if ($func->isPrivate()) {
231
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
231
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
232 232
                 return false;
233 233
             }
234 234
             if ($func->isProtected()) {
235
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
235
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
236 236
                 return false;
237 237
             }
238 238
             if ($func->isConstructor()) {
239
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
239
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
240 240
                 return false;
241 241
             }
242 242
             if ($func->isDestructor()) {
243
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
243
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
244 244
                 return false;
245 245
             }
246 246
             if ($func->isAbstract()) {
247
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
247
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
248 248
                 return false;
249 249
             }
250 250
             /// @todo add more checks for static vs. nonstatic?
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         if ($func->isInternal()) {
255 255
             // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
256 256
             // instead of getparameters to fully reflect internal php functions ?
257
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
257
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
258 258
             return false;
259 259
         }
260 260
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         $i = 0;
307 307
         foreach ($func->getParameters() as $paramObj) {
308 308
             $params[$i] = array();
309
-            $params[$i]['name'] = '$' . $paramObj->getName();
309
+            $params[$i]['name'] = '$'.$paramObj->getName();
310 310
             $params[$i]['isoptional'] = $paramObj->isOptional();
311 311
             $i++;
312 312
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             // build a signature
372 372
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
373 373
             $pSig = array($funcDesc['returnsDocs']);
374
-            for ($i = 0; $i < count($pars); $i++) {
374
+            for ($i = 0; $i<count($pars); $i++) {
375 375
                 $name = strtolower($funcDesc['params'][$i]['name']);
376 376
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
377 377
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                 }
427 427
             }
428 428
             $numPars = $req->getNumParams();
429
-            if ($numPars < $minPars || $numPars > $maxPars) {
429
+            if ($numPars<$minPars || $numPars>$maxPars) {
430 430
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
431 431
             }
432 432
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
             $result = call_user_func_array($callable, $params);
441 441
 
442
-            if (! is_a($result, $responseClass)) {
442
+            if (!is_a($result, $responseClass)) {
443 443
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
444 444
                     $result = new $valueClass($result, $funcDesc['returns']);
445 445
                 } else {
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
         if ($newFuncName == '') {
475 475
             if (is_array($callable)) {
476 476
                 if (is_string($callable[0])) {
477
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
477
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
478 478
                 } else {
479
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
479
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
480 480
                 }
481 481
             } else {
482 482
                 if ($callable instanceof \Closure) {
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
     {
513 513
         $namespace = '\\PhpXmlRpc\\';
514 514
 
515
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
516
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
515
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
516
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
517 517
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
518 518
 
519 519
         $i = 0;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         // build body of new function
549 549
 
550 550
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
551
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
551
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
552 552
 
553 553
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
554 554
         if ($decodePhpObjects) {
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
         if (is_array($callable) && is_object($callable[0])) {
563 563
             self::$objHolder[$newFuncName] = $callable[0];
564 564
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
565
-            $realFuncName = '$obj->' . $callable[1];
565
+            $realFuncName = '$obj->'.$callable[1];
566 566
         } else {
567 567
             $realFuncName = $plainFuncName;
568 568
         }
569 569
         foreach ($parsVariations as $i => $pars) {
570
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
571
-            if ($i < (count($parsVariations) - 1))
570
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
571
+            if ($i<(count($parsVariations)-1))
572 572
                 $innerCode .= "else\n";
573 573
         }
574 574
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         // if($func->returnsReference())
586 586
         //     return false;
587 587
 
588
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
588
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
589 589
 
590 590
         return $code;
591 591
     }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                         if ($methodWrap) {
623 623
                             if (is_object($className)) {
624 624
                                 $realClassName = get_class($className);
625
-                            }else {
625
+                            } else {
626 626
                                 $realClassName = $className;
627 627
                             }
628 628
                             $results[$prefix."$realClassName.$mName"] = $methodWrap;
@@ -723,21 +723,21 @@  discard block
 block discarded – undo
723 723
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
724 724
     {
725 725
         $namespace = '\\PhpXmlRpc\\';
726
-        $reqClass = $namespace . 'Request';
727
-        $valClass = $namespace . 'Value';
728
-        $decoderClass = $namespace . 'Encoder';
726
+        $reqClass = $namespace.'Request';
727
+        $valClass = $namespace.'Value';
728
+        $decoderClass = $namespace.'Encoder';
729 729
 
730 730
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
731
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
731
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
732 732
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
733
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
733
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
734 734
 
735 735
         $req = new $reqClass('system.methodSignature');
736 736
         $req->addparam(new $valClass($methodName));
737 737
         $client->setDebug($debug);
738 738
         $response = $client->send($req, $timeout, $protocol);
739 739
         if ($response->faultCode()) {
740
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
740
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
741 741
             return false;
742 742
         }
743 743
 
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
             $mSig = $decoder->decode($mSig);
748 748
         }
749 749
 
750
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
751
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
750
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
751
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
752 752
             return false;
753 753
         }
754 754
 
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
765 765
     {
766 766
         $namespace = '\\PhpXmlRpc\\';
767
-        $reqClass = $namespace . 'Request';
768
-        $valClass = $namespace . 'Value';
767
+        $reqClass = $namespace.'Request';
768
+        $valClass = $namespace.'Value';
769 769
 
770 770
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
771
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
771
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
772 772
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
773 773
 
774 774
         $mDesc = '';
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
         $clientClone = clone $client;
803 803
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
804 804
         {
805
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
805
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
806 806
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
807
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
808
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
807
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
808
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
809 809
             if (isset($extraOptions['return_on_fault'])) {
810 810
                 $decodeFault = true;
811 811
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -814,9 +814,9 @@  discard block
 block discarded – undo
814 814
             }
815 815
 
816 816
             $namespace = '\\PhpXmlRpc\\';
817
-            $reqClass = $namespace . 'Request';
818
-            $encoderClass = $namespace . 'Encoder';
819
-            $valueClass = $namespace . 'Value';
817
+            $reqClass = $namespace.'Request';
818
+            $encoderClass = $namespace.'Encoder';
819
+            $valueClass = $namespace.'Value';
820 820
 
821 821
             $encoder = new $encoderClass();
822 822
             $encodeOptions = array();
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
             }
840 840
 
841 841
             $xmlrpcArgs = array();
842
-            foreach($currentArgs as $i => $arg) {
842
+            foreach ($currentArgs as $i => $arg) {
843 843
                 if ($i == $maxArgs) {
844 844
                     break;
845 845
                 }
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
      * @param string $mDesc
888 888
      * @return string[] keys: source, docstring
889 889
      */
890
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
890
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
891 891
     {
892
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
892
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
893 893
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
894
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
895
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
896
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
894
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
895
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
896
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
897 897
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
898 898
         if (isset($extraOptions['return_on_fault'])) {
899 899
             $decodeFault = true;
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
         $namespace = '\\PhpXmlRpc\\';
907 907
 
908 908
         $code = "function $newFuncName (";
909
-        if ($clientCopyMode < 2) {
909
+        if ($clientCopyMode<2) {
910 910
             // client copy mode 0 or 1 == full / partial client copy in emitted code
911 911
             $verbatimClientCopy = !$clientCopyMode;
912 912
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 
922 922
         if ($mDesc != '') {
923 923
             // take care that PHP comment is not terminated unwillingly by method description
924
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
924
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
925 925
         } else {
926 926
             $mDesc = "/**\nFunction $newFuncName\n";
927 927
         }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
931 931
         $plist = array();
932 932
         $pCount = count($mSig);
933
-        for ($i = 1; $i < $pCount; $i++) {
933
+        for ($i = 1; $i<$pCount; $i++) {
934 934
             $plist[] = "\$p$i";
935 935
             $pType = $mSig[$i];
936 936
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -946,19 +946,19 @@  discard block
 block discarded – undo
946 946
                 }
947 947
             }
948 948
             $innerCode .= "\$req->addparam(\$p$i);\n";
949
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
949
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
950 950
         }
951
-        if ($clientCopyMode < 2) {
951
+        if ($clientCopyMode<2) {
952 952
             $plist[] = '$debug=0';
953 953
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
954 954
         }
955 955
         $plist = implode(', ', $plist);
956
-        $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n";
956
+        $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n";
957 957
 
958 958
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
959 959
         if ($decodeFault) {
960 960
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
961
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
961
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
962 962
             } else {
963 963
                 $respCode = var_export($faultResponse, true);
964 964
             }
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
972 972
         }
973 973
 
974
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
974
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
975 975
 
976 976
         return array('source' => $code, 'docstring' => $mDesc);
977 977
     }
@@ -997,23 +997,23 @@  discard block
 block discarded – undo
997 997
     public function wrapXmlrpcServer($client, $extraOptions = array())
998 998
     {
999 999
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1000
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1000
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1001 1001
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1002 1002
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1003
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1004
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1003
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1004
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1005 1005
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1006 1006
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1007 1007
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1008 1008
         $namespace = '\\PhpXmlRpc\\';
1009 1009
 
1010
-        $reqClass = $namespace . 'Request';
1011
-        $decoderClass = $namespace . 'Encoder';
1010
+        $reqClass = $namespace.'Request';
1011
+        $decoderClass = $namespace.'Encoder';
1012 1012
 
1013 1013
         $req = new $reqClass('system.listMethods');
1014 1014
         $response = $client->send($req, $timeout, $protocol);
1015 1015
         if ($response->faultCode()) {
1016
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1016
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1017 1017
 
1018 1018
             return false;
1019 1019
         } else {
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
                 $mList = $decoder->decode($mList);
1024 1024
             }
1025 1025
             if (!is_array($mList) || !count($mList)) {
1026
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1026
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1027 1027
 
1028 1028
                 return false;
1029 1029
             } else {
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
                 if ($newClassName != '') {
1032 1032
                     $xmlrpcClassName = $newClassName;
1033 1033
                 } else {
1034
-                    $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
-                            array('_', ''), $client->server) . '_client';
1034
+                    $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
+                            array('_', ''), $client->server).'_client';
1036 1036
                 }
1037 1037
                 while ($buildIt && class_exists($xmlrpcClassName)) {
1038 1038
                     $xmlrpcClassName .= 'x';
@@ -1063,20 +1063,20 @@  discard block
 block discarded – undo
1063 1063
                             if (!$buildIt) {
1064 1064
                                 $source .= $methodWrap['docstring'];
1065 1065
                             }
1066
-                            $source .= $methodWrap['source'] . "\n";
1066
+                            $source .= $methodWrap['source']."\n";
1067 1067
                         } else {
1068
-                            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1068
+                            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1069 1069
                         }
1070 1070
                     }
1071 1071
                 }
1072 1072
                 $source .= "}\n";
1073 1073
                 if ($buildIt) {
1074 1074
                     $allOK = 0;
1075
-                    eval($source . '$allOK=1;');
1075
+                    eval($source.'$allOK=1;');
1076 1076
                     if ($allOK) {
1077 1077
                         return $xmlrpcClassName;
1078 1078
                     } else {
1079
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1079
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1080 1080
                         return false;
1081 1081
                     }
1082 1082
                 } else {
@@ -1097,10 +1097,10 @@  discard block
 block discarded – undo
1097 1097
      *
1098 1098
      * @return string
1099 1099
      */
1100
-    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1100
+    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1101 1101
     {
1102
-        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1103
-            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1102
+        $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path).
1103
+            "', '".str_replace("'", "\'", $client->server)."', $client->port);\n";
1104 1104
 
1105 1105
         // copy all client fields to the client that will be generated runtime
1106 1106
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
src/Autoloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Helper/Date.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
                 // of PHP
33 33
                 $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet);
34 34
             } else {
35
-                $t = strftime("%Y%m%dT%H:%M:%S", $timet - date('Z'));
35
+                $t = strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
36 36
             }
37 37
         }
38 38
 
Please login to merge, or discard this patch.
lib/xmlrpc_wrappers.inc 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,9 +141,9 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.
demo/vardemo.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 <body>
4 4
 <?php
5 5
 
6
-include_once __DIR__ . "/../vendor/autoload.php";
6
+include_once __DIR__."/../vendor/autoload.php";
7 7
 
8 8
 $req = new PhpXmlRpc\Request('examples.getStateName');
9 9
 
10 10
 print "<h3>Testing value serialization</h3>\n";
11 11
 
12 12
 $v = new PhpXmlRpc\Value(23, "int");
13
-print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
13
+print "<PRE>".htmlentities($v->serialize())."</PRE>";
14 14
 $v = new PhpXmlRpc\Value("What are you saying? >> << &&");
15
-print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
15
+print "<PRE>".htmlentities($v->serialize())."</PRE>";
16 16
 
17 17
 $v = new PhpXmlRpc\Value(
18 18
     array(
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     "array"
24 24
 );
25 25
 
26
-print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
26
+print "<PRE>".htmlentities($v->serialize())."</PRE>";
27 27
 
28 28
 $v = new PhpXmlRpc\Value(
29 29
     array(
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     "struct"
52 52
 );
53 53
 
54
-print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
54
+print "<PRE>".htmlentities($v->serialize())."</PRE>";
55 55
 
56 56
 $w = new PhpXmlRpc\Value(array($v, new PhpXmlRpc\Value("That was the struct!")), "array");
57 57
 
58
-print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
58
+print "<PRE>".htmlentities($w->serialize())."</PRE>";
59 59
 
60 60
 $w = new PhpXmlRpc\Value("Mary had a little lamb,
61 61
 Whose fleece was white as snow,
@@ -67,26 +67,26 @@  discard block
 block discarded – undo
67 67
 Ten thousand volts went down its back
68 68
 And turned it into nylon", "base64"
69 69
 );
70
-print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
71
-print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
70
+print "<PRE>".htmlentities($w->serialize())."</PRE>";
71
+print "<PRE>Value of base64 string is: '".$w->scalarval()."'</PRE>";
72 72
 
73 73
 $req->method('');
74 74
 $req->addParam(new PhpXmlRpc\Value("41", "int"));
75 75
 
76 76
 print "<h3>Testing request serialization</h3>\n";
77 77
 $op = $req->serialize();
78
-print "<PRE>" . htmlentities($op) . "</PRE>";
78
+print "<PRE>".htmlentities($op)."</PRE>";
79 79
 
80 80
 print "<h3>Testing ISO date format</h3><pre>\n";
81 81
 
82 82
 $t = time();
83 83
 $date = PhpXmlRpc\Helper\Date::iso8601Encode($t);
84 84
 print "Now is $t --> $date\n";
85
-print "Or in UTC, that is " . PhpXmlRpc\Helper\Date::iso8601Encode($t, 1) . "\n";
85
+print "Or in UTC, that is ".PhpXmlRpc\Helper\Date::iso8601Encode($t, 1)."\n";
86 86
 $tb = PhpXmlRpc\Helper\Date::iso8601Decode($date);
87 87
 print "That is to say $date --> $tb\n";
88
-print "Which comes out at " . PhpXmlRpc\Helper\Date::iso8601Encode($tb) . "\n";
89
-print "Which was the time in UTC at " . PhpXmlRpc\Helper\Date::iso8601Encode($date, 1) . "\n";
88
+print "Which comes out at ".PhpXmlRpc\Helper\Date::iso8601Encode($tb)."\n";
89
+print "Which was the time in UTC at ".PhpXmlRpc\Helper\Date::iso8601Encode($date, 1)."\n";
90 90
 
91 91
 print "</pre>\n";
92 92
 
Please login to merge, or discard this patch.
lib/xmlrpc.inc 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $val = reset($ar);
96 96
         $typ = key($ar);
97 97
 
98
-        return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
98
+        return '<value>'.$this->serializedata($typ, $val)."</value>\n";
99 99
         //}
100 100
     }
101 101
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         // preserve back compatibility
115 115
 
116 116
         if (is_array($b)) {
117
-            foreach($b as $id => $cont) {
117
+            foreach ($b as $id => $cont) {
118 118
                 $b[$id] = $cont->scalarval();
119 119
             }
120 120
         }
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
         // add support for structures directly encoding php objects
123 123
         if (is_object($b)) {
124 124
             $t = get_object_vars($b);
125
-            foreach($t as $id => $cont) {
125
+            foreach ($t as $id => $cont) {
126 126
                 $t[$id] = $cont->scalarval();
127 127
             }
128
-            foreach($t as $id => $cont) {
128
+            foreach ($t as $id => $cont) {
129 129
                 @$b->$id = $cont;
130 130
             }
131 131
         }
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 /* Expose as global functions the ones which are now class methods */
161 161
 
162 162
 /// Wrong speling, but we are adamant on backwards compatibility!
163
-function xmlrpc_encode_entitites($data, $srcEncoding='', $destEncoding='')
163
+function xmlrpc_encode_entitites($data, $srcEncoding = '', $destEncoding = '')
164 164
 {
165 165
     return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding);
166 166
 }
167 167
 
168
-function iso8601_encode($timeT, $utc=0)
168
+function iso8601_encode($timeT, $utc = 0)
169 169
 {
170 170
     return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc);
171 171
 }
172 172
 
173
-function iso8601_decode($iDate, $utc=0)
173
+function iso8601_decode($iDate, $utc = 0)
174 174
 {
175 175
     return PhpXmlRpc\Helper\Date::iso8601Decode($iDate, $utc);
176 176
 }
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
     return PhpXmlRpc\Helper\Http::decodeChunked($buffer);
181 181
 }
182 182
 
183
-function php_xmlrpc_decode($xmlrpcVal, $options=array())
183
+function php_xmlrpc_decode($xmlrpcVal, $options = array())
184 184
 {
185 185
     $encoder = new PhpXmlRpc\Encoder();
186 186
     return $encoder->decode($xmlrpcVal, $options);
187 187
 }
188 188
 
189
-function php_xmlrpc_encode($phpVal, $options=array())
189
+function php_xmlrpc_encode($phpVal, $options = array())
190 190
 {
191 191
     $encoder = new PhpXmlRpc\Encoder();
192 192
     return $encoder->encode($phpVal, $options);
193 193
 }
194 194
 
195
-function php_xmlrpc_decode_xml($xmlVal, $options=array())
195
+function php_xmlrpc_decode_xml($xmlVal, $options = array())
196 196
 {
197 197
     $encoder = new PhpXmlRpc\Encoder();
198 198
     return $encoder->decodeXml($xmlVal, $options);
199 199
 }
200 200
 
201
-function guess_encoding($httpHeader='', $xmlChunk='', $encodingPrefs=null)
201
+function guess_encoding($httpHeader = '', $xmlChunk = '', $encodingPrefs = null)
202 202
 {
203 203
     return PhpXmlRpc\Helper\XMLParser::guessEncoding($httpHeader, $xmlChunk, $encodingPrefs);
204 204
 }
Please login to merge, or discard this patch.
tests/4LocalhostMultiTest.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/3LocalhostTest.php';
8
+include_once __DIR__.'/3LocalhostTest.php';
9 9
 
10 10
 /**
11 11
  * Tests which stress http features of the library.
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
         );
28 28
 
29 29
         $methods = array();
30
-        foreach(get_class_methods('LocalhostTest') as $method)
30
+        foreach (get_class_methods('LocalhostTest') as $method)
31 31
         {
32
-            if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
32
+            if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
33 33
             {
34 34
                 if (!isset(self::$failed_tests[$method])) {
35 35
                     $methods[$method] = array($method);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function testDeflate($method)
48 48
     {
49
-        if(!function_exists('gzdeflate'))
49
+        if (!function_exists('gzdeflate'))
50 50
         {
51 51
             $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
52 52
             return;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function testGzip($method)
66 66
     {
67
-        if(!function_exists('gzdeflate'))
67
+        if (!function_exists('gzdeflate'))
68 68
         {
69 69
             $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
70 70
             return;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     public function testKeepAlives()
80 80
     {
81
-        if(!function_exists('curl_init'))
81
+        if (!function_exists('curl_init'))
82 82
         {
83 83
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
84 84
             return;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function testHttp11($method)
120 120
     {
121
-        if(!function_exists('curl_init'))
121
+        if (!function_exists('curl_init'))
122 122
         {
123 123
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
124 124
             return;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function testHttp10Curl($method)
139 139
     {
140
-        if(!function_exists('curl_init'))
140
+        if (!function_exists('curl_init'))
141 141
         {
142 142
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
143 143
             return;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function testHttp11Gzip($method)
159 159
     {
160
-        if(!function_exists('curl_init'))
160
+        if (!function_exists('curl_init'))
161 161
         {
162 162
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
163 163
             return;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function testHttp11Deflate($method)
179 179
     {
180
-        if(!function_exists('curl_init'))
180
+        if (!function_exists('curl_init'))
181 181
         {
182 182
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
183 183
             return;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function testHttp11Proxy($method)
199 199
     {
200
-        if(!function_exists('curl_init'))
200
+        if (!function_exists('curl_init'))
201 201
         {
202 202
             $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
203 203
             return;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function testHttps($method)
224 224
     {
225
-        if(!function_exists('curl_init'))
225
+        if (!function_exists('curl_init'))
226 226
         {
227 227
             $this->markTestSkipped('CURL missing: cannot test https functionality');
228 228
             return;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
      */
275 275
     public function testHttpsProxy($method)
276 276
     {
277
-        if(!function_exists('curl_init'))
277
+        if (!function_exists('curl_init'))
278 278
         {
279 279
             $this->markTestSkipped('CURL missing: cannot test https w. proxy');
280 280
             return;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -201,8 +201,7 @@  discard block
 block discarded – undo
201 201
         {
202 202
             $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
203 203
             return;
204
-        }
205
-        else if ($this->args['PROXYSERVER'] == '')
204
+        } else if ($this->args['PROXYSERVER'] == '')
206 205
         {
207 206
             $this->markTestSkipped('PROXYSERVER definition missing: cannot test proxy w. http 1.1');
208 207
             return;
@@ -226,8 +225,7 @@  discard block
 block discarded – undo
226 225
         {
227 226
             $this->markTestSkipped('CURL missing: cannot test https functionality');
228 227
             return;
229
-        }
230
-        else if ($this->args['HTTPSSERVER'] == '')
228
+        } else if ($this->args['HTTPSSERVER'] == '')
231 229
         {
232 230
             $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https');
233 231
             return;
@@ -278,13 +276,11 @@  discard block
 block discarded – undo
278 276
         {
279 277
             $this->markTestSkipped('CURL missing: cannot test https w. proxy');
280 278
             return;
281
-        }
282
-        else if ($this->args['PROXYSERVER'] == '')
279
+        } else if ($this->args['PROXYSERVER'] == '')
283 280
         {
284 281
             $this->markTestSkipped('PROXYSERVER definition missing: cannot test proxy w. https');
285 282
             return;
286
-        }
287
-        else if ($this->args['HTTPSSERVER'] == '')
283
+        } else if ($this->args['HTTPSSERVER'] == '')
288 284
         {
289 285
             $this->markTestSkipped('HTTPS SERVER definition missing: cannot test https w. proxy');
290 286
             return;
Please login to merge, or discard this patch.
lib/xmlrpcs.inc 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function echoInput()
54 54
     {
55
-        $r = new PhpXmlRpc\Response(new PhpXmlRpc\Value("'Aha said I: '" . file_get_contents('php://input'), 'string'));
55
+        $r = new PhpXmlRpc\Response(new PhpXmlRpc\Value("'Aha said I: '".file_get_contents('php://input'), 'string'));
56 56
         print $r->serialize();
57 57
     }
58 58
 }
@@ -68,30 +68,30 @@  discard block
 block discarded – undo
68 68
     PhpXmlRpc\Server::xmlrpc_debugmsg($m);
69 69
 }
70 70
 
71
-function _xmlrpcs_getCapabilities($server, $m=null)
71
+function _xmlrpcs_getCapabilities($server, $m = null)
72 72
 {
73 73
     return PhpXmlRpc\Server::_xmlrpcs_getCapabilities($server, $m);
74 74
 }
75 75
 
76
-$_xmlrpcs_listMethods_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray));
77
-$_xmlrpcs_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch';
78
-$_xmlrpcs_listMethods_sdoc=array(array('list of method names'));
79
-function _xmlrpcs_listMethods($server, $m=null) // if called in plain php values mode, second param is missing
76
+$_xmlrpcs_listMethods_sig = array(array(\PhpXmlRpc\Value::$xmlrpcArray));
77
+$_xmlrpcs_listMethods_doc = 'This method lists all the methods that the XML-RPC server knows how to dispatch';
78
+$_xmlrpcs_listMethods_sdoc = array(array('list of method names'));
79
+function _xmlrpcs_listMethods($server, $m = null) // if called in plain php values mode, second param is missing
80 80
 {
81 81
     return PhpXmlRpc\Server::_xmlrpcs_listMethods($server, $m);
82 82
 }
83 83
 
84
-$_xmlrpcs_methodSignature_sig=array(array(\PhpXmlRpc\Value::$xmlrpcArray, $GLOBALS['xmlrpcString']));
85
-$_xmlrpcs_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
86
-$_xmlrpcs_methodSignature_sdoc=array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
84
+$_xmlrpcs_methodSignature_sig = array(array(\PhpXmlRpc\Value::$xmlrpcArray, $GLOBALS['xmlrpcString']));
85
+$_xmlrpcs_methodSignature_doc = 'Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)';
86
+$_xmlrpcs_methodSignature_sdoc = array(array('list of known signatures, each sig being an array of xmlrpc type names', 'name of method to be described'));
87 87
 function _xmlrpcs_methodSignature($server, $m)
88 88
 {
89 89
     return PhpXmlRpc\Server::_xmlrpcs_methodSignature($server, $m);
90 90
 }
91 91
 
92
-$_xmlrpcs_methodHelp_sig=array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
93
-$_xmlrpcs_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string';
94
-$_xmlrpcs_methodHelp_sdoc=array(array('method description', 'name of the method to be described'));
92
+$_xmlrpcs_methodHelp_sig = array(array($GLOBALS['xmlrpcString'], $GLOBALS['xmlrpcString']));
93
+$_xmlrpcs_methodHelp_doc = 'Returns help text if defined for the method passed, otherwise returns an empty string';
94
+$_xmlrpcs_methodHelp_sdoc = array(array('method description', 'name of the method to be described'));
95 95
 function _xmlrpcs_methodHelp($server, $m)
96 96
 {
97 97
     return PhpXmlRpc\Server::_xmlrpcs_methodHelp($server, $m);
Please login to merge, or discard this patch.