@@ -182,20 +182,20 @@ discard block |
||
182 | 182 | $callable = explode('::', $callable); |
183 | 183 | } |
184 | 184 | if (is_array($callable)) { |
185 | - if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong'); |
|
185 | + if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) { |
|
186 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong'); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | if (is_string($callable[0])) { |
190 | 190 | $plainFuncName = implode('::', $callable); |
191 | 191 | } elseif (is_object($callable[0])) { |
192 | - $plainFuncName = get_class($callable[0]) . '->' . $callable[1]; |
|
192 | + $plainFuncName = get_class($callable[0]).'->'.$callable[1]; |
|
193 | 193 | } |
194 | 194 | $exists = method_exists($callable[0], $callable[1]); |
195 | 195 | } else if ($callable instanceof \Closure) { |
196 | 196 | // we do not support creating code which wraps closures, as php does not allow to serialize them |
197 | 197 | if (!$buildIt) { |
198 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code'); |
|
198 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code'); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if (!$exists) { |
210 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName); |
|
210 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName); |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
@@ -251,23 +251,23 @@ discard block |
||
251 | 251 | if (is_array($callable)) { |
252 | 252 | $func = new \ReflectionMethod($callable[0], $callable[1]); |
253 | 253 | if ($func->isPrivate()) { |
254 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName); |
|
254 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | if ($func->isProtected()) { |
258 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName); |
|
258 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | if ($func->isConstructor()) { |
262 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName); |
|
262 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName); |
|
263 | 263 | return false; |
264 | 264 | } |
265 | 265 | if ($func->isDestructor()) { |
266 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName); |
|
266 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | if ($func->isAbstract()) { |
270 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName); |
|
270 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName); |
|
271 | 271 | return false; |
272 | 272 | } |
273 | 273 | /// @todo add more checks for static vs. nonstatic? |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($func->isInternal()) { |
278 | 278 | // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs |
279 | 279 | // instead of getparameters to fully reflect internal php functions ? |
280 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName); |
|
280 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName); |
|
281 | 281 | return false; |
282 | 282 | } |
283 | 283 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $i = 0; |
330 | 330 | foreach ($func->getParameters() as $paramObj) { |
331 | 331 | $params[$i] = array(); |
332 | - $params[$i]['name'] = '$' . $paramObj->getName(); |
|
332 | + $params[$i]['name'] = '$'.$paramObj->getName(); |
|
333 | 333 | $params[$i]['isoptional'] = $paramObj->isOptional(); |
334 | 334 | $i++; |
335 | 335 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // build a signature |
395 | 395 | $sig = array($this->php2XmlrpcType($funcDesc['returns'])); |
396 | 396 | $pSig = array($funcDesc['returnsDocs']); |
397 | - for ($i = 0; $i < count($pars); $i++) { |
|
397 | + for ($i = 0; $i<count($pars); $i++) { |
|
398 | 398 | $name = strtolower($funcDesc['params'][$i]['name']); |
399 | 399 | if (isset($funcDesc['paramDocs'][$name]['type'])) { |
400 | 400 | $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']); |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | } |
451 | 451 | $numPars = $req->getNumParams(); |
452 | - if ($numPars < $minPars || $numPars > $maxPars) { |
|
452 | + if ($numPars<$minPars || $numPars>$maxPars) { |
|
453 | 453 | return new $responseClass(0, 3, 'Incorrect parameters passed to method'); |
454 | 454 | } |
455 | 455 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | |
463 | 463 | $result = call_user_func_array($callable, $params); |
464 | 464 | |
465 | - if (! is_a($result, $responseClass)) { |
|
465 | + if (!is_a($result, $responseClass)) { |
|
466 | 466 | if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) { |
467 | 467 | $result = new $valueClass($result, $funcDesc['returns']); |
468 | 468 | } else { |
@@ -497,9 +497,9 @@ discard block |
||
497 | 497 | if ($newFuncName == '') { |
498 | 498 | if (is_array($callable)) { |
499 | 499 | if (is_string($callable[0])) { |
500 | - $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable); |
|
500 | + $xmlrpcFuncName = "{$prefix}_".implode('_', $callable); |
|
501 | 501 | } else { |
502 | - $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1]; |
|
502 | + $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1]; |
|
503 | 503 | } |
504 | 504 | } else { |
505 | 505 | if ($callable instanceof \Closure) { |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | { |
536 | 536 | $namespace = '\\PhpXmlRpc\\'; |
537 | 537 | |
538 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
539 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
538 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
539 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
540 | 540 | $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : ''; |
541 | 541 | |
542 | 542 | $i = 0; |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | // build body of new function |
572 | 572 | |
573 | 573 | $innerCode = "\$paramCount = \$req->getNumParams();\n"; |
574 | - $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n"; |
|
574 | + $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n"; |
|
575 | 575 | |
576 | 576 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
577 | 577 | if ($decodePhpObjects) { |
@@ -585,13 +585,13 @@ discard block |
||
585 | 585 | if (is_array($callable) && is_object($callable[0])) { |
586 | 586 | self::$objHolder[$newFuncName] = $callable[0]; |
587 | 587 | $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n"; |
588 | - $realFuncName = '$obj->' . $callable[1]; |
|
588 | + $realFuncName = '$obj->'.$callable[1]; |
|
589 | 589 | } else { |
590 | 590 | $realFuncName = $plainFuncName; |
591 | 591 | } |
592 | 592 | foreach ($parsVariations as $i => $pars) { |
593 | - $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n"; |
|
594 | - if ($i < (count($parsVariations) - 1)) |
|
593 | + $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n"; |
|
594 | + if ($i<(count($parsVariations)-1)) |
|
595 | 595 | $innerCode .= "else\n"; |
596 | 596 | } |
597 | 597 | $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n"; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | // if($func->returnsReference()) |
609 | 609 | // return false; |
610 | 610 | |
611 | - $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}"; |
|
611 | + $code = "function $newFuncName(\$req) {\n".$innerCode."\n}"; |
|
612 | 612 | |
613 | 613 | return $code; |
614 | 614 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array()) |
663 | 663 | { |
664 | 664 | if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) { |
665 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . $classMethod; |
|
665 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod; |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | if (is_object($className)) { |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | } else { |
671 | 671 | $realClassName = $className; |
672 | 672 | } |
673 | - return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '') . "$realClassName.$classMethod"; |
|
673 | + return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod"; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -760,21 +760,21 @@ discard block |
||
760 | 760 | protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) |
761 | 761 | { |
762 | 762 | $namespace = '\\PhpXmlRpc\\'; |
763 | - $reqClass = $namespace . 'Request'; |
|
764 | - $valClass = $namespace . 'Value'; |
|
765 | - $decoderClass = $namespace . 'Encoder'; |
|
763 | + $reqClass = $namespace.'Request'; |
|
764 | + $valClass = $namespace.'Value'; |
|
765 | + $decoderClass = $namespace.'Encoder'; |
|
766 | 766 | |
767 | 767 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
768 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
768 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
769 | 769 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
770 | - $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0; |
|
770 | + $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0; |
|
771 | 771 | |
772 | 772 | $req = new $reqClass('system.methodSignature'); |
773 | 773 | $req->addparam(new $valClass($methodName)); |
774 | 774 | $client->setDebug($debug); |
775 | 775 | $response = $client->send($req, $timeout, $protocol); |
776 | 776 | if ($response->faultCode()) { |
777 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName); |
|
777 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName); |
|
778 | 778 | return false; |
779 | 779 | } |
780 | 780 | |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | $mSig = $decoder->decode($mSig); |
785 | 785 | } |
786 | 786 | |
787 | - if (!is_array($mSig) || count($mSig) <= $sigNum) { |
|
788 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName); |
|
787 | + if (!is_array($mSig) || count($mSig)<=$sigNum) { |
|
788 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName); |
|
789 | 789 | return false; |
790 | 790 | } |
791 | 791 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) |
802 | 802 | { |
803 | 803 | $namespace = '\\PhpXmlRpc\\'; |
804 | - $reqClass = $namespace . 'Request'; |
|
805 | - $valClass = $namespace . 'Value'; |
|
804 | + $reqClass = $namespace.'Request'; |
|
805 | + $valClass = $namespace.'Value'; |
|
806 | 806 | |
807 | 807 | $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0; |
808 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
808 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
809 | 809 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
810 | 810 | |
811 | 811 | $mDesc = ''; |
@@ -839,10 +839,10 @@ discard block |
||
839 | 839 | $clientClone = clone $client; |
840 | 840 | $function = function() use($clientClone, $methodName, $extraOptions, $mSig) |
841 | 841 | { |
842 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
842 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
843 | 843 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
844 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
845 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
844 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
845 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
846 | 846 | if (isset($extraOptions['return_on_fault'])) { |
847 | 847 | $decodeFault = true; |
848 | 848 | $faultResponse = $extraOptions['return_on_fault']; |
@@ -851,9 +851,9 @@ discard block |
||
851 | 851 | } |
852 | 852 | |
853 | 853 | $namespace = '\\PhpXmlRpc\\'; |
854 | - $reqClass = $namespace . 'Request'; |
|
855 | - $encoderClass = $namespace . 'Encoder'; |
|
856 | - $valueClass = $namespace . 'Value'; |
|
854 | + $reqClass = $namespace.'Request'; |
|
855 | + $encoderClass = $namespace.'Encoder'; |
|
856 | + $valueClass = $namespace.'Value'; |
|
857 | 857 | |
858 | 858 | $encoder = new $encoderClass(); |
859 | 859 | $encodeOptions = array(); |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | } |
877 | 877 | |
878 | 878 | $xmlrpcArgs = array(); |
879 | - foreach($currentArgs as $i => $arg) { |
|
879 | + foreach ($currentArgs as $i => $arg) { |
|
880 | 880 | if ($i == $maxArgs) { |
881 | 881 | break; |
882 | 882 | } |
@@ -924,13 +924,13 @@ discard block |
||
924 | 924 | * @param string $mDesc |
925 | 925 | * @return string[] keys: source, docstring |
926 | 926 | */ |
927 | - public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') |
|
927 | + public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '') |
|
928 | 928 | { |
929 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
929 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
930 | 930 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
931 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
932 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
933 | - $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0; |
|
931 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
932 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
933 | + $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0; |
|
934 | 934 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
935 | 935 | if (isset($extraOptions['return_on_fault'])) { |
936 | 936 | $decodeFault = true; |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | $namespace = '\\PhpXmlRpc\\'; |
944 | 944 | |
945 | 945 | $code = "function $newFuncName ("; |
946 | - if ($clientCopyMode < 2) { |
|
946 | + if ($clientCopyMode<2) { |
|
947 | 947 | // client copy mode 0 or 1 == full / partial client copy in emitted code |
948 | 948 | $verbatimClientCopy = !$clientCopyMode; |
949 | 949 | $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace); |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | |
959 | 959 | if ($mDesc != '') { |
960 | 960 | // take care that PHP comment is not terminated unwillingly by method description |
961 | - $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n"; |
|
961 | + $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n"; |
|
962 | 962 | } else { |
963 | 963 | $mDesc = "/**\nFunction $newFuncName\n"; |
964 | 964 | } |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | $innerCode .= "\$encoder = new {$namespace}Encoder();\n"; |
968 | 968 | $plist = array(); |
969 | 969 | $pCount = count($mSig); |
970 | - for ($i = 1; $i < $pCount; $i++) { |
|
970 | + for ($i = 1; $i<$pCount; $i++) { |
|
971 | 971 | $plist[] = "\$p$i"; |
972 | 972 | $pType = $mSig[$i]; |
973 | 973 | if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' || |
@@ -983,19 +983,19 @@ discard block |
||
983 | 983 | } |
984 | 984 | } |
985 | 985 | $innerCode .= "\$req->addparam(\$p$i);\n"; |
986 | - $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n"; |
|
986 | + $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n"; |
|
987 | 987 | } |
988 | - if ($clientCopyMode < 2) { |
|
988 | + if ($clientCopyMode<2) { |
|
989 | 989 | $plist[] = '$debug=0'; |
990 | 990 | $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n"; |
991 | 991 | } |
992 | 992 | $plist = implode(', ', $plist); |
993 | - $mDesc .= '* @return {$namespace}Response|' . $this->xmlrpc2PhpType($mSig[0]) . " (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
993 | + $mDesc .= '* @return {$namespace}Response|'.$this->xmlrpc2PhpType($mSig[0])." (an {$namespace}Response obj instance if call fails)\n*/\n"; |
|
994 | 994 | |
995 | 995 | $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n"; |
996 | 996 | if ($decodeFault) { |
997 | 997 | if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) { |
998 | - $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')"; |
|
998 | + $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')"; |
|
999 | 999 | } else { |
1000 | 1000 | $respCode = var_export($faultResponse, true); |
1001 | 1001 | } |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());"; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - $code = $code . $plist . ") {\n" . $innerCode . "\n}\n"; |
|
1011 | + $code = $code.$plist.") {\n".$innerCode."\n}\n"; |
|
1012 | 1012 | |
1013 | 1013 | return array('source' => $code, 'docstring' => $mDesc); |
1014 | 1014 | } |
@@ -1034,23 +1034,23 @@ discard block |
||
1034 | 1034 | public function wrapXmlrpcServer($client, $extraOptions = array()) |
1035 | 1035 | { |
1036 | 1036 | $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : ''; |
1037 | - $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0; |
|
1037 | + $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0; |
|
1038 | 1038 | $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : ''; |
1039 | 1039 | $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : ''; |
1040 | - $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false; |
|
1041 | - $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false; |
|
1040 | + $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false; |
|
1041 | + $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false; |
|
1042 | 1042 | $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true; |
1043 | 1043 | $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true; |
1044 | 1044 | $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc'; |
1045 | 1045 | $namespace = '\\PhpXmlRpc\\'; |
1046 | 1046 | |
1047 | - $reqClass = $namespace . 'Request'; |
|
1048 | - $decoderClass = $namespace . 'Encoder'; |
|
1047 | + $reqClass = $namespace.'Request'; |
|
1048 | + $decoderClass = $namespace.'Encoder'; |
|
1049 | 1049 | |
1050 | 1050 | $req = new $reqClass('system.listMethods'); |
1051 | 1051 | $response = $client->send($req, $timeout, $protocol); |
1052 | 1052 | if ($response->faultCode()) { |
1053 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server'); |
|
1053 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server'); |
|
1054 | 1054 | |
1055 | 1055 | return false; |
1056 | 1056 | } else { |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | $mList = $decoder->decode($mList); |
1061 | 1061 | } |
1062 | 1062 | if (!is_array($mList) || !count($mList)) { |
1063 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server'); |
|
1063 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server'); |
|
1064 | 1064 | |
1065 | 1065 | return false; |
1066 | 1066 | } else { |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | if ($newClassName != '') { |
1069 | 1069 | $xmlrpcClassName = $newClassName; |
1070 | 1070 | } else { |
1071 | - $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1072 | - array('_', ''), $client->server) . '_client'; |
|
1071 | + $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'), |
|
1072 | + array('_', ''), $client->server).'_client'; |
|
1073 | 1073 | } |
1074 | 1074 | while ($buildIt && class_exists($xmlrpcClassName)) { |
1075 | 1075 | $xmlrpcClassName .= 'x'; |
@@ -1100,20 +1100,20 @@ discard block |
||
1100 | 1100 | if (!$buildIt) { |
1101 | 1101 | $source .= $methodWrap['docstring']; |
1102 | 1102 | } |
1103 | - $source .= $methodWrap['source'] . "\n"; |
|
1103 | + $source .= $methodWrap['source']."\n"; |
|
1104 | 1104 | } else { |
1105 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName); |
|
1105 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName); |
|
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | } |
1109 | 1109 | $source .= "}\n"; |
1110 | 1110 | if ($buildIt) { |
1111 | 1111 | $allOK = 0; |
1112 | - eval($source . '$allOK=1;'); |
|
1112 | + eval($source.'$allOK=1;'); |
|
1113 | 1113 | if ($allOK) { |
1114 | 1114 | return $xmlrpcClassName; |
1115 | 1115 | } else { |
1116 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server); |
|
1116 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server); |
|
1117 | 1117 | return false; |
1118 | 1118 | } |
1119 | 1119 | } else { |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @return string |
1136 | 1136 | */ |
1137 | - protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' ) |
|
1137 | + protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') |
|
1138 | 1138 | { |
1139 | - $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) . |
|
1140 | - "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n"; |
|
1139 | + $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path). |
|
1140 | + "', '".str_replace("'", "\'", $client->server)."', $client->port);\n"; |
|
1141 | 1141 | |
1142 | 1142 | // copy all client fields to the client that will be generated runtime |
1143 | 1143 | // (this provides for future expansion or subclassing of client obj) |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | // read chunk-size, chunk-extension (if any) and crlf |
26 | 26 | // get the position of the linebreak |
27 | - $chunkEnd = strpos($buffer, "\r\n") + 2; |
|
27 | + $chunkEnd = strpos($buffer, "\r\n")+2; |
|
28 | 28 | $temp = substr($buffer, 0, $chunkEnd); |
29 | 29 | $chunkSize = hexdec(trim($temp)); |
30 | 30 | $chunkStart = $chunkEnd; |
31 | - while ($chunkSize > 0) { |
|
32 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize); |
|
31 | + while ($chunkSize>0) { |
|
32 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize); |
|
33 | 33 | |
34 | 34 | // just in case we got a broken connection |
35 | 35 | if ($chunkEnd == false) { |
@@ -41,19 +41,19 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | // read chunk-data and crlf |
44 | - $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
44 | + $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
45 | 45 | // append chunk-data to entity-body |
46 | 46 | $new .= $chunk; |
47 | 47 | // length := length + chunk-size |
48 | 48 | $length += strlen($chunk); |
49 | 49 | // read chunk-size and crlf |
50 | - $chunkStart = $chunkEnd + 2; |
|
50 | + $chunkStart = $chunkEnd+2; |
|
51 | 51 | |
52 | - $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2; |
|
52 | + $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2; |
|
53 | 53 | if ($chunkEnd == false) { |
54 | 54 | break; //just in case we got a broken connection |
55 | 55 | } |
56 | - $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart); |
|
56 | + $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart); |
|
57 | 57 | $chunkSize = hexdec(trim($temp)); |
58 | 58 | $chunkStart = $chunkEnd; |
59 | 59 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return array with keys 'headers', 'cookies', 'raw_data' and 'status_code' |
71 | 71 | * @throws HttpException |
72 | 72 | */ |
73 | - public function parseResponseHeaders(&$data, $headersProcessed = false, $debug=0) |
|
73 | + public function parseResponseHeaders(&$data, $headersProcessed = false, $debug = 0) |
|
74 | 74 | { |
75 | 75 | $httpResponse = array('raw_data' => $data, 'headers'=> array(), 'cookies' => array(), 'status_code' => null); |
76 | 76 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | // (even though it is not valid http) |
81 | 81 | $pos = strpos($data, "\r\n\r\n"); |
82 | 82 | if ($pos || is_int($pos)) { |
83 | - $bd = $pos + 4; |
|
83 | + $bd = $pos+4; |
|
84 | 84 | } else { |
85 | 85 | $pos = strpos($data, "\n\n"); |
86 | 86 | if ($pos || is_int($pos)) { |
87 | - $bd = $pos + 2; |
|
87 | + $bd = $pos+2; |
|
88 | 88 | } else { |
89 | 89 | // No separation between response headers and body: fault? |
90 | 90 | $bd = 0; |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | // maybe we could take them into account, too? |
96 | 96 | $data = substr($data, $bd); |
97 | 97 | } else { |
98 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
98 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed'); |
|
99 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($httpResponse['status_code'] !== '200') { |
129 | - $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
130 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr); |
|
131 | - throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code'] ); |
|
129 | + $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
130 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr); |
|
131 | + throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | // be tolerant to usage of \n instead of \r\n to separate headers and data |
135 | 135 | // (even though it is not valid http) |
136 | 136 | $pos = strpos($data, "\r\n\r\n"); |
137 | 137 | if ($pos || is_int($pos)) { |
138 | - $bd = $pos + 4; |
|
138 | + $bd = $pos+4; |
|
139 | 139 | } else { |
140 | 140 | $pos = strpos($data, "\n\n"); |
141 | 141 | if ($pos || is_int($pos)) { |
142 | - $bd = $pos + 2; |
|
142 | + $bd = $pos+2; |
|
143 | 143 | } else { |
144 | 144 | // No separation between response headers and body: fault? |
145 | 145 | // we could take some action here instead of going on... |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | // be tolerant to line endings, and extra empty lines |
151 | 151 | $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos))); |
152 | 152 | |
153 | - foreach($ar as $line) { |
|
153 | + foreach ($ar as $line) { |
|
154 | 154 | // take care of multi-line headers and cookies |
155 | 155 | $arr = explode(':', $line, 2); |
156 | - if (count($arr) > 1) { |
|
156 | + if (count($arr)>1) { |
|
157 | 157 | $headerName = strtolower(trim($arr[0])); |
158 | 158 | /// @todo some other headers (the ones that allow a CSV list of values) |
159 | 159 | /// do allow many values to be passed using multiple header lines. |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // glue together all received cookies, using a comma to separate them |
173 | 173 | // (same as php does with getallheaders()) |
174 | 174 | if (isset($httpResponse['headers'][$headerName])) { |
175 | - $httpResponse['headers'][$headerName] .= ', ' . trim($cookie); |
|
175 | + $httpResponse['headers'][$headerName] .= ', '.trim($cookie); |
|
176 | 176 | } else { |
177 | 177 | $httpResponse['headers'][$headerName] = trim($cookie); |
178 | 178 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } elseif (isset($headerName)) { |
203 | 203 | /// @todo version1 cookies might span multiple lines, thus breaking the parsing above |
204 | - $httpResponse['headers'][$headerName] .= ' ' . trim($line); |
|
204 | + $httpResponse['headers'][$headerName] .= ' '.trim($line); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // Decode chunked encoding sent by http 1.1 servers |
226 | 226 | if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') { |
227 | 227 | if (!$data = static::decodeChunked($data)) { |
228 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server'); |
|
228 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server'); |
|
229 | 229 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']); |
230 | 230 | } |
231 | 231 | } |
@@ -240,19 +240,19 @@ discard block |
||
240 | 240 | if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) { |
241 | 241 | $data = $degzdata; |
242 | 242 | if ($debug) { |
243 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
243 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
244 | 244 | } |
245 | 245 | } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) { |
246 | 246 | $data = $degzdata; |
247 | 247 | if ($debug) { |
248 | - Logger::instance()->debugMessage("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---"); |
|
248 | + Logger::instance()->debugMessage("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---"); |
|
249 | 249 | } |
250 | 250 | } else { |
251 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server'); |
|
251 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server'); |
|
252 | 252 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']); |
253 | 253 | } |
254 | 254 | } else { |
255 | - Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
255 | + Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.'); |
|
256 | 256 | throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']); |
257 | 257 | } |
258 | 258 | } |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | - public static function getOpts($args=array(), $cliOpts=array()) |
|
65 | + public static function getOpts($args = array(), $cliOpts = array()) |
|
66 | 66 | { |
67 | - if (count($args) > 0) |
|
67 | + if (count($args)>0) |
|
68 | 68 | // throw new \Exception('Missing library version argument'); |
69 | 69 | self::$libVersion = $args[0]; |
70 | 70 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $out = ''; |
162 | 162 | while (($start = strpos($content, $startTag, $last)) !== false) { |
163 | 163 | $end = strpos($content, $endTag, $start); |
164 | - $code = substr($content, $start + strlen($startTag), $end - $start - strlen($startTag)); |
|
165 | - if ($code[strlen($code) - 1] == "\n") { |
|
164 | + $code = substr($content, $start+strlen($startTag), $end-$start-strlen($startTag)); |
|
165 | + if ($code[strlen($code)-1] == "\n") { |
|
166 | 166 | $code = substr($code, 0, -1); |
167 | 167 | } |
168 | 168 | |
169 | 169 | $code = str_replace(array('>', '<'), array('>', '<'), $code); |
170 | - $code = highlight_string('<?php ' . $code, true); |
|
170 | + $code = highlight_string('<?php '.$code, true); |
|
171 | 171 | $code = str_replace('<span style="color: #0000BB"><?php <br />', '<span style="color: #0000BB">', $code); |
172 | 172 | |
173 | - $out = $out . substr($content, $last, $start + strlen($startTag) - $last) . $code . $endTag; |
|
174 | - $last = $end + strlen($endTag); |
|
173 | + $out = $out.substr($content, $last, $start+strlen($startTag)-$last).$code.$endTag; |
|
174 | + $last = $end+strlen($endTag); |
|
175 | 175 | } |
176 | 176 | $out .= substr($content, $last, strlen($content)); |
177 | 177 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | use PhpXmlRpc\Builder; |
187 | 187 | |
188 | -function run_default($task=null, $args=array(), $cliOpts=array()) |
|
188 | +function run_default($task = null, $args = array(), $cliOpts = array()) |
|
189 | 189 | { |
190 | 190 | echo "Syntax: pake {\$pake-options} \$task \$lib-version [\$git-tag] {\$task-options}\n"; |
191 | 191 | echo "\n"; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | echo " --zip=ZIP Location of the zip tool\n"; |
203 | 203 | } |
204 | 204 | |
205 | -function run_getopts($task=null, $args=array(), $cliOpts=array()) |
|
205 | +function run_getopts($task = null, $args = array(), $cliOpts = array()) |
|
206 | 206 | { |
207 | 207 | Builder::getOpts($args, $cliOpts); |
208 | 208 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * Downloads source code in the build workspace directory, optionally checking out the given branch/tag |
212 | 212 | * @todo allow using current installation as source, bypassing git clone in workspace - at least for doc generation |
213 | 213 | */ |
214 | -function run_init($task=null, $args=array(), $cliOpts=array()) |
|
214 | +function run_init($task = null, $args = array(), $cliOpts = array()) |
|
215 | 215 | { |
216 | 216 | // download the current version into the workspace |
217 | 217 | $targetDir = Builder::workspaceDir(); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * (does nothing by itself, as all the steps are managed via task dependencies) |
241 | 241 | */ |
242 | -function run_build($task=null, $args=array(), $cliOpts=array()) |
|
242 | +function run_build($task = null, $args = array(), $cliOpts = array()) |
|
243 | 243 | { |
244 | 244 | } |
245 | 245 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * Generates documentation in all formats |
257 | 257 | */ |
258 | -function run_doc($task=null, $args=array(), $cliOpts=array()) |
|
258 | +function run_doc($task = null, $args = array(), $cliOpts = array()) |
|
259 | 259 | { |
260 | 260 | // in |
261 | 261 | $srcDir = Builder::workspaceDir(); |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | // from phpdoc comments using phpdocumentor |
268 | 268 | $cmd = Builder::tool('php'); |
269 | - pake_sh("$cmd " . Builder::toolsDir(). "/vendor/bin/phpdoc run --cache-folder ".Builder::buildDir()."/.phpdoc -d ".$srcDir.'/src'." -t ".$docDir.'/api --title PHP-XMLRPC'); |
|
269 | + pake_sh("$cmd ".Builder::toolsDir()."/vendor/bin/phpdoc run --cache-folder ".Builder::buildDir()."/.phpdoc -d ".$srcDir.'/src'." -t ".$docDir.'/api --title PHP-XMLRPC'); |
|
270 | 270 | |
271 | 271 | // from phpdoc comments using Sami |
272 | 272 | // deprecated on 2021/12, as Sami is abandonware |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * Creates the tarballs for a release |
349 | 349 | */ |
350 | -function run_dist($task=null, $args=array(), $cliOpts=array()) |
|
350 | +function run_dist($task = null, $args = array(), $cliOpts = array()) |
|
351 | 351 | { |
352 | 352 | // copy workspace dir into dist dir, without git |
353 | 353 | pake_mkdirs(Builder::distDir()); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // create tarballs |
362 | 362 | $cwd = getcwd(); |
363 | 363 | chdir(dirname(Builder::distDir())); |
364 | - foreach(Builder::distFiles() as $distFile) { |
|
364 | + foreach (Builder::distFiles() as $distFile) { |
|
365 | 365 | // php can not really create good zip files via phar: they are not compressed! |
366 | 366 | if (substr($distFile, -4) == '.zip') { |
367 | 367 | $cmd = Builder::tool('zip'); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | chdir($cwd); |
380 | 380 | } |
381 | 381 | |
382 | -function run_clean_workspace($task=null, $args=array(), $cliOpts=array()) |
|
382 | +function run_clean_workspace($task = null, $args = array(), $cliOpts = array()) |
|
383 | 383 | { |
384 | 384 | pake_remove_dir(Builder::workspaceDir()); |
385 | 385 | } |
@@ -388,13 +388,13 @@ discard block |
||
388 | 388 | * Cleans up the whole build directory |
389 | 389 | * @todo 'make clean' usually just removes the results of the build, distclean removes all but sources |
390 | 390 | */ |
391 | -function run_clean($task=null, $args=array(), $cliOpts=array()) |
|
391 | +function run_clean($task = null, $args = array(), $cliOpts = array()) |
|
392 | 392 | { |
393 | 393 | pake_remove_dir(Builder::buildDir()); |
394 | 394 | } |
395 | 395 | |
396 | 396 | // helper task: display help text |
397 | -pake_task( 'default' ); |
|
397 | +pake_task('default'); |
|
398 | 398 | // internal task: parse cli options |
399 | 399 | pake_task('getopts'); |
400 | 400 | pake_task('init', 'getopts'); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | $server = $parts['host']; |
152 | 152 | $path = isset($parts['path']) ? $parts['path'] : ''; |
153 | 153 | if (isset($parts['query'])) { |
154 | - $path .= '?' . $parts['query']; |
|
154 | + $path .= '?'.$parts['query']; |
|
155 | 155 | } |
156 | 156 | if (isset($parts['fragment'])) { |
157 | - $path .= '#' . $parts['fragment']; |
|
157 | + $path .= '#'.$parts['fragment']; |
|
158 | 158 | } |
159 | 159 | if (isset($parts['port'])) { |
160 | 160 | $port = $parts['port']; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | if ($path == '' || $path[0] != '/') { |
173 | - $this->path = '/' . $path; |
|
173 | + $this->path = '/'.$path; |
|
174 | 174 | } else { |
175 | 175 | $this->path = $path; |
176 | 176 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | }*/ |
209 | 209 | |
210 | 210 | // initialize user_agent string |
211 | - $this->user_agent = PhpXmlRpc::$xmlrpcName . ' ' . PhpXmlRpc::$xmlrpcVersion; |
|
211 | + $this->user_agent = PhpXmlRpc::$xmlrpcName.' '.PhpXmlRpc::$xmlrpcVersion; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | */ |
582 | 582 | protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', |
583 | 583 | $authType = 1, $proxyHost = '', $proxyPort = 0, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, |
584 | - $method='http') |
|
584 | + $method = 'http') |
|
585 | 585 | { |
586 | 586 | //trigger_error('Method ' . __METHOD__ . ' is deprecated', E_USER_DEPRECATED); |
587 | 587 | |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | * @param int $sslVersion |
614 | 614 | * @return Response |
615 | 615 | */ |
616 | - protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
616 | + protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', |
|
617 | 617 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
618 | 618 | $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $keepAlive = false, $key = '', $keyPass = '', |
619 | 619 | $sslVersion = 0) |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | */ |
651 | 651 | protected function sendPayloadSocket($req, $server, $port, $timeout = 0, $username = '', $password = '', |
652 | 652 | $authType = 1, $cert = '', $certPass = '', $caCert = '', $caCertDir = '', $proxyHost = '', $proxyPort = 0, |
653 | - $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method='http', $key = '', $keyPass = '', |
|
653 | + $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1, $method = 'http', $key = '', $keyPass = '', |
|
654 | 654 | $sslVersion = 0) |
655 | 655 | { |
656 | 656 | if ($port == 0) { |
657 | - $port = ( $method === 'https' ) ? 443 : 80; |
|
657 | + $port = ($method === 'https') ? 443 : 80; |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | // Only create the payload if it was not created previously |
@@ -684,15 +684,15 @@ discard block |
||
684 | 684 | // thanks to Grant Rauscher <[email protected]> for this |
685 | 685 | $credentials = ''; |
686 | 686 | if ($username != '') { |
687 | - $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n"; |
|
687 | + $credentials = 'Authorization: Basic '.base64_encode($username.':'.$password)."\r\n"; |
|
688 | 688 | if ($authType != 1) { |
689 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0'); |
|
689 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0'); |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | 693 | $acceptedEncoding = ''; |
694 | 694 | if (is_array($this->accepted_compression) && count($this->accepted_compression)) { |
695 | - $acceptedEncoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n"; |
|
695 | + $acceptedEncoding = 'Accept-Encoding: '.implode(', ', $this->accepted_compression)."\r\n"; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | $proxyCredentials = ''; |
@@ -703,17 +703,17 @@ discard block |
||
703 | 703 | $connectServer = $proxyHost; |
704 | 704 | $connectPort = $proxyPort; |
705 | 705 | $transport = 'tcp'; |
706 | - $uri = 'http://' . $server . ':' . $port . $this->path; |
|
706 | + $uri = 'http://'.$server.':'.$port.$this->path; |
|
707 | 707 | if ($proxyUsername != '') { |
708 | 708 | if ($proxyAuthType != 1) { |
709 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
709 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0'); |
|
710 | 710 | } |
711 | - $proxyCredentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyUsername . ':' . $proxyPassword) . "\r\n"; |
|
711 | + $proxyCredentials = 'Proxy-Authorization: Basic '.base64_encode($proxyUsername.':'.$proxyPassword)."\r\n"; |
|
712 | 712 | } |
713 | 713 | } else { |
714 | 714 | $connectServer = $server; |
715 | 715 | $connectPort = $port; |
716 | - $transport = ( $method === 'https' ) ? 'tls' : 'tcp'; |
|
716 | + $transport = ($method === 'https') ? 'tls' : 'tcp'; |
|
717 | 717 | $uri = $this->path; |
718 | 718 | } |
719 | 719 | |
@@ -723,45 +723,45 @@ discard block |
||
723 | 723 | $version = ''; |
724 | 724 | foreach ($this->cookies as $name => $cookie) { |
725 | 725 | if ($cookie['version']) { |
726 | - $version = ' $Version="' . $cookie['version'] . '";'; |
|
727 | - $cookieHeader .= ' ' . $name . '="' . $cookie['value'] . '";'; |
|
726 | + $version = ' $Version="'.$cookie['version'].'";'; |
|
727 | + $cookieHeader .= ' '.$name.'="'.$cookie['value'].'";'; |
|
728 | 728 | if ($cookie['path']) { |
729 | - $cookieHeader .= ' $Path="' . $cookie['path'] . '";'; |
|
729 | + $cookieHeader .= ' $Path="'.$cookie['path'].'";'; |
|
730 | 730 | } |
731 | 731 | if ($cookie['domain']) { |
732 | - $cookieHeader .= ' $Domain="' . $cookie['domain'] . '";'; |
|
732 | + $cookieHeader .= ' $Domain="'.$cookie['domain'].'";'; |
|
733 | 733 | } |
734 | 734 | if ($cookie['port']) { |
735 | - $cookieHeader .= ' $Port="' . $cookie['port'] . '";'; |
|
735 | + $cookieHeader .= ' $Port="'.$cookie['port'].'";'; |
|
736 | 736 | } |
737 | 737 | } else { |
738 | - $cookieHeader .= ' ' . $name . '=' . $cookie['value'] . ";"; |
|
738 | + $cookieHeader .= ' '.$name.'='.$cookie['value'].";"; |
|
739 | 739 | } |
740 | 740 | } |
741 | - $cookieHeader = 'Cookie:' . $version . substr($cookieHeader, 0, -1) . "\r\n"; |
|
741 | + $cookieHeader = 'Cookie:'.$version.substr($cookieHeader, 0, -1)."\r\n"; |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | // omit port if default |
745 | 745 | if (($port == 80 && in_array($method, array('http', 'http10'))) || ($port == 443 && $method == 'https')) { |
746 | - $port = ''; |
|
746 | + $port = ''; |
|
747 | 747 | } else { |
748 | - $port = ':' . $port; |
|
748 | + $port = ':'.$port; |
|
749 | 749 | } |
750 | 750 | |
751 | - $op = 'POST ' . $uri . " HTTP/1.0\r\n" . |
|
752 | - 'User-Agent: ' . $this->user_agent . "\r\n" . |
|
753 | - 'Host: ' . $server . $port . "\r\n" . |
|
754 | - $credentials . |
|
755 | - $proxyCredentials . |
|
756 | - $acceptedEncoding . |
|
757 | - $encodingHdr . |
|
758 | - 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings) . "\r\n" . |
|
759 | - $cookieHeader . |
|
760 | - 'Content-Type: ' . $req->content_type . "\r\nContent-Length: " . |
|
761 | - strlen($payload) . "\r\n\r\n" . |
|
751 | + $op = 'POST '.$uri." HTTP/1.0\r\n". |
|
752 | + 'User-Agent: '.$this->user_agent."\r\n". |
|
753 | + 'Host: '.$server.$port."\r\n". |
|
754 | + $credentials. |
|
755 | + $proxyCredentials. |
|
756 | + $acceptedEncoding. |
|
757 | + $encodingHdr. |
|
758 | + 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)."\r\n". |
|
759 | + $cookieHeader. |
|
760 | + 'Content-Type: '.$req->content_type."\r\nContent-Length: ". |
|
761 | + strlen($payload)."\r\n\r\n". |
|
762 | 762 | $payload; |
763 | 763 | |
764 | - if ($this->debug > 1) { |
|
764 | + if ($this->debug>1) { |
|
765 | 765 | $this->getLogger()->debugMessage("---SENDING---\n$op\n---END---"); |
766 | 766 | } |
767 | 767 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | |
789 | 789 | $context = stream_context_create($contextOptions); |
790 | 790 | |
791 | - if ($timeout <= 0) { |
|
791 | + if ($timeout<=0) { |
|
792 | 792 | $connectTimeout = ini_get('default_socket_timeout'); |
793 | 793 | } else { |
794 | 794 | $connectTimeout = $timeout; |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $fp = @stream_socket_client("$transport://$connectServer:$connectPort", $this->errno, $this->errstr, $connectTimeout, |
801 | 801 | STREAM_CLIENT_CONNECT, $context); |
802 | 802 | if ($fp) { |
803 | - if ($timeout > 0) { |
|
803 | + if ($timeout>0) { |
|
804 | 804 | stream_set_timeout($fp, $timeout); |
805 | 805 | } |
806 | 806 | } else { |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | $this->errstr = $err['message']; |
810 | 810 | } |
811 | 811 | |
812 | - $this->errstr = 'Connect error: ' . $this->errstr; |
|
813 | - $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr . ' (' . $this->errno . ')'); |
|
812 | + $this->errstr = 'Connect error: '.$this->errstr; |
|
813 | + $r = new Response(0, PhpXmlRpc::$xmlrpcerr['http_error'], $this->errstr.' ('.$this->errno.')'); |
|
814 | 814 | |
815 | 815 | return $r; |
816 | 816 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $encodingHdr = ''; |
921 | 921 | } |
922 | 922 | |
923 | - if ($this->debug > 1) { |
|
923 | + if ($this->debug>1) { |
|
924 | 924 | $this->getLogger()->debugMessage("---SENDING---\n$payload\n---END---"); |
925 | 925 | } |
926 | 926 | |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | $protocol = $method; |
935 | 935 | } |
936 | 936 | } |
937 | - $curl = curl_init($protocol . '://' . $server . ':' . $port . $this->path); |
|
937 | + $curl = curl_init($protocol.'://'.$server.':'.$port.$this->path); |
|
938 | 938 | if ($keepAlive) { |
939 | 939 | $this->xmlrpc_curl_handle = $curl; |
940 | 940 | } |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | // results into variable |
946 | 946 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); |
947 | 947 | |
948 | - if ($this->debug > 1) { |
|
948 | + if ($this->debug>1) { |
|
949 | 949 | curl_setopt($curl, CURLOPT_VERBOSE, true); |
950 | 950 | /// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered |
951 | 951 | } |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | } |
971 | 971 | } |
972 | 972 | // extra headers |
973 | - $headers = array('Content-Type: ' . $req->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings)); |
|
973 | + $headers = array('Content-Type: '.$req->content_type, 'Accept-Charset: '.implode(',', $this->accepted_charset_encodings)); |
|
974 | 974 | // if no keepalive is wanted, let the server know it in advance |
975 | 975 | if (!$keepAlive) { |
976 | 976 | $headers[] = 'Connection: close'; |
@@ -987,10 +987,10 @@ discard block |
||
987 | 987 | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
988 | 988 | // timeout is borked |
989 | 989 | if ($timeout) { |
990 | - curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1); |
|
990 | + curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout-1); |
|
991 | 991 | } |
992 | 992 | |
993 | - switch($method) { |
|
993 | + switch ($method) { |
|
994 | 994 | case 'http10': |
995 | 995 | curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
996 | 996 | break; |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | if ($username && $password) { |
1009 | - curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password); |
|
1009 | + curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password); |
|
1010 | 1010 | if (defined('CURLOPT_HTTPAUTH')) { |
1011 | 1011 | curl_setopt($curl, CURLOPT_HTTPAUTH, $authType); |
1012 | 1012 | } elseif ($authType != 1) { |
1013 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1013 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install'); |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
@@ -1052,13 +1052,13 @@ discard block |
||
1052 | 1052 | if ($proxyPort == 0) { |
1053 | 1053 | $proxyPort = 8080; // NB: even for HTTPS, local connection is on port 8080 |
1054 | 1054 | } |
1055 | - curl_setopt($curl, CURLOPT_PROXY, $proxyHost . ':' . $proxyPort); |
|
1055 | + curl_setopt($curl, CURLOPT_PROXY, $proxyHost.':'.$proxyPort); |
|
1056 | 1056 | if ($proxyUsername) { |
1057 | - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername . ':' . $proxyPassword); |
|
1057 | + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyUsername.':'.$proxyPassword); |
|
1058 | 1058 | if (defined('CURLOPT_PROXYAUTH')) { |
1059 | 1059 | curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyAuthType); |
1060 | 1060 | } elseif ($proxyAuthType != 1) { |
1061 | - $this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1061 | + $this->getLogger()->errorLog('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install'); |
|
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | } |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | if (count($this->cookies)) { |
1069 | 1069 | $cookieHeader = ''; |
1070 | 1070 | foreach ($this->cookies as $name => $cookie) { |
1071 | - $cookieHeader .= $name . '=' . $cookie['value'] . '; '; |
|
1071 | + $cookieHeader .= $name.'='.$cookie['value'].'; '; |
|
1072 | 1072 | } |
1073 | 1073 | curl_setopt($curl, CURLOPT_COOKIE, substr($cookieHeader, 0, -2)); |
1074 | 1074 | } |
@@ -1079,13 +1079,13 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | $result = curl_exec($curl); |
1081 | 1081 | |
1082 | - if ($this->debug > 1) { |
|
1082 | + if ($this->debug>1) { |
|
1083 | 1083 | $message = "---CURL INFO---\n"; |
1084 | 1084 | foreach (curl_getinfo($curl) as $name => $val) { |
1085 | 1085 | if (is_array($val)) { |
1086 | 1086 | $val = implode("\n", $val); |
1087 | 1087 | } |
1088 | - $message .= $name . ': ' . $val . "\n"; |
|
1088 | + $message .= $name.': '.$val."\n"; |
|
1089 | 1089 | } |
1090 | 1090 | $message .= '---END---'; |
1091 | 1091 | $this->getLogger()->debugMessage($message); |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | /// @todo we should use a better check here - what if we get back '' or '0'? |
1096 | 1096 | |
1097 | 1097 | $this->errstr = 'no response'; |
1098 | - $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'] . ': ' . curl_error($curl)); |
|
1098 | + $resp = new Response(0, PhpXmlRpc::$xmlrpcerr['curl_fail'], PhpXmlRpc::$xmlrpcstr['curl_fail'].': '.curl_error($curl)); |
|
1099 | 1099 | curl_close($curl); |
1100 | 1100 | if ($keepAlive) { |
1101 | 1101 | $this->xmlrpc_curl_handle = null; |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | $call['methodName'] = new Value($req->method(), 'string'); |
1206 | 1206 | $numParams = $req->getNumParams(); |
1207 | 1207 | $params = array(); |
1208 | - for ($i = 0; $i < $numParams; $i++) { |
|
1208 | + for ($i = 0; $i<$numParams; $i++) { |
|
1209 | 1209 | $params[$i] = $req->getParam($i); |
1210 | 1210 | } |
1211 | 1211 | $call['params'] = new Value($params, 'array'); |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | /// @todo test this code branch... |
1232 | 1232 | $rets = $result->value(); |
1233 | 1233 | if (!is_array($rets)) { |
1234 | - return false; // bad return type from system.multicall |
|
1234 | + return false; // bad return type from system.multicall |
|
1235 | 1235 | } |
1236 | 1236 | $numRets = count($rets); |
1237 | 1237 | if ($numRets != count($reqs)) { |
1238 | - return false; // wrong number of return values. |
|
1238 | + return false; // wrong number of return values. |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | $response = array(); |
1242 | - for ($i = 0; $i < $numRets; $i++) { |
|
1242 | + for ($i = 0; $i<$numRets; $i++) { |
|
1243 | 1243 | $val = $rets[$i]; |
1244 | 1244 | if (!is_array($val)) { |
1245 | 1245 | return false; |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | switch (count($val)) { |
1248 | 1248 | case 1: |
1249 | 1249 | if (!isset($val[0])) { |
1250 | - return false; // Bad value |
|
1250 | + return false; // Bad value |
|
1251 | 1251 | } |
1252 | 1252 | // Normal return value |
1253 | 1253 | $response[$i] = new Response($val[0], 0, '', 'phpvals'); |
@@ -1275,19 +1275,19 @@ discard block |
||
1275 | 1275 | |
1276 | 1276 | $rets = $result->value(); |
1277 | 1277 | if ($rets->kindOf() != 'array') { |
1278 | - return false; // bad return type from system.multicall |
|
1278 | + return false; // bad return type from system.multicall |
|
1279 | 1279 | } |
1280 | 1280 | $numRets = $rets->count(); |
1281 | 1281 | if ($numRets != count($reqs)) { |
1282 | - return false; // wrong number of return values. |
|
1282 | + return false; // wrong number of return values. |
|
1283 | 1283 | } |
1284 | 1284 | |
1285 | 1285 | $response = array(); |
1286 | - foreach($rets as $val) { |
|
1286 | + foreach ($rets as $val) { |
|
1287 | 1287 | switch ($val->kindOf()) { |
1288 | 1288 | case 'array': |
1289 | 1289 | if ($val->count() != 1) { |
1290 | - return false; // Bad value |
|
1290 | + return false; // Bad value |
|
1291 | 1291 | } |
1292 | 1292 | // Normal return value |
1293 | 1293 | $response[] = new Response($val[0]); |
@@ -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__ . '/PolyfillTestCase.php'; |
|
8 | +include_once __DIR__.'/PolyfillTestCase.php'; |
|
9 | 9 | |
10 | 10 | use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage; |
11 | 11 | use PHPUnit\Framework\TestResult; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | // (but only if not called from subclass objects / multitests) |
43 | 43 | if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') { |
44 | 44 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
45 | - for ($i = 0; $i < count($trace); $i++) { |
|
45 | + for ($i = 0; $i<count($trace); $i++) { |
|
46 | 46 | if (strpos($trace[$i]['function'], 'test') === 0) { |
47 | 47 | self::$failed_tests[$trace[$i]['function']] = true; |
48 | 48 | break; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function _run($result = NULL) |
67 | 67 | { |
68 | - $this->testId = get_class($this) . '__' . $this->getName(); |
|
68 | + $this->testId = get_class($this).'__'.$this->getName(); |
|
69 | 69 | |
70 | 70 | if ($result === NULL) { |
71 | 71 | $result = $this->createResult(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $this->args = argParser::getArgs(); |
97 | 97 | |
98 | 98 | $server = explode(':', $this->args['HTTPSERVER']); |
99 | - if (count($server) > 1) { |
|
99 | + if (count($server)>1) { |
|
100 | 100 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]); |
101 | 101 | } else { |
102 | 102 | $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $this->client->request_compression = $this->request_compression; |
107 | 107 | $this->client->accepted_compression = $this->accepted_compression; |
108 | 108 | |
109 | - $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] ); |
|
109 | + $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI']); |
|
110 | 110 | |
111 | 111 | if ($this->args['DEBUG'] == 1) |
112 | 112 | ob_start(); |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | } |
144 | 144 | $this->validateResponse($r); |
145 | 145 | if (is_array($errorCode)) { |
146 | - $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
146 | + $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
147 | 147 | } else { |
148 | - $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
148 | + $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
149 | 149 | } |
150 | 150 | if (!$r->faultCode()) { |
151 | 151 | if ($returnResponse) { |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | $query = parse_url($this->client->path, PHP_URL_QUERY); |
173 | 173 | parse_str($query, $vars); |
174 | 174 | $query = http_build_query(array_merge($vars, $data)); |
175 | - $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query; |
|
175 | + $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function testString() |
179 | 179 | { |
180 | - $sendString = "here are 3 \"entities\": < > & " . |
|
181 | - "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) . |
|
182 | - " - isn't that great? \\\"hackery\\\" at it's best " . |
|
183 | - " also don't want to miss out on \$item[0]. " . |
|
184 | - "The real weird stuff follows: CRLF here" . chr(13) . chr(10) . |
|
185 | - "a simple CR here" . chr(13) . |
|
186 | - "a simple LF here" . chr(10) . |
|
187 | - "and then LFCR" . chr(10) . chr(13) . |
|
188 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->"; |
|
180 | + $sendString = "here are 3 \"entities\": < > & ". |
|
181 | + "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92). |
|
182 | + " - isn't that great? \\\"hackery\\\" at it's best ". |
|
183 | + " also don't want to miss out on \$item[0]. ". |
|
184 | + "The real weird stuff follows: CRLF here".chr(13).chr(10). |
|
185 | + "a simple CR here".chr(13). |
|
186 | + "a simple LF here".chr(10). |
|
187 | + "and then LFCR".chr(10).chr(13). |
|
188 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->"; |
|
189 | 189 | $m = new xmlrpcmsg('examples.stringecho', array( |
190 | 190 | new xmlrpcval($sendString, 'string'), |
191 | 191 | )); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | public function testLatin1String() |
207 | 207 | { |
208 | 208 | $sendString = |
209 | - "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
209 | + "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne"; |
|
210 | 210 | $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'. |
211 | 211 | $sendString. |
212 | 212 | '</value></param></params></methodCall>'; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | public function testUtf8Method() |
311 | 311 | { |
312 | 312 | PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8'; |
313 | - $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array( |
|
313 | + $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array( |
|
314 | 314 | new xmlrpcval('hello') |
315 | 315 | )); |
316 | 316 | $v = $this->send($m); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | )); |
333 | 333 | $v = $this->send($m); |
334 | 334 | if ($v) { |
335 | - $this->assertEquals($a + $b, $v->scalarval()); |
|
335 | + $this->assertEquals($a+$b, $v->scalarval()); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | )); |
345 | 345 | $v = $this->send($m); |
346 | 346 | if ($v) { |
347 | - $this->assertEquals(12 - 23, $v->scalarval()); |
|
347 | + $this->assertEquals(12-23, $v->scalarval()); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | if ($v) { |
379 | 379 | $sz = $v->arraysize(); |
380 | 380 | $got = ''; |
381 | - for ($i = 0; $i < $sz; $i++) { |
|
381 | + for ($i = 0; $i<$sz; $i++) { |
|
382 | 382 | $b = $v->arraymem($i); |
383 | 383 | if ($b->scalarval()) { |
384 | 384 | $got .= '1'; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | $got = ''; |
442 | 442 | $expected = '37210'; |
443 | 443 | $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes'); |
444 | - foreach($expect_array as $val) { |
|
444 | + foreach ($expect_array as $val) { |
|
445 | 445 | $b = $v->structmem($val); |
446 | 446 | $got .= $b->me['int']; |
447 | 447 | } |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | { |
895 | 895 | // make a 'deep client copy' as the original one might have many properties set |
896 | 896 | // also for speed only wrap one method of the whole server |
897 | - $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' )); |
|
897 | + $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/')); |
|
898 | 898 | if ($class == '') { |
899 | 899 | $this->fail('Registration of remote server failed'); |
900 | 900 | } else { |
@@ -933,9 +933,9 @@ discard block |
||
933 | 933 | $cookies = array( |
934 | 934 | //'c1' => array(), |
935 | 935 | 'c2' => array('value' => 'c2'), |
936 | - 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30), |
|
937 | - 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'), |
|
938 | - 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
936 | + 'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30), |
|
937 | + 'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'), |
|
938 | + 'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'), |
|
939 | 939 | ); |
940 | 940 | $cookiesval = php_xmlrpc_encode($cookies); |
941 | 941 | $m = new xmlrpcmsg('examples.setcookies', array($cookiesval)); |
@@ -983,10 +983,10 @@ discard block |
||
983 | 983 | $m = new xmlrpcmsg('examples.getcookies', array()); |
984 | 984 | foreach ($cookies as $cookie => $val) { |
985 | 985 | $this->client->setCookie($cookie, $val); |
986 | - $cookies[$cookie] = (string)$cookies[$cookie]; |
|
986 | + $cookies[$cookie] = (string) $cookies[$cookie]; |
|
987 | 987 | } |
988 | 988 | $r = $this->client->send($m, $this->timeout, $this->method); |
989 | - $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString()); |
|
989 | + $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString()); |
|
990 | 990 | if (!$r->faultCode()) { |
991 | 991 | $v = $r->value(); |
992 | 992 | $v = php_xmlrpc_decode($v); |