| @@ -348,7 +348,8 @@ | ||
| 348 | 348 | /** | 
| 349 | 349 | * Parse http headers received along with xmlrpc request. If needed, inflate request. | 
| 350 | 350 | * | 
| 351 | - * @return mixed Response|null on success or an error Response | |
| 351 | + * @param string $data | |
| 352 | + * @return Response|null Response|null on success or an error Response | |
| 352 | 353 | */ | 
| 353 | 354 | protected function parseRequestHeaders(&$data, &$reqEncoding, &$respEncoding, &$respCompression) | 
| 354 | 355 |      { | 
| @@ -33,6 +33,9 @@ | ||
| 33 | 33 | } | 
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | + /** | |
| 37 | + * @param string $methodName | |
| 38 | + */ | |
| 36 | 39 | protected function newMsg($methodName, $params = array()) | 
| 37 | 40 |      { | 
| 38 | 41 | $msg = new xmlrpcmsg($methodName, $params); | 
| @@ -17,14 +17,16 @@ | ||
| 17 | 17 | protected function setUp() | 
| 18 | 18 |      { | 
| 19 | 19 | $this->args = argParser::getArgs(); | 
| 20 | - if ($this->args['DEBUG'] == 1) | |
| 21 | - ob_start(); | |
| 20 | +        if ($this->args['DEBUG'] == 1) { | |
| 21 | + ob_start(); | |
| 22 | + } | |
| 22 | 23 | } | 
| 23 | 24 | |
| 24 | 25 | protected function tearDown() | 
| 25 | 26 |      { | 
| 26 | - if ($this->args['DEBUG'] != 1) | |
| 27 | - return; | |
| 27 | +        if ($this->args['DEBUG'] != 1) { | |
| 28 | + return; | |
| 29 | + } | |
| 28 | 30 | $out = ob_get_clean(); | 
| 29 | 31 | $status = $this->getStatus(); | 
| 30 | 32 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR | 
| @@ -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(); | 
| @@ -96,14 +96,16 @@ | ||
| 96 | 96 | |
| 97 | 97 | $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); | 
| 98 | 98 | |
| 99 | - if ($this->args['DEBUG'] == 1) | |
| 100 | - ob_start(); | |
| 99 | +        if ($this->args['DEBUG'] == 1) { | |
| 100 | + ob_start(); | |
| 101 | + } | |
| 101 | 102 | } | 
| 102 | 103 | |
| 103 | 104 | protected function tearDown() | 
| 104 | 105 |      { | 
| 105 | - if ($this->args['DEBUG'] != 1) | |
| 106 | - return; | |
| 106 | +        if ($this->args['DEBUG'] != 1) { | |
| 107 | + return; | |
| 108 | + } | |
| 107 | 109 | $out = ob_get_clean(); | 
| 108 | 110 | $status = $this->getStatus(); | 
| 109 | 111 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 | |
| 115 | 115 | /** | 
| 116 | 116 | * @param PhpXmlRpc\Request|array $msg | 
| 117 | - * @param int|array $errorCode | |
| 117 | + * @param integer $errorCode | |
| 118 | 118 | * @param bool $returnResponse | 
| 119 | 119 | * @return mixed|\PhpXmlRpc\Response|\PhpXmlRpc\Response[]|\PhpXmlRpc\Value|string|null | 
| 120 | 120 | */ | 
| @@ -431,6 +431,10 @@ discard block | ||
| 431 | 431 | } | 
| 432 | 432 | } | 
| 433 | 433 | |
| 434 | + /** | |
| 435 | + * @param string $method | |
| 436 | + * @param PhpXmlRpc\Value[] $params | |
| 437 | + */ | |
| 434 | 438 | public function _multicall_msg($method, $params) | 
| 435 | 439 |      { | 
| 436 | 440 | $struct['methodName'] = new xmlrpcval($method, 'string'); | 
| @@ -20,14 +20,16 @@ | ||
| 20 | 20 |          $this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['LOCALSERVER'], 80); | 
| 21 | 21 | $this->client->setDebug($this->args['DEBUG']); | 
| 22 | 22 | |
| 23 | - if ($this->args['DEBUG'] == 1) | |
| 24 | - ob_start(); | |
| 23 | +        if ($this->args['DEBUG'] == 1) { | |
| 24 | + ob_start(); | |
| 25 | + } | |
| 25 | 26 | } | 
| 26 | 27 | |
| 27 | 28 | protected function tearDown() | 
| 28 | 29 |      { | 
| 29 | - if ($this->args['DEBUG'] != 1) | |
| 30 | - return; | |
| 30 | +        if ($this->args['DEBUG'] != 1) { | |
| 31 | + return; | |
| 32 | + } | |
| 31 | 33 | $out = ob_get_clean(); | 
| 32 | 34 | $status = $this->getStatus(); | 
| 33 | 35 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR | 
| @@ -209,11 +209,12 @@ | ||
| 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'; | 
| @@ -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; | 
| @@ -393,7 +393,7 @@ discard block | ||
| 393 | 393 | * @todo validate params? In theory all validation is left to the dispatch map... | 
| 394 | 394 | * @todo add support for $catchWarnings | 
| 395 | 395 | * | 
| 396 | - * @param $callable | |
| 396 | + * @param callable $callable | |
| 397 | 397 | * @param array $extraOptions | 
| 398 | 398 | * @param string $plainFuncName | 
| 399 | 399 | * @param array $funcDesc | 
| @@ -459,7 +459,7 @@ discard block | ||
| 459 | 459 | |
| 460 | 460 | /** | 
| 461 | 461 | * Return a name for a new function, based on $callable, insuring its uniqueness | 
| 462 | - * @param mixed $callable a php callable, or the name of an xmlrpc method | |
| 462 | + * @param callable $callable a php callable, or the name of an xmlrpc method | |
| 463 | 463 | * @param string $newFuncName when not empty, it is used instead of the calculated version | 
| 464 | 464 | * @return string | 
| 465 | 465 | */ | 
| @@ -497,7 +497,7 @@ discard block | ||
| 497 | 497 | } | 
| 498 | 498 | |
| 499 | 499 | /** | 
| 500 | - * @param $callable | |
| 500 | + * @param callable $callable | |
| 501 | 501 | * @param string $newFuncName | 
| 502 | 502 | * @param array $extraOptions | 
| 503 | 503 | * @param string $plainFuncName | 
| @@ -168,6 +168,9 @@ discard block | ||
| 168 | 168 | return PhpXmlRpc\Helper\Charset::instance()->encodeEntitites($data, $srcEncoding, $destEncoding); | 
| 169 | 169 | } | 
| 170 | 170 | |
| 171 | +/** | |
| 172 | + * @param integer $timeT | |
| 173 | + */ | |
| 171 | 174 | function iso8601_encode($timeT, $utc=0) | 
| 172 | 175 |  { | 
| 173 | 176 | return PhpXmlRpc\Helper\Date::iso8601Encode($timeT, $utc); | 
| @@ -195,6 +198,9 @@ discard block | ||
| 195 | 198 | return $encoder->encode($phpVal, $options); | 
| 196 | 199 | } | 
| 197 | 200 | |
| 201 | +/** | |
| 202 | + * @param string $xmlVal | |
| 203 | + */ | |
| 198 | 204 | function php_xmlrpc_decode_xml($xmlVal, $options=array()) | 
| 199 | 205 |  { | 
| 200 | 206 | $encoder = new PhpXmlRpc\Encoder(); |