Passed
Push — master ( 1a96d2...6722ee )
by Gaetano
04:55
created
src/Wrapper.php 1 patch
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
             $callable = explode('::', $callable);
160 160
         }
161 161
         if (is_array($callable)) {
162
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
162
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
163
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
164 164
                 return false;
165 165
             }
166 166
             if (is_string($callable[0])) {
167 167
                 $plainFuncName = implode('::', $callable);
168 168
             } elseif (is_object($callable[0])) {
169
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
169
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
170 170
             }
171 171
             $exists = method_exists($callable[0], $callable[1]);
172 172
         } else if ($callable instanceof \Closure) {
173 173
             // we do not support creating code which wraps closures, as php does not allow to serialize them
174 174
             if (!$buildIt) {
175
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
175
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
176 176
                 return false;
177 177
             }
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         if (!$exists) {
187
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
187
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
188 188
             return false;
189 189
         }
190 190
 
@@ -228,23 +228,23 @@  discard block
 block discarded – undo
228 228
         if (is_array($callable)) {
229 229
             $func = new \ReflectionMethod($callable[0], $callable[1]);
230 230
             if ($func->isPrivate()) {
231
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
231
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
232 232
                 return false;
233 233
             }
234 234
             if ($func->isProtected()) {
235
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
235
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
236 236
                 return false;
237 237
             }
238 238
             if ($func->isConstructor()) {
239
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
239
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
240 240
                 return false;
241 241
             }
242 242
             if ($func->isDestructor()) {
243
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
243
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
244 244
                 return false;
245 245
             }
246 246
             if ($func->isAbstract()) {
247
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
247
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
248 248
                 return false;
249 249
             }
250 250
             /// @todo add more checks for static vs. nonstatic?
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         if ($func->isInternal()) {
255 255
             // Note: from PHP 5.1.0 onward, we will possibly be able to use invokeargs
256 256
             // instead of getparameters to fully reflect internal php functions ?
257
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
257
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
258 258
             return false;
259 259
         }
260 260
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         $i = 0;
307 307
         foreach ($func->getParameters() as $paramObj) {
308 308
             $params[$i] = array();
309
-            $params[$i]['name'] = '$' . $paramObj->getName();
309
+            $params[$i]['name'] = '$'.$paramObj->getName();
310 310
             $params[$i]['isoptional'] = $paramObj->isOptional();
311 311
             $i++;
312 312
         }
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
             // build a signature
372 372
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
373 373
             $pSig = array($funcDesc['returnsDocs']);
374
-            for ($i = 0; $i < count($pars); $i++) {
374
+            for ($i = 0; $i<count($pars); $i++) {
375 375
                 $name = strtolower($funcDesc['params'][$i]['name']);
376 376
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
377 377
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
                 }
427 427
             }
428 428
             $numPars = $req->getNumParams();
429
-            if ($numPars < $minPars || $numPars > $maxPars) {
429
+            if ($numPars<$minPars || $numPars>$maxPars) {
430 430
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
431 431
             }
432 432
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
             $result = call_user_func_array($callable, $params);
441 441
 
442
-            if (! is_a($result, $responseClass)) {
442
+            if (!is_a($result, $responseClass)) {
443 443
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
444 444
                     $result = new $valueClass($result, $funcDesc['returns']);
445 445
                 } else {
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
         if ($newFuncName == '') {
475 475
             if (is_array($callable)) {
476 476
                 if (is_string($callable[0])) {
477
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
477
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
478 478
                 } else {
479
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
479
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
480 480
                 }
481 481
             } else {
482 482
                 if ($callable instanceof \Closure) {
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
     {
513 513
         $namespace = '\\PhpXmlRpc\\';
514 514
 
515
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
516
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
515
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
516
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
517 517
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
518 518
 
519 519
         $i = 0;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
         // build body of new function
549 549
 
550 550
         $innerCode = "\$paramCount = \$req->getNumParams();\n";
551
-        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
551
+        $innerCode .= "if (\$paramCount < $minPars || \$paramCount > $maxPars) return new {$namespace}Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
552 552
 
553 553
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
554 554
         if ($decodePhpObjects) {
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
         if (is_array($callable) && is_object($callable[0])) {
563 563
             self::$objHolder[$newFuncName] = $callable[0];
564 564
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
565
-            $realFuncName = '$obj->' . $callable[1];
565
+            $realFuncName = '$obj->'.$callable[1];
566 566
         } else {
567 567
             $realFuncName = $plainFuncName;
568 568
         }
569 569
         foreach ($parsVariations as $i => $pars) {
570
-            $innerCode .= "if (\$paramCount == " . count($pars) . ") \$retval = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
571
-            if ($i < (count($parsVariations) - 1))
570
+            $innerCode .= "if (\$paramCount == ".count($pars).") \$retval = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
571
+            if ($i<(count($parsVariations)-1))
572 572
                 $innerCode .= "else\n";
573 573
         }
574 574
         $innerCode .= "if (is_a(\$retval, '{$namespace}Response')) return \$retval; else\n";
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
         // if($func->returnsReference())
586 586
         //     return false;
587 587
 
588
-        $code = "function $newFuncName(\$req) {\n" . $innerCode . "\n}";
588
+        $code = "function $newFuncName(\$req) {\n".$innerCode."\n}";
589 589
 
590 590
         return $code;
591 591
     }
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
                         if ($methodWrap) {
623 623
                             if (is_object($className)) {
624 624
                                 $realClassName = get_class($className);
625
-                            }else {
625
+                            } else {
626 626
                                 $realClassName = $className;
627 627
                             }
628 628
                             $results[$prefix."$realClassName.$mName"] = $methodWrap;
@@ -723,21 +723,21 @@  discard block
 block discarded – undo
723 723
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
724 724
     {
725 725
         $namespace = '\\PhpXmlRpc\\';
726
-        $reqClass = $namespace . 'Request';
727
-        $valClass = $namespace . 'Value';
728
-        $decoderClass = $namespace . 'Encoder';
726
+        $reqClass = $namespace.'Request';
727
+        $valClass = $namespace.'Value';
728
+        $decoderClass = $namespace.'Encoder';
729 729
 
730 730
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
731
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
731
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
732 732
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
733
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
733
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
734 734
 
735 735
         $req = new $reqClass('system.methodSignature');
736 736
         $req->addparam(new $valClass($methodName));
737 737
         $client->setDebug($debug);
738 738
         $response = $client->send($req, $timeout, $protocol);
739 739
         if ($response->faultCode()) {
740
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
740
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
741 741
             return false;
742 742
         }
743 743
 
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
             $mSig = $decoder->decode($mSig);
748 748
         }
749 749
 
750
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
751
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
750
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
751
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
752 752
             return false;
753 753
         }
754 754
 
@@ -764,11 +764,11 @@  discard block
 block discarded – undo
764 764
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
765 765
     {
766 766
         $namespace = '\\PhpXmlRpc\\';
767
-        $reqClass = $namespace . 'Request';
768
-        $valClass = $namespace . 'Value';
767
+        $reqClass = $namespace.'Request';
768
+        $valClass = $namespace.'Value';
769 769
 
770 770
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
771
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
771
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
772 772
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
773 773
 
774 774
         $mDesc = '';
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
         $clientClone = clone $client;
803 803
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
804 804
         {
805
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
805
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
806 806
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
807
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
808
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
807
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
808
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
809 809
             if (isset($extraOptions['return_on_fault'])) {
810 810
                 $decodeFault = true;
811 811
                 $faultResponse = $extraOptions['return_on_fault'];
@@ -814,9 +814,9 @@  discard block
 block discarded – undo
814 814
             }
815 815
 
816 816
             $namespace = '\\PhpXmlRpc\\';
817
-            $reqClass = $namespace . 'Request';
818
-            $encoderClass = $namespace . 'Encoder';
819
-            $valueClass = $namespace . 'Value';
817
+            $reqClass = $namespace.'Request';
818
+            $encoderClass = $namespace.'Encoder';
819
+            $valueClass = $namespace.'Value';
820 820
 
821 821
             $encoder = new $encoderClass();
822 822
             $encodeOptions = array();
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
             }
840 840
 
841 841
             $xmlrpcArgs = array();
842
-            foreach($currentArgs as $i => $arg) {
842
+            foreach ($currentArgs as $i => $arg) {
843 843
                 if ($i == $maxArgs) {
844 844
                     break;
845 845
                 }
@@ -887,13 +887,13 @@  discard block
 block discarded – undo
887 887
      * @param string $mDesc
888 888
      * @return string[] keys: source, docstring
889 889
      */
890
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
890
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
891 891
     {
892
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
892
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
893 893
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
894
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
895
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
896
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
894
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
895
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
896
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
897 897
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
898 898
         if (isset($extraOptions['return_on_fault'])) {
899 899
             $decodeFault = true;
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
         $namespace = '\\PhpXmlRpc\\';
907 907
 
908 908
         $code = "function $newFuncName (";
909
-        if ($clientCopyMode < 2) {
909
+        if ($clientCopyMode<2) {
910 910
             // client copy mode 0 or 1 == full / partial client copy in emitted code
911 911
             $verbatimClientCopy = !$clientCopyMode;
912 912
             $innerCode = $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, $namespace);
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 
922 922
         if ($mDesc != '') {
923 923
             // take care that PHP comment is not terminated unwillingly by method description
924
-            $mDesc = "/**\n* " . str_replace('*/', '* /', $mDesc) . "\n";
924
+            $mDesc = "/**\n* ".str_replace('*/', '* /', $mDesc)."\n";
925 925
         } else {
926 926
             $mDesc = "/**\nFunction $newFuncName\n";
927 927
         }
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
         $innerCode .= "\$encoder = new {$namespace}Encoder();\n";
931 931
         $plist = array();
932 932
         $pCount = count($mSig);
933
-        for ($i = 1; $i < $pCount; $i++) {
933
+        for ($i = 1; $i<$pCount; $i++) {
934 934
             $plist[] = "\$p$i";
935 935
             $pType = $mSig[$i];
936 936
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
@@ -946,19 +946,19 @@  discard block
 block discarded – undo
946 946
                 }
947 947
             }
948 948
             $innerCode .= "\$req->addparam(\$p$i);\n";
949
-            $mDesc .= '* @param ' . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
949
+            $mDesc .= '* @param '.$this->xmlrpc2PhpType($pType)." \$p$i\n";
950 950
         }
951
-        if ($clientCopyMode < 2) {
951
+        if ($clientCopyMode<2) {
952 952
             $plist[] = '$debug=0';
953 953
             $mDesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
954 954
         }
955 955
         $plist = implode(', ', $plist);
956
-        $mDesc .= '* @return ' . $this->xmlrpc2PhpType($mSig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n";
956
+        $mDesc .= '* @return '.$this->xmlrpc2PhpType($mSig[0])." (or an {$namespace}Response obj instance if call fails)\n*/\n";
957 957
 
958 958
         $innerCode .= "\$res = \${$this_}client->send(\$req, $timeout, '$protocol');\n";
959 959
         if ($decodeFault) {
960 960
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
961
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
961
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
962 962
             } else {
963 963
                 $respCode = var_export($faultResponse, true);
964 964
             }
@@ -971,7 +971,7 @@  discard block
 block discarded – undo
971 971
             $innerCode .= "if (\$res->faultcode()) return $respCode; else return \$encoder->decode(\$res->value());";
972 972
         }
973 973
 
974
-        $code = $code . $plist . ") {\n" . $innerCode . "\n}\n";
974
+        $code = $code.$plist.") {\n".$innerCode."\n}\n";
975 975
 
976 976
         return array('source' => $code, 'docstring' => $mDesc);
977 977
     }
@@ -997,23 +997,23 @@  discard block
 block discarded – undo
997 997
     public function wrapXmlrpcServer($client, $extraOptions = array())
998 998
     {
999 999
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1000
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1000
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1001 1001
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1002 1002
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1003
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1004
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1003
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1004
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1005 1005
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1006 1006
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1007 1007
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1008 1008
         $namespace = '\\PhpXmlRpc\\';
1009 1009
 
1010
-        $reqClass = $namespace . 'Request';
1011
-        $decoderClass = $namespace . 'Encoder';
1010
+        $reqClass = $namespace.'Request';
1011
+        $decoderClass = $namespace.'Encoder';
1012 1012
 
1013 1013
         $req = new $reqClass('system.listMethods');
1014 1014
         $response = $client->send($req, $timeout, $protocol);
1015 1015
         if ($response->faultCode()) {
1016
-            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1016
+            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1017 1017
 
1018 1018
             return false;
1019 1019
         } else {
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
                 $mList = $decoder->decode($mList);
1024 1024
             }
1025 1025
             if (!is_array($mList) || !count($mList)) {
1026
-                Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1026
+                Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1027 1027
 
1028 1028
                 return false;
1029 1029
             } else {
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
                 if ($newClassName != '') {
1032 1032
                     $xmlrpcClassName = $newClassName;
1033 1033
                 } else {
1034
-                    $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
-                            array('_', ''), $client->server) . '_client';
1034
+                    $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1035
+                            array('_', ''), $client->server).'_client';
1036 1036
                 }
1037 1037
                 while ($buildIt && class_exists($xmlrpcClassName)) {
1038 1038
                     $xmlrpcClassName .= 'x';
@@ -1063,20 +1063,20 @@  discard block
 block discarded – undo
1063 1063
                             if (!$buildIt) {
1064 1064
                                 $source .= $methodWrap['docstring'];
1065 1065
                             }
1066
-                            $source .= $methodWrap['source'] . "\n";
1066
+                            $source .= $methodWrap['source']."\n";
1067 1067
                         } else {
1068
-                            Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1068
+                            Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1069 1069
                         }
1070 1070
                     }
1071 1071
                 }
1072 1072
                 $source .= "}\n";
1073 1073
                 if ($buildIt) {
1074 1074
                     $allOK = 0;
1075
-                    eval($source . '$allOK=1;');
1075
+                    eval($source.'$allOK=1;');
1076 1076
                     if ($allOK) {
1077 1077
                         return $xmlrpcClassName;
1078 1078
                     } else {
1079
-                        Logger::instance()->errorLog('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1079
+                        Logger::instance()->errorLog('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1080 1080
                         return false;
1081 1081
                     }
1082 1082
                 } else {
@@ -1097,10 +1097,10 @@  discard block
 block discarded – undo
1097 1097
      *
1098 1098
      * @return string
1099 1099
      */
1100
-    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\' )
1100
+    protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1101 1101
     {
1102
-        $code = "\$client = new {$namespace}Client('" . str_replace("'", "\'", $client->path) .
1103
-            "', '" . str_replace("'", "\'", $client->server) . "', $client->port);\n";
1102
+        $code = "\$client = new {$namespace}Client('".str_replace("'", "\'", $client->path).
1103
+            "', '".str_replace("'", "\'", $client->server)."', $client->port);\n";
1104 1104
 
1105 1105
         // copy all client fields to the client that will be generated runtime
1106 1106
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
tests/parse_args.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         // check for command line (env vars) vs. web page input params
45 45
         if (!isset($_SERVER['REQUEST_METHOD'])) {
46
-            foreach($_SERVER as $key => $val) {
46
+            foreach ($_SERVER as $key => $val) {
47 47
                 if (array_key_exists($key, $args)) {
48 48
                     $$key = $val;
49 49
                 }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             }
88 88
         }
89 89
         if ($HTTPURI[0] != '/') {
90
-            $HTTPURI = '/' . $HTTPURI;
90
+            $HTTPURI = '/'.$HTTPURI;
91 91
         }
92 92
         $args['HTTPURI'] = $HTTPURI;
93 93
 
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         if (isset($HTTPSIGNOREPEER)) {
104
-            $args['HTTPSIGNOREPEER'] = (bool)$HTTPSIGNOREPEER;
104
+            $args['HTTPSIGNOREPEER'] = (bool) $HTTPSIGNOREPEER;
105 105
         }
106 106
 
107 107
         if (isset($HTTPSVERIFYHOST)) {
108
-            $args['HTTPSVERIFYHOST'] = (int)$HTTPSVERIFYHOST;
108
+            $args['HTTPSVERIFYHOST'] = (int) $HTTPSVERIFYHOST;
109 109
         }
110 110
 
111 111
         if (isset($SSLVERSION)) {
112
-            $args['SSLVERSION'] = (int)$SSLVERSION;
112
+            $args['SSLVERSION'] = (int) $SSLVERSION;
113 113
         }
114 114
 
115 115
         if (isset($PROXYSERVER)) {
116 116
             $arr = explode(':', $PROXYSERVER);
117 117
             $args['PROXYSERVER'] = $arr[0];
118
-            if (count($arr) > 1) {
118
+            if (count($arr)>1) {
119 119
                 $args['PROXYPORT'] = $arr[1];
120 120
             } else {
121 121
                 $args['PROXYPORT'] = 8080;
Please login to merge, or discard this patch.
demo/server/discuss.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . "/_prepend.php";
3
+require_once __DIR__."/_prepend.php";
4 4
 
5 5
 use PhpXmlRpc\Value;
6 6
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
             $count = 0;
32 32
         }
33 33
         // add the new comment in
34
-        dba_insert($msgID . "_comment_${count}", $comment, $dbh);
35
-        dba_insert($msgID . "_name_${count}", $name, $dbh);
34
+        dba_insert($msgID."_comment_${count}", $comment, $dbh);
35
+        dba_insert($msgID."_name_${count}", $name, $dbh);
36 36
         $count++;
37 37
         dba_replace($countID, $count, $dbh);
38 38
         dba_close($dbh);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $countID = "${msgID}_count";
66 66
         if (dba_exists($countID, $dbh)) {
67 67
             $count = dba_fetch($countID, $dbh);
68
-            for ($i = 0; $i < $count; $i++) {
68
+            for ($i = 0; $i<$count; $i++) {
69 69
                 $name = dba_fetch("${msgID}_name_${i}", $dbh);
70 70
                 $comment = dba_fetch("${msgID}_comment_${i}", $dbh);
71 71
                 // push a new struct onto the return array
@@ -101,4 +101,4 @@  discard block
 block discarded – undo
101 101
     ),
102 102
 ));
103 103
 
104
-require_once __DIR__ . "/_append.php";
104
+require_once __DIR__."/_append.php";
Please login to merge, or discard this patch.
demo/server/_append.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 // Out-of-band information: let the client manipulate the server operations.
4 4
 // We do this to help the testsuite script: do not reproduce in production!
5 5
 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
6
-    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
6
+    include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
7 7
 }
Please login to merge, or discard this patch.
demo/server/proxy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @license code licensed under the BSD License: see file license.txt
10 10
  */
11 11
 
12
-require_once __DIR__ . "/_prepend.php";
12
+require_once __DIR__."/_prepend.php";
13 13
 
14 14
 /**
15 15
  * Forward an xmlrpc request to another server, and return to client the response received.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     $url = $encoder->decode($req->getParam(0));
30 30
     $client = new PhpXmlRpc\Client($url);
31 31
 
32
-    if ($req->getNumParams() > 3) {
32
+    if ($req->getNumParams()>3) {
33 33
         // we have to set some options onto the client.
34 34
         // Note that if we do not untaint the received values, warnings might be generated...
35 35
         $options = $encoder->decode($req->getParam(3));
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                     $client->setSSLVerifyPeer($val);
50 50
                     break;
51 51
                 case 'Timeout':
52
-                    $timeout = (integer)$val;
52
+                    $timeout = (integer) $val;
53 53
                     break;
54 54
             } // switch
55 55
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
     // add debug info into response we give back to caller
70
-    PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize());
70
+    PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize());
71 71
 
72 72
     return $client->send($req, $timeout);
73 73
 }
@@ -88,4 +88,4 @@  discard block
 block discarded – undo
88 88
     )
89 89
 );
90 90
 
91
-require_once __DIR__ . "/_append.php";
91
+require_once __DIR__."/_append.php";
Please login to merge, or discard this patch.
demo/client/introspect.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
1
+<?php require_once __DIR__."/_prepend.php"; ?><html lang="en">
2 2
 <head><title>xmlrpc - Introspect demo</title></head>
3 3
 <body>
4 4
 <h1>Introspect demo</h1>
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 function display_error($r)
11 11
 {
12 12
     print "An error occurred: ";
13
-    print "Code: " . $r->faultCode()
14
-        . " Reason: '" . $r->faultString() . "'<br/>";
13
+    print "Code: ".$r->faultCode()
14
+        . " Reason: '".$r->faultString()."'<br/>";
15 15
 }
16 16
 
17 17
 $client = new PhpXmlRpc\Client(XMLRPCSERVER);
18 18
 
19 19
 // First off, let's retrieve the list of methods available on the remote server
20
-print "<h3>methods available at http://" . $client->server . $client->path . "</h3>\n";
20
+print "<h3>methods available at http://".$client->server.$client->path."</h3>\n";
21 21
 $req = new PhpXmlRpc\Request('system.listMethods');
22 22
 $resp = $client->send($req);
23 23
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 
29 29
     // Then, retrieve the signature and help text of each available method
30 30
     foreach ($v as $methodName) {
31
-        print "<h4>" . $methodName->scalarval() . "</h4>\n";
31
+        print "<h4>".$methodName->scalarval()."</h4>\n";
32 32
         // build messages first, add params later
33 33
         $m1 = new PhpXmlRpc\Request('system.methodHelp');
34 34
         $m2 = new PhpXmlRpc\Request('system.methodSignature');
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
             if ($val->kindOf() == "array") {
60 60
                 foreach ($val as $x) {
61 61
                     $ret = $x[0];
62
-                    print "<code>" . htmlspecialchars($ret->scalarval()) . " "
63
-                        . htmlspecialchars($methodName->scalarval()) . "(";
64
-                    if ($x->count() > 1) {
65
-                        for ($k = 1; $k < $x->count(); $k++) {
62
+                    print "<code>".htmlspecialchars($ret->scalarval())." "
63
+                        . htmlspecialchars($methodName->scalarval())."(";
64
+                    if ($x->count()>1) {
65
+                        for ($k = 1; $k<$x->count(); $k++) {
66 66
                             $y = $x[$k];
67 67
                             print htmlspecialchars($y->scalarval());
68
-                            if ($k < $x->count() - 1) {
68
+                            if ($k<$x->count()-1) {
69 69
                                 print ", ";
70 70
                             }
71 71
                         }
@@ -81,4 +81,4 @@  discard block
 block discarded – undo
81 81
 }
82 82
 ?>
83 83
 </body>
84
-</html><?php require_once __DIR__ . "/_append.php"; ?>
84
+</html><?php require_once __DIR__."/_append.php"; ?>
Please login to merge, or discard this patch.
demo/client/getstatename.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
1
+<?php require_once __DIR__."/_prepend.php"; ?><html lang="en">
2 2
 <head><title>xmlrpc - Getstatename demo</title></head>
3 3
 <body>
4 4
 <h1>Getstatename demo</h1>
@@ -11,32 +11,32 @@  discard block
 block discarded – undo
11 11
 <?php
12 12
 
13 13
 if (isset($_POST["stateno"]) && $_POST["stateno"] != "") {
14
-    $stateNo = (integer)$_POST["stateno"];
14
+    $stateNo = (integer) $_POST["stateno"];
15 15
     $encoder = new PhpXmlRpc\Encoder();
16 16
     $req = new PhpXmlRpc\Request('examples.getStateName',
17 17
         array($encoder->encode($stateNo))
18 18
     );
19
-    print "Sending the following request:<pre>\n\n" . htmlentities($req->serialize()) . "\n\n</pre>Debug info of server data follows...\n\n";
19
+    print "Sending the following request:<pre>\n\n".htmlentities($req->serialize())."\n\n</pre>Debug info of server data follows...\n\n";
20 20
     $client = new PhpXmlRpc\Client(XMLRPCSERVER);
21 21
     $client->setDebug(1);
22 22
     $r = $client->send($req);
23 23
     if (!$r->faultCode()) {
24 24
         $v = $r->value();
25
-        print "<br/>State number <b>" . $stateNo . "</b> is <b>"
26
-            . htmlspecialchars($encoder->decode($v)) . "</b><br/><br/>";
25
+        print "<br/>State number <b>".$stateNo."</b> is <b>"
26
+            . htmlspecialchars($encoder->decode($v))."</b><br/><br/>";
27 27
     } else {
28 28
         print "An error occurred: ";
29
-        print "Code: " . htmlspecialchars($r->faultCode())
30
-            . " Reason: '" . htmlspecialchars($r->faultString()) . "'</pre><br/>";
29
+        print "Code: ".htmlspecialchars($r->faultCode())
30
+            . " Reason: '".htmlspecialchars($r->faultString())."'</pre><br/>";
31 31
     }
32 32
 } else {
33 33
     $stateNo = "";
34 34
 }
35 35
 
36 36
 print "<form action=\"getstatename.php\" method=\"POST\">
37
-<input name=\"stateno\" value=\"" . $stateNo . "\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
37
+<input name=\"stateno\" value=\"" . $stateNo."\"><input type=\"submit\" value=\"go\" name=\"submit\"></form>
38 38
 <p>Enter a state number to query its name</p>";
39 39
 
40 40
 ?>
41 41
 </body>
42
-</html><?php require_once __DIR__ . "/_append.php"; ?>
42
+</html><?php require_once __DIR__."/_append.php"; ?>
Please login to merge, or discard this patch.
demo/client/agesort.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
1
+<?php require_once __DIR__."/_prepend.php"; ?><html lang="en">
2 2
 <head><title>xmlrpc - Agesort demo</title></head>
3 3
 <body>
4 4
 <h1>Agesort demo</h1>
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 $inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
14 14
 print "This is the input data:<br/><pre>";
15 15
 foreach ($inAr as $key => $val) {
16
-    print $key . ", " . $val . "\n";
16
+    print $key.", ".$val."\n";
17 17
 }
18 18
 print "</pre>";
19 19
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     );
30 30
 }
31 31
 $v = new PhpXmlRpc\Value($p, "array");
32
-print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n";
32
+print "Encoded into xmlrpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n";
33 33
 
34 34
 // create client and message objects
35 35
 $req = new PhpXmlRpc\Request('examples.sortByAge', array($v));
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
     foreach ($value as $struct) {
50 50
         $name = $struct["name"];
51 51
         $age = $struct["age"];
52
-        print htmlspecialchars($name->scalarval()) . ", " . htmlspecialchars($age->scalarval()) . "\n";
52
+        print htmlspecialchars($name->scalarval()).", ".htmlspecialchars($age->scalarval())."\n";
53 53
     }
54 54
 
55
-    print "<hr/>For nerds: I got this value back<br/><pre>" .
56
-        htmlentities($resp->serialize()) . "</pre><hr/>\n";
55
+    print "<hr/>For nerds: I got this value back<br/><pre>".
56
+        htmlentities($resp->serialize())."</pre><hr/>\n";
57 57
 } else {
58 58
     print "An error occurred:<pre>";
59
-    print "Code: " . htmlspecialchars($resp->faultCode()) .
60
-        "\nReason: '" . htmlspecialchars($resp->faultString()) . '\'</pre><hr/>';
59
+    print "Code: ".htmlspecialchars($resp->faultCode()).
60
+        "\nReason: '".htmlspecialchars($resp->faultString()).'\'</pre><hr/>';
61 61
 }
62 62
 
63 63
 ?>
64 64
 </body>
65
-</html><?php require_once __DIR__ . "/_append.php"; ?>
65
+</html><?php require_once __DIR__."/_append.php"; ?>
Please login to merge, or discard this patch.
demo/client/wrap.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php require_once __DIR__ . "/_prepend.php"; ?><html lang="en">
1
+<?php require_once __DIR__."/_prepend.php"; ?><html lang="en">
2 2
 <head><title>xmlrpc - Webservice wrappper demo</title></head>
3 3
 <body>
4 4
 <h1>Webservice wrappper demo</h1>
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals
18 18
 $resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
19 19
 if ($resp->faultCode()) {
20
-    echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n";
20
+    echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n";
21 21
 } else {
22 22
     echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n";
23 23
     flush();
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
         if ($methodName == 'examples.getStateName') {
30 30
             $callable = $wrapper->wrapXmlrpcMethod($client, $methodName);
31 31
             if ($callable) {
32
-                echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n";
32
+                echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n";
33 33
             } else {
34
-                echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n";
34
+                echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n";
35 35
             }
36 36
             break;
37 37
         }
@@ -49,4 +49,4 @@  discard block
 block discarded – undo
49 49
 }
50 50
 ?>
51 51
 </body>
52
-</html><?php require_once __DIR__ . "/_append.php"; ?>
52
+</html><?php require_once __DIR__."/_append.php"; ?>
Please login to merge, or discard this patch.