@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | $callable = explode('::', $callable); |
191 | 191 | } |
192 | 192 | if (is_array($callable)) { |
193 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
194 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
193 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
194 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
195 | 195 | return false; |
196 | 196 | } |
197 | 197 | if (is_string($callable[0])) { |
198 | 198 | $plainFuncName = implode('::', $callable); |
199 | 199 | } elseif (is_object($callable[0])) { |
200 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
200 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
201 | 201 | } |
202 | 202 | $exists = method_exists($callable[0], $callable[1]); |
203 | 203 | } else if ($callable instanceof \Closure) { |
204 | 204 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
205 | 205 | if (!$buildIt) { |
206 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
206 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | if (!$exists) { |
218 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
218 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
@@ -259,23 +259,23 @@ discard block |
||
259 | 259 | if (is_array($callable)) { |
260 | 260 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
261 | 261 | if ($func->isPrivate()) { |
262 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
262 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ($func->isProtected()) { |
266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | if ($func->isConstructor()) { |
270 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
270 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | if ($func->isDestructor()) { |
274 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
274 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | if ($func->isAbstract()) { |
278 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
278 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
279 | 279 | return false; |
280 | 280 | } |
281 | 281 | /// @todo add more checks for static vs. nonstatic? |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if ($func->isInternal()) { |
286 | 286 | /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully |
287 | 287 | /// reflect internal php functions |
288 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
288 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | $i = 0; |
338 | 338 | foreach ($func->getParameters() as $paramObj) { |
339 | 339 | $params[$i] = array(); |
340 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
340 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
341 | 341 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
342 | 342 | $i++; |
343 | 343 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | // build a signature |
402 | 402 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
403 | 403 | $pSig = array($funcDesc['returnsDocs']); |
404 | - for ($i = 0; $i < count($pars); $i++) { |
|
404 | + for ($i = 0; $i<count($pars); $i++) { |
|
405 | 405 | $name = strtolower($funcDesc['params'][$i]['name']); |
406 | 406 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
407 | 407 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | $numPars = $req->getNumParams(); |
460 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
460 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
461 | 461 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
462 | 462 | } |
463 | 463 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | $result = call_user_func_array($callable, $params); |
472 | 472 | |
473 | - if (! is_a($result, $responseClass)) { |
|
473 | + if (!is_a($result, $responseClass)) { |
|
474 | 474 | // q: why not do the same for int, float, bool, string? |
475 | 475 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
476 | 476 | $result = new $valueClass($result, $funcDesc['returns']); |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | if ($newFuncName == '') { |
510 | 510 | if (is_array($callable)) { |
511 | 511 | if (is_string($callable[0])) { |
512 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
512 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
513 | 513 | } else { |
514 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
514 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
515 | 515 | } |
516 | 516 | } else { |
517 | 517 | if ($callable instanceof \Closure) { |
@@ -543,9 +543,9 @@ discard block |
||
543 | 543 | */ |
544 | 544 | protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc) |
545 | 545 | { |
546 | - $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false; |
|
547 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
548 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
546 | + $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false; |
|
547 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
548 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
549 | 549 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
550 | 550 | |
551 | 551 | $i = 0; |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | // build body of new function |
581 | 581 | |
582 | 582 | $innerCode = " \$paramCount = \$req->getNumParams();\n"; |
583 | - $innerCode .= " if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
583 | + $innerCode .= " if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
584 | 584 | |
585 | - $innerCode .= " \$encoder = new " . static::$namespace . "Encoder();\n"; |
|
585 | + $innerCode .= " \$encoder = new ".static::$namespace."Encoder();\n"; |
|
586 | 586 | if ($decodePhpObjects) { |
587 | 587 | $innerCode .= " \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n"; |
588 | 588 | } else { |
@@ -595,23 +595,23 @@ discard block |
||
595 | 595 | static::holdObject($newFuncName, $callable[0]); |
596 | 596 | $class = get_class($callable[0]); |
597 | 597 | if ($class[0] !== '\\') { |
598 | - $class = '\\' . $class; |
|
598 | + $class = '\\'.$class; |
|
599 | 599 | } |
600 | 600 | $innerCode .= " /// @var $class \$obj\n"; |
601 | 601 | $innerCode .= " \$obj = PhpXmlRpc\\Wrapper::getHeldObject('$newFuncName');\n"; |
602 | - $realFuncName = '$obj->' . $callable[1]; |
|
602 | + $realFuncName = '$obj->'.$callable[1]; |
|
603 | 603 | } else { |
604 | 604 | $realFuncName = $plainFuncName; |
605 | 605 | } |
606 | 606 | foreach ($parsVariations as $i => $pars) { |
607 | - $innerCode .= " if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
608 | - if ($i < (count($parsVariations) - 1)) |
|
607 | + $innerCode .= " if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
608 | + if ($i<(count($parsVariations)-1)) |
|
609 | 609 | $innerCode .= " else\n"; |
610 | 610 | } |
611 | - $innerCode .= " if (is_a(\$retVal, '" . static::$namespace . "Response'))\n return \$retVal;\n else\n"; |
|
611 | + $innerCode .= " if (is_a(\$retVal, '".static::$namespace."Response'))\n return \$retVal;\n else\n"; |
|
612 | 612 | /// q: why not do the same for int, float, bool, string? |
613 | 613 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
614 | - $innerCode .= " return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));"; |
|
614 | + $innerCode .= " return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));"; |
|
615 | 615 | } else { |
616 | 616 | $encodeOptions = array(); |
617 | 617 | if ($encodeNulls) { |
@@ -622,18 +622,18 @@ discard block |
||
622 | 622 | } |
623 | 623 | |
624 | 624 | if ($encodeOptions) { |
625 | - $innerCode .= " return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" . |
|
626 | - implode("', '", $encodeOptions) . "')));"; |
|
625 | + $innerCode .= " return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('". |
|
626 | + implode("', '", $encodeOptions)."')));"; |
|
627 | 627 | } else { |
628 | - $innerCode .= " return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));"; |
|
628 | + $innerCode .= " return new ".static::$namespace."Response(\$encoder->encode(\$retVal));"; |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | // shall we exclude functions returning by ref? |
632 | 632 | // if ($func->returnsReference()) |
633 | 633 | // return false; |
634 | 634 | |
635 | - $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" . |
|
636 | - "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}"; |
|
635 | + $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n". |
|
636 | + "function $newFuncName(\$req)\n{\n".$innerCode."\n}"; |
|
637 | 637 | |
638 | 638 | return $code; |
639 | 639 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array()) |
688 | 688 | { |
689 | 689 | if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) { |
690 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . $classMethod; |
|
690 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod; |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | if (is_object($className)) { |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | } else { |
696 | 696 | $realClassName = $className; |
697 | 697 | } |
698 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . "$realClassName.$classMethod"; |
|
698 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod"; |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | /** |
@@ -778,21 +778,21 @@ discard block |
||
778 | 778 | */ |
779 | 779 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
780 | 780 | { |
781 | - $reqClass = static::$namespace . 'Request'; |
|
782 | - $valClass = static::$namespace . 'Value'; |
|
783 | - $decoderClass = static::$namespace . 'Encoder'; |
|
781 | + $reqClass = static::$namespace.'Request'; |
|
782 | + $valClass = static::$namespace.'Value'; |
|
783 | + $decoderClass = static::$namespace.'Encoder'; |
|
784 | 784 | |
785 | 785 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
786 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
786 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
787 | 787 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
788 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
788 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
789 | 789 | |
790 | 790 | $req = new $reqClass('system.methodSignature'); |
791 | 791 | $req->addparam(new $valClass($methodName)); |
792 | 792 | $client->setDebug($debug); |
793 | 793 | $response = $client->send($req, $timeout, $protocol); |
794 | 794 | if ($response->faultCode()) { |
795 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
795 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
796 | 796 | return false; |
797 | 797 | } |
798 | 798 | |
@@ -803,8 +803,8 @@ discard block |
||
803 | 803 | $mSig = $decoder->decode($mSig); |
804 | 804 | } |
805 | 805 | |
806 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
807 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
806 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
807 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
808 | 808 | return false; |
809 | 809 | } |
810 | 810 | |
@@ -819,11 +819,11 @@ discard block |
||
819 | 819 | */ |
820 | 820 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
821 | 821 | { |
822 | - $reqClass = static::$namespace . 'Request'; |
|
823 | - $valClass = static::$namespace . 'Value'; |
|
822 | + $reqClass = static::$namespace.'Request'; |
|
823 | + $valClass = static::$namespace.'Value'; |
|
824 | 824 | |
825 | 825 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
826 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
826 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
827 | 827 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
828 | 828 | |
829 | 829 | $mDesc = ''; |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | $clientClone = clone $client; |
858 | 858 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
859 | 859 | { |
860 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
860 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
861 | 861 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
862 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
863 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
864 | - $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false; |
|
862 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
863 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
864 | + $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false; |
|
865 | 865 | $throwFault = false; |
866 | 866 | $decodeFault = false; |
867 | 867 | $faultResponse = null; |
@@ -872,9 +872,9 @@ discard block |
||
872 | 872 | $faultResponse = $extraOptions['return_on_fault']; |
873 | 873 | } |
874 | 874 | |
875 | - $reqClass = static::$namespace . 'Request'; |
|
876 | - $encoderClass = static::$namespace . 'Encoder'; |
|
877 | - $valueClass = static::$namespace . 'Value'; |
|
875 | + $reqClass = static::$namespace.'Request'; |
|
876 | + $encoderClass = static::$namespace.'Encoder'; |
|
877 | + $valueClass = static::$namespace.'Value'; |
|
878 | 878 | |
879 | 879 | $encoder = new $encoderClass(); |
880 | 880 | $encodeOptions = array(); |
@@ -956,14 +956,14 @@ discard block |
||
956 | 956 | * @param string $mDesc |
957 | 957 | * @return string[] keys: source, docstring |
958 | 958 | */ |
959 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
959 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
960 | 960 | { |
961 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
961 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
962 | 962 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
963 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
964 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
965 | - $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false; |
|
966 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
963 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
964 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
965 | + $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false; |
|
966 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
967 | 967 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
968 | 968 | $throwFault = false; |
969 | 969 | $decodeFault = false; |
@@ -976,10 +976,10 @@ discard block |
||
976 | 976 | } |
977 | 977 | |
978 | 978 | $code = "function $newFuncName("; |
979 | - if ($clientCopyMode < 2) { |
|
979 | + if ($clientCopyMode<2) { |
|
980 | 980 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
981 | 981 | $verbatimClientCopy = !$clientCopyMode; |
982 | - $innerCode = ' ' . str_replace("\n", "\n ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace)); |
|
982 | + $innerCode = ' '.str_replace("\n", "\n ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace)); |
|
983 | 983 | $innerCode .= "\$client->setDebug(\$debug);\n"; |
984 | 984 | $this_ = ''; |
985 | 985 | } else { |
@@ -987,28 +987,28 @@ discard block |
||
987 | 987 | $innerCode = ''; |
988 | 988 | $this_ = 'this->'; |
989 | 989 | } |
990 | - $innerCode .= " \$req = new " . static::$namespace . "Request('$methodName');\n"; |
|
990 | + $innerCode .= " \$req = new ".static::$namespace."Request('$methodName');\n"; |
|
991 | 991 | |
992 | 992 | if ($mDesc != '') { |
993 | 993 | // take care that PHP comment is not terminated unwillingly by method description |
994 | 994 | /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags... |
995 | - $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n"; |
|
995 | + $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n"; |
|
996 | 996 | } else { |
997 | 997 | $mDesc = "/**\n * Function $newFuncName.\n"; |
998 | 998 | } |
999 | 999 | |
1000 | 1000 | // param parsing |
1001 | - $innerCode .= " \$encoder = new " . static::$namespace . "Encoder();\n"; |
|
1001 | + $innerCode .= " \$encoder = new ".static::$namespace."Encoder();\n"; |
|
1002 | 1002 | $plist = array(); |
1003 | 1003 | $pCount = count($mSig); |
1004 | - for ($i = 1; $i < $pCount; $i++) { |
|
1004 | + for ($i = 1; $i<$pCount; $i++) { |
|
1005 | 1005 | $plist[] = "\$p$i"; |
1006 | 1006 | $pType = $mSig[$i]; |
1007 | 1007 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
1008 | 1008 | $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null' |
1009 | 1009 | ) { |
1010 | 1010 | // only build directly xml-rpc values when type is known and scalar |
1011 | - $innerCode .= " \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n"; |
|
1011 | + $innerCode .= " \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n"; |
|
1012 | 1012 | } else { |
1013 | 1013 | if ($encodePhpObjects || $encodeNulls) { |
1014 | 1014 | $encOpts = array(); |
@@ -1019,26 +1019,26 @@ discard block |
||
1019 | 1019 | $encOpts[] = 'null_extension'; |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - $innerCode .= " \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n"; |
|
1022 | + $innerCode .= " \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n"; |
|
1023 | 1023 | } else { |
1024 | 1024 | $innerCode .= " \$p$i = \$encoder->encode(\$p$i);\n"; |
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | $innerCode .= " \$req->addparam(\$p$i);\n"; |
1028 | - $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
1028 | + $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
1029 | 1029 | } |
1030 | - if ($clientCopyMode < 2) { |
|
1030 | + if ($clientCopyMode<2) { |
|
1031 | 1031 | $plist[] = '$debug = 0'; |
1032 | 1032 | $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
1033 | 1033 | } |
1034 | 1034 | $plist = implode(', ', $plist); |
1035 | - $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]); |
|
1035 | + $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]); |
|
1036 | 1036 | if ($throwFault) { |
1037 | - $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\Exception'); |
|
1037 | + $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\Exception'); |
|
1038 | 1038 | } else if ($decodeFault) { |
1039 | - $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)"; |
|
1039 | + $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)"; |
|
1040 | 1040 | } else { |
1041 | - $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)"; |
|
1041 | + $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)"; |
|
1042 | 1042 | } |
1043 | 1043 | $mDesc .= "\n */\n"; |
1044 | 1044 | |
@@ -1050,9 +1050,9 @@ discard block |
||
1050 | 1050 | $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())"; |
1051 | 1051 | } else if ($decodeFault) { |
1052 | 1052 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
1053 | - $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
1053 | + $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
1054 | 1054 | } else { |
1055 | - $respCode = 'return ' . var_export($faultResponse, true); |
|
1055 | + $respCode = 'return '.var_export($faultResponse, true); |
|
1056 | 1056 | } |
1057 | 1057 | } else { |
1058 | 1058 | $respCode = 'return $res'; |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | $innerCode .= " if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());"; |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n"; |
|
1066 | + $code = $code.$plist.")\n{\n".$innerCode."\n}\n"; |
|
1067 | 1067 | |
1068 | 1068 | return array('source' => $code, 'docstring' => $mDesc); |
1069 | 1069 | } |
@@ -1090,25 +1090,25 @@ discard block |
||
1090 | 1090 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1091 | 1091 | { |
1092 | 1092 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1093 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1093 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1094 | 1094 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1095 | 1095 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1096 | - $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false; |
|
1097 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1098 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1096 | + $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false; |
|
1097 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1098 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1099 | 1099 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1100 | - $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false; |
|
1100 | + $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false; |
|
1101 | 1101 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1102 | 1102 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1103 | 1103 | |
1104 | - $reqClass = static::$namespace . 'Request'; |
|
1105 | - $decoderClass = static::$namespace . 'Encoder'; |
|
1104 | + $reqClass = static::$namespace.'Request'; |
|
1105 | + $decoderClass = static::$namespace.'Encoder'; |
|
1106 | 1106 | |
1107 | 1107 | // retrieve the list of methods |
1108 | 1108 | $req = new $reqClass('system.listMethods'); |
1109 | 1109 | $response = $client->send($req, $timeout, $protocol); |
1110 | 1110 | if ($response->faultCode()) { |
1111 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1111 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1112 | 1112 | |
1113 | 1113 | return false; |
1114 | 1114 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $mList = $decoder->decode($mList); |
1120 | 1120 | } |
1121 | 1121 | if (!is_array($mList) || !count($mList)) { |
1122 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1122 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1123 | 1123 | |
1124 | 1124 | return false; |
1125 | 1125 | } |
@@ -1128,8 +1128,8 @@ discard block |
||
1128 | 1128 | if ($newClassName != '') { |
1129 | 1129 | $xmlrpcClassName = $newClassName; |
1130 | 1130 | } else { |
1131 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1132 | - array('_', ''), $client->server) . '_client'; |
|
1131 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1132 | + array('_', ''), $client->server).'_client'; |
|
1133 | 1133 | } |
1134 | 1134 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1135 | 1135 | $xmlrpcClassName .= 'x'; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | /// @todo add method setDebug() to new class, to enable/disable debugging |
1139 | 1139 | $source = "class $xmlrpcClassName\n{\n public \$client;\n\n"; |
1140 | 1140 | $source .= " function __construct()\n {\n"; |
1141 | - $source .= ' ' . str_replace("\n", "\n ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace)); |
|
1141 | + $source .= ' '.str_replace("\n", "\n ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace)); |
|
1142 | 1142 | $source .= "\$this->client = \$client;\n }\n\n"; |
1143 | 1143 | $opts = array( |
1144 | 1144 | 'return_source' => true, |
@@ -1161,26 +1161,26 @@ discard block |
||
1161 | 1161 | $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts); |
1162 | 1162 | if ($methodWrap) { |
1163 | 1163 | if ($buildIt) { |
1164 | - $source .= $methodWrap['source'] . "\n"; |
|
1164 | + $source .= $methodWrap['source']."\n"; |
|
1165 | 1165 | |
1166 | 1166 | } else { |
1167 | - $source .= ' ' . str_replace("\n", "\n ", $methodWrap['docstring']); |
|
1168 | - $source .= str_replace("\n", "\n ", $methodWrap['source']). "\n"; |
|
1167 | + $source .= ' '.str_replace("\n", "\n ", $methodWrap['docstring']); |
|
1168 | + $source .= str_replace("\n", "\n ", $methodWrap['source'])."\n"; |
|
1169 | 1169 | } |
1170 | 1170 | |
1171 | 1171 | } else { |
1172 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1172 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | } |
1176 | 1176 | $source .= "}\n"; |
1177 | 1177 | if ($buildIt) { |
1178 | 1178 | $allOK = 0; |
1179 | - eval($source . '$allOK=1;'); |
|
1179 | + eval($source.'$allOK=1;'); |
|
1180 | 1180 | if ($allOK) { |
1181 | 1181 | return $xmlrpcClassName; |
1182 | 1182 | } else { |
1183 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1183 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | } else { |
@@ -1199,8 +1199,8 @@ discard block |
||
1199 | 1199 | */ |
1200 | 1200 | protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
1201 | 1201 | { |
1202 | - $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path) . |
|
1203 | - "', '" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server) . "', $client->port);\n"; |
|
1202 | + $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path). |
|
1203 | + "', '".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server)."', $client->port);\n"; |
|
1204 | 1204 | |
1205 | 1205 | // copy all client fields to the client that will be generated runtime |
1206 | 1206 | // (this provides for future expansion or subclassing of client obj) |
@@ -605,8 +605,9 @@ |
||
605 | 605 | } |
606 | 606 | foreach ($parsVariations as $i => $pars) { |
607 | 607 | $innerCode .= " if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
608 | - if ($i < (count($parsVariations) - 1)) |
|
609 | - $innerCode .= " else\n"; |
|
608 | + if ($i < (count($parsVariations) - 1)) { |
|
609 | + $innerCode .= " else\n"; |
|
610 | + } |
|
610 | 611 | } |
611 | 612 | $innerCode .= " if (is_a(\$retVal, '" . static::$namespace . "Response'))\n return \$retVal;\n else\n"; |
612 | 613 | /// q: why not do the same for int, float, bool, string? |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * @author JoakimLofgren |
4 | 4 | */ |
5 | 5 | |
6 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
6 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
7 | 7 | |
8 | 8 | use PhpXmlRpc\Helper\Charset; |
9 | 9 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | { |
33 | 33 | // construct a latin string with all chars (except control ones) |
34 | 34 | $this->latinString = "\n\r\t"; |
35 | - for($i = 32; $i < 127; $i++) { |
|
35 | + for ($i = 32; $i<127; $i++) { |
|
36 | 36 | $this->latinString .= chr($i); |
37 | 37 | } |
38 | - for($i = 160; $i < 256; $i++) { |
|
38 | + for ($i = 160; $i<256; $i++) { |
|
39 | 39 | $this->latinString .= chr($i); |
40 | 40 | } |
41 | 41 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
11 | 11 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | /// @todo it seems that old php versions can not automatically transform latin to utf8 upon xml parsing. |
104 | 104 | /// We should fix that, then re-enable this test |
105 | 105 | if (version_compare(PHP_VERSION, '5.6.0', '>=')) { |
106 | - $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>' . $string . '</string></value>'); |
|
106 | + $i = $e->decodeXml('<?xml version="1.0" encoding="ISO-8859-15" ?><value><string>'.$string.'</string></value>'); |
|
107 | 107 | $this->assertEquals($string, $i->scalarVal()); |
108 | 108 | } |
109 | 109 |
@@ -23,14 +23,16 @@ |
||
23 | 23 | { |
24 | 24 | $this->args = argParser::getArgs(); |
25 | 25 | // hide parsing errors unless in debug mode |
26 | - if ($this->args['DEBUG'] == 1) |
|
27 | - ob_start(); |
|
26 | + if ($this->args['DEBUG'] == 1) { |
|
27 | + ob_start(); |
|
28 | + } |
|
28 | 29 | } |
29 | 30 | |
30 | 31 | protected function tear_down() |
31 | 32 | { |
32 | - if ($this->args['DEBUG'] != 1) |
|
33 | - return; |
|
33 | + if ($this->args['DEBUG'] != 1) { |
|
34 | + return; |
|
35 | + } |
|
34 | 36 | $out = ob_get_clean(); |
35 | 37 | $status = $this->getStatus(); |
36 | 38 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
4 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
5 | 5 | |
6 | -include_once __DIR__ . '/parse_args.php'; |
|
6 | +include_once __DIR__.'/parse_args.php'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Runner\BaseTestRunner; |
11 | 11 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $this->assertequals(1, count($v1)); |
129 | 129 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
130 | 130 | |
131 | - foreach($v1 as $key => $val) |
|
131 | + foreach ($v1 as $key => $val) |
|
132 | 132 | { |
133 | 133 | $this->assertArrayHasKey($key, $out); |
134 | 134 | $expected = $out[$key]; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->assertequals(2, count($v2)); |
144 | 144 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
145 | 145 | $i = 0; |
146 | - foreach($v2 as $key => $val) |
|
146 | + foreach ($v2 as $key => $val) |
|
147 | 147 | { |
148 | 148 | $expected = $out[$i]; |
149 | 149 | $this->assertequals($expected['key'], $key); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
159 | 159 | $data = array(); |
160 | - for ($i = 0; $i < 500000; $i++ ) { |
|
160 | + for ($i = 0; $i<500000; $i++) { |
|
161 | 161 | $data[] = 'hello world'; |
162 | 162 | } |
163 | 163 |
@@ -21,14 +21,16 @@ |
||
21 | 21 | protected function set_up() |
22 | 22 | { |
23 | 23 | $this->args = argParser::getArgs(); |
24 | - if ($this->args['DEBUG'] == 1) |
|
25 | - ob_start(); |
|
24 | + if ($this->args['DEBUG'] == 1) { |
|
25 | + ob_start(); |
|
26 | + } |
|
26 | 27 | } |
27 | 28 | |
28 | 29 | protected function tear_down() |
29 | 30 | { |
30 | - if ($this->args['DEBUG'] != 1) |
|
31 | - return; |
|
31 | + if ($this->args['DEBUG'] != 1) { |
|
32 | + return; |
|
33 | + } |
|
32 | 34 | $out = ob_get_clean(); |
33 | 35 | $status = $this->getStatus(); |
34 | 36 | if ($status == BaseTestRunner::STATUS_ERROR |
@@ -1,11 +1,11 @@ discard block |
||
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__ . '/08ServerTest.php'; |
|
8 | +include_once __DIR__.'/08ServerTest.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Tests which stress http features of the library. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | ); |
31 | 31 | |
32 | 32 | $methods = array(); |
33 | - foreach(get_class_methods('ServerTest') as $method) |
|
33 | + foreach (get_class_methods('ServerTest') as $method) |
|
34 | 34 | { |
35 | 35 | if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods)) |
36 | 36 | { |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | preg_match('/ubunutu([0-9]+)/', $output[0], $matches); |
305 | 305 | $ubuntuVersion = @$matches[1]; |
306 | 306 | } |
307 | - if ($ubuntuVersion >= 20) { |
|
307 | + if ($ubuntuVersion>=20) { |
|
308 | 308 | $this->markTestSkipped('HTTPS via Socket known to fail on php less than 7.2 on Ubuntu 20 and higher'); |
309 | 309 | return; |
310 | 310 | } |
@@ -201,8 +201,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ . "/_prepend.php"; |
|
2 | +require_once __DIR__."/_prepend.php"; |
|
3 | 3 | |
4 | 4 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
5 | 5 | |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | // generate a file with a class definition |
26 | 26 | |
27 | 27 | // the generated code does not have an autoloader included - we need to add in one |
28 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
28 | +$autoloader = __DIR__."/_prepend.php"; |
|
29 | 29 | |
30 | 30 | file_put_contents($targetClassFile, |
31 | - "<?php\n\n" . |
|
32 | - "require_once '$autoloader';\n\n" . |
|
31 | + "<?php\n\n". |
|
32 | + "require_once '$autoloader';\n\n". |
|
33 | 33 | "class MyServerClass\n{\n\n" |
34 | 34 | ) || die('uh oh'); |
35 | 35 | |
36 | 36 | // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions |
37 | 37 | |
38 | -foreach($code as $methodName => $methodDef) { |
|
39 | - file_put_contents($targetClassFile, ' ' . str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source']) . "\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | - $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function']; |
|
38 | +foreach ($code as $methodName => $methodDef) { |
|
39 | + file_put_contents($targetClassFile, ' '.str_replace(array('function ', "\n"), array('public static function ', "\n "), $methodDef['source'])."\n\n", FILE_APPEND) || die('uh oh'); |
|
40 | + $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function']; |
|
41 | 41 | unset($code[$methodName]['source']); |
42 | 42 | } |
43 | 43 | file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); |
44 | 44 | |
45 | 45 | // generate separate files with the xml-rpc server instantiation and its dispatch map |
46 | 46 | |
47 | -file_put_contents($targetDispatchMapFile, "<?php\n\nreturn " . var_export($code, true) . ";\n"); |
|
47 | +file_put_contents($targetDispatchMapFile, "<?php\n\nreturn ".var_export($code, true).";\n"); |
|
48 | 48 | |
49 | 49 | file_put_contents($targetControllerFile, |
50 | - "<?php\n\n" . |
|
50 | + "<?php\n\n". |
|
51 | 51 | |
52 | - "require_once '$autoloader';\n\n" . |
|
52 | + "require_once '$autoloader';\n\n". |
|
53 | 53 | |
54 | - "require_once '$targetClassFile';\n\n" . |
|
54 | + "require_once '$targetClassFile';\n\n". |
|
55 | 55 | |
56 | 56 | // NB: since we are running the generated code within the same script, the existing CommentManager instance will be |
57 | 57 | // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | // Wrapper::holdObject('xmlrpc_CommentManager_addComment', $cm); |
62 | 62 | // Wrapper::holdObject('xmlrpc_CommentManager_getComments', $cm); |
63 | 63 | |
64 | - "\$dm = require_once '$targetDispatchMapFile';\n" . |
|
65 | - '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" . |
|
66 | - '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!' . "\n" . |
|
67 | - '$s->setDebug(2);' . "\n" . |
|
68 | - '$s->exception_handling = 1;' . "\n" . |
|
69 | - '$s->service();' . "\n" |
|
64 | + "\$dm = require_once '$targetDispatchMapFile';\n". |
|
65 | + '$s = new \PhpXmlRpc\Server($dm, false);'."\n". |
|
66 | + '// NB: do not leave these 2 debug lines enabled on publicly accessible servers!'."\n". |
|
67 | + '$s->setDebug(2);'."\n". |
|
68 | + '$s->exception_handling = 1;'."\n". |
|
69 | + '$s->service();'."\n" |
|
70 | 70 | ) || die('uh oh'); |
71 | 71 | |
72 | 72 | // test that everything worked by running it in realtime (note that this will return an xml-rpc error message if run |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | die(); |
22 | 22 | } |
23 | 23 | |
24 | -require_once __DIR__ . "/_prepend.php"; |
|
24 | +require_once __DIR__."/_prepend.php"; |
|
25 | 25 | |
26 | 26 | use PhpXmlRpc\PhpXmlRpc; |
27 | 27 | use PhpXmlRpc\Server; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } elseif ($_GET['FORCE_AUTH'] == 'Digest') { |
81 | 81 | if (empty($_SERVER['PHP_AUTH_DIGEST'])) { |
82 | 82 | header('HTTP/1.1 401 Unauthorized'); |
83 | - header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"'); |
|
83 | + header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"'); |
|
84 | 84 | die('Text visible if user hits Cancel button'); |
85 | 85 | } |
86 | 86 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (isset($_GET['FORCE_REDIRECT'])) { |
89 | 89 | header('HTTP/1.0 302 Found'); |
90 | 90 | unset($_GET['FORCE_REDIRECT']); |
91 | - header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : '')); |
|
91 | + header('Location: '.$_SERVER['REQUEST_URI'].(count($_GET) ? '?'.http_build_query($_GET) : '')); |
|
92 | 92 | die(); |
93 | 93 | } |
94 | 94 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/WebTestCase.php'; |
|
3 | +include_once __DIR__.'/WebTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests for the bundled debugger. |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | $this->args = argParser::getArgs(); |
13 | 13 | |
14 | 14 | // assumes HTTPURI to be in the form /tests/index.php?etc... |
15 | - $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
16 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
15 | + $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']); |
|
16 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testIndex() |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/parse_args.php'; |
|
3 | +include_once __DIR__.'/parse_args.php'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/PolyfillTestCase.php'; |
|
5 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
6 | 6 | |
7 | 7 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
8 | 8 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function _run($result = NULL) |
27 | 27 | { |
28 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
28 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
29 | 29 | |
30 | 30 | if ($result === NULL) { |
31 | 31 | $result = $this->createResult(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | protected function request($path, $method = 'GET', $payload = '', $emptyPageOk = false) |
62 | 62 | { |
63 | - $url = $this->baseUrl . $path; |
|
63 | + $url = $this->baseUrl.$path; |
|
64 | 64 | |
65 | 65 | $ch = curl_init($url); |
66 | 66 | curl_setopt_array($ch, array( |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID='.$this->testId); |
80 | 80 | } |
81 | - if ($this->args['DEBUG'] > 0) { |
|
81 | + if ($this->args['DEBUG']>0) { |
|
82 | 82 | curl_setopt($ch, CURLOPT_VERBOSE, 1); |
83 | 83 | } |
84 | 84 | $page = curl_exec($ch); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | protected function getClient($path) |
98 | 98 | { |
99 | - $client = new xmlrpc_client($this->baseUrl . $path); |
|
99 | + $client = new xmlrpc_client($this->baseUrl.$path); |
|
100 | 100 | if ($this->collectCodeCoverageInformation) { |
101 | 101 | $client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId); |
102 | 102 | } |