Passed
Pull Request — master (#109)
by
unknown
06:45
created
src/Wrapper.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
             $callable = explode('::', $callable);
175 175
         }
176 176
         if (is_array($callable)) {
177
-            if (count($callable) < 2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
178
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': syntax for function to be wrapped is wrong');
177
+            if (count($callable)<2 || (!is_string($callable[0]) && !is_object($callable[0]))) {
178
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': syntax for function to be wrapped is wrong');
179 179
                 return false;
180 180
             }
181 181
             if (is_string($callable[0])) {
182 182
                 $plainFuncName = implode('::', $callable);
183 183
             } elseif (is_object($callable[0])) {
184
-                $plainFuncName = get_class($callable[0]) . '->' . $callable[1];
184
+                $plainFuncName = get_class($callable[0]).'->'.$callable[1];
185 185
             }
186 186
             $exists = method_exists($callable[0], $callable[1]);
187 187
         } else if ($callable instanceof \Closure) {
188 188
             // we do not support creating code which wraps closures, as php does not allow to serialize them
189 189
             if (!$buildIt) {
190
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': a closure can not be wrapped in generated source code');
190
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': a closure can not be wrapped in generated source code');
191 191
                 return false;
192 192
             }
193 193
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         }
200 200
 
201 201
         if (!$exists) {
202
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is not defined: ' . $plainFuncName);
202
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is not defined: '.$plainFuncName);
203 203
             return false;
204 204
         }
205 205
 
@@ -243,23 +243,23 @@  discard block
 block discarded – undo
243 243
         if (is_array($callable)) {
244 244
             $func = new \ReflectionMethod($callable[0], $callable[1]);
245 245
             if ($func->isPrivate()) {
246
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is private: ' . $plainFuncName);
246
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is private: '.$plainFuncName);
247 247
                 return false;
248 248
             }
249 249
             if ($func->isProtected()) {
250
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is protected: ' . $plainFuncName);
250
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is protected: '.$plainFuncName);
251 251
                 return false;
252 252
             }
253 253
             if ($func->isConstructor()) {
254
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the constructor: ' . $plainFuncName);
254
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the constructor: '.$plainFuncName);
255 255
                 return false;
256 256
             }
257 257
             if ($func->isDestructor()) {
258
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is the destructor: ' . $plainFuncName);
258
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is the destructor: '.$plainFuncName);
259 259
                 return false;
260 260
             }
261 261
             if ($func->isAbstract()) {
262
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': method to be wrapped is abstract: ' . $plainFuncName);
262
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': method to be wrapped is abstract: '.$plainFuncName);
263 263
                 return false;
264 264
             }
265 265
             /// @todo add more checks for static vs. nonstatic?
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         if ($func->isInternal()) {
270 270
             /// @todo from PHP 5.1.0 onward, we should be able to use invokeargs instead of getparameters to fully
271 271
             ///       reflect internal php functions
272
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': function to be wrapped is internal: ' . $plainFuncName);
272
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': function to be wrapped is internal: '.$plainFuncName);
273 273
             return false;
274 274
         }
275 275
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         $i = 0;
322 322
         foreach ($func->getParameters() as $paramObj) {
323 323
             $params[$i] = array();
324
-            $params[$i]['name'] = '$' . $paramObj->getName();
324
+            $params[$i]['name'] = '$'.$paramObj->getName();
325 325
             $params[$i]['isoptional'] = $paramObj->isOptional();
326 326
             $i++;
327 327
         }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             // build a signature
386 386
             $sig = array($this->php2XmlrpcType($funcDesc['returns']));
387 387
             $pSig = array($funcDesc['returnsDocs']);
388
-            for ($i = 0; $i < count($pars); $i++) {
388
+            for ($i = 0; $i<count($pars); $i++) {
389 389
                 $name = strtolower($funcDesc['params'][$i]['name']);
390 390
                 if (isset($funcDesc['paramDocs'][$name]['type'])) {
391 391
                     $sig[] = $this->php2XmlrpcType($funcDesc['paramDocs'][$name]['type']);
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                 }
442 442
             }
443 443
             $numPars = $req->getNumParams();
444
-            if ($numPars < $minPars || $numPars > $maxPars) {
444
+            if ($numPars<$minPars || $numPars>$maxPars) {
445 445
                 return new $responseClass(0, 3, 'Incorrect parameters passed to method');
446 446
             }
447 447
 
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
             $result = call_user_func_array($callable, $params);
456 456
 
457
-            if (! is_a($result, $responseClass)) {
457
+            if (!is_a($result, $responseClass)) {
458 458
                 // q: why not do the same for int, float, bool, string?
459 459
                 if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
460 460
                     $result = new $valueClass($result, $funcDesc['returns']);
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
         if ($newFuncName == '') {
494 494
             if (is_array($callable)) {
495 495
                 if (is_string($callable[0])) {
496
-                    $xmlrpcFuncName = "{$prefix}_" . implode('_', $callable);
496
+                    $xmlrpcFuncName = "{$prefix}_".implode('_', $callable);
497 497
                 } else {
498
-                    $xmlrpcFuncName = "{$prefix}_" . get_class($callable[0]) . '_' . $callable[1];
498
+                    $xmlrpcFuncName = "{$prefix}_".get_class($callable[0]).'_'.$callable[1];
499 499
                 }
500 500
             } else {
501 501
                 if ($callable instanceof \Closure) {
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
      */
528 528
     protected function buildWrapFunctionSource($callable, $newFuncName, $extraOptions, $plainFuncName, $funcDesc)
529 529
     {
530
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
531
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
532
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
530
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
531
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
532
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
533 533
         $catchWarnings = isset($extraOptions['suppress_warnings']) && $extraOptions['suppress_warnings'] ? '@' : '';
534 534
 
535 535
         $i = 0;
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
         // build body of new function
565 565
 
566 566
         $innerCode = "  \$paramCount = \$req->getNumParams();\n";
567
-        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new " . static::$namespace . "Response(0, " . PhpXmlRpc::$xmlrpcerr['incorrect_params'] . ", '" . PhpXmlRpc::$xmlrpcstr['incorrect_params'] . "');\n";
567
+        $innerCode .= "  if (\$paramCount < $minPars || \$paramCount > $maxPars) return new ".static::$namespace."Response(0, ".PhpXmlRpc::$xmlrpcerr['incorrect_params'].", '".PhpXmlRpc::$xmlrpcstr['incorrect_params']."');\n";
568 568
 
569
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
569
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
570 570
         if ($decodePhpObjects) {
571 571
             $innerCode .= "  \$params = \$encoder->decode(\$req, array('decode_php_objs'));\n";
572 572
         } else {
@@ -579,23 +579,23 @@  discard block
 block discarded – undo
579 579
             static::holdObject($newFuncName, $callable[0]);
580 580
             $class = get_class($callable[0]);
581 581
             if ($class[0] !== '\\') {
582
-                $class = '\\' . $class;
582
+                $class = '\\'.$class;
583 583
             }
584 584
             $innerCode .= "  /// @var $class \$obj\n";
585 585
             $innerCode .= "  \$obj = PhpXmlRpc\\Wrapper::getHeldObject('$newFuncName');\n";
586
-            $realFuncName = '$obj->' . $callable[1];
586
+            $realFuncName = '$obj->'.$callable[1];
587 587
         } else {
588 588
             $realFuncName = $plainFuncName;
589 589
         }
590 590
         foreach ($parsVariations as $i => $pars) {
591
-            $innerCode .= "  if (\$paramCount == " . count($pars) . ") \$retVal = {$catchWarnings}$realFuncName(" . implode(',', $pars) . ");\n";
592
-            if ($i < (count($parsVariations) - 1))
591
+            $innerCode .= "  if (\$paramCount == ".count($pars).") \$retVal = {$catchWarnings}$realFuncName(".implode(',', $pars).");\n";
592
+            if ($i<(count($parsVariations)-1))
593 593
                 $innerCode .= "  else\n";
594 594
         }
595
-        $innerCode .= "  if (is_a(\$retVal, '" . static::$namespace . "Response'))\n    return \$retVal;\n  else\n";
595
+        $innerCode .= "  if (is_a(\$retVal, '".static::$namespace."Response'))\n    return \$retVal;\n  else\n";
596 596
         /// q: why not do the same for int, float, bool, string?
597 597
         if ($funcDesc['returns'] == Value::$xmlrpcDateTime || $funcDesc['returns'] == Value::$xmlrpcBase64) {
598
-            $innerCode .= "    return new " . static::$namespace . "Response(new " . static::$namespace . "Value(\$retVal, '{$funcDesc['returns']}'));";
598
+            $innerCode .= "    return new ".static::$namespace."Response(new ".static::$namespace."Value(\$retVal, '{$funcDesc['returns']}'));";
599 599
         } else {
600 600
             $encodeOptions = array();
601 601
             if ($encodeNulls) {
@@ -606,18 +606,18 @@  discard block
 block discarded – undo
606 606
             }
607 607
 
608 608
             if ($encodeOptions) {
609
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal, array('" .
610
-                    implode("', '", $encodeOptions) . "')));";
609
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal, array('".
610
+                    implode("', '", $encodeOptions)."')));";
611 611
             } else {
612
-                $innerCode .= "    return new " . static::$namespace . "Response(\$encoder->encode(\$retVal));";
612
+                $innerCode .= "    return new ".static::$namespace."Response(\$encoder->encode(\$retVal));";
613 613
             }
614 614
         }
615 615
         // shall we exclude functions returning by ref?
616 616
         // if ($func->returnsReference())
617 617
         //     return false;
618 618
 
619
-        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n" .
620
-            "function $newFuncName(\$req)\n{\n" . $innerCode . "\n}";
619
+        $code = "/**\n * @param \PhpXmlRpc\Request \$req\n * @return \PhpXmlRpc\Response\n * @throws \\Exception\n */\n".
620
+            "function $newFuncName(\$req)\n{\n".$innerCode."\n}";
621 621
 
622 622
         return $code;
623 623
     }
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array())
672 672
     {
673 673
         if (isset($extraOptions['replace_class_name']) && $extraOptions['replace_class_name']) {
674
-            return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . $classMethod;
674
+            return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '').$classMethod;
675 675
         }
676 676
 
677 677
         if (is_object($className)) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
         } else {
680 680
             $realClassName = $className;
681 681
         }
682
-        return (isset($extraOptions['prefix']) ?  $extraOptions['prefix'] : '') . "$realClassName.$classMethod";
682
+        return (isset($extraOptions['prefix']) ? $extraOptions['prefix'] : '')."$realClassName.$classMethod";
683 683
     }
684 684
 
685 685
     /**
@@ -762,21 +762,21 @@  discard block
 block discarded – undo
762 762
      */
763 763
     protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array())
764 764
     {
765
-        $reqClass = static::$namespace . 'Request';
766
-        $valClass = static::$namespace . 'Value';
767
-        $decoderClass = static::$namespace . 'Encoder';
765
+        $reqClass = static::$namespace.'Request';
766
+        $valClass = static::$namespace.'Value';
767
+        $decoderClass = static::$namespace.'Encoder';
768 768
 
769 769
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
770
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
770
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
771 771
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
772
-        $sigNum = isset($extraOptions['signum']) ? (int)$extraOptions['signum'] : 0;
772
+        $sigNum = isset($extraOptions['signum']) ? (int) $extraOptions['signum'] : 0;
773 773
 
774 774
         $req = new $reqClass('system.methodSignature');
775 775
         $req->addparam(new $valClass($methodName));
776 776
         $client->setDebug($debug);
777 777
         $response = $client->send($req, $timeout, $protocol);
778 778
         if ($response->faultCode()) {
779
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature from remote server for method ' . $methodName);
779
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature from remote server for method '.$methodName);
780 780
             return false;
781 781
         }
782 782
 
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
             $mSig = $decoder->decode($mSig);
788 788
         }
789 789
 
790
-        if (!is_array($mSig) || count($mSig) <= $sigNum) {
791
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method signature nr.' . $sigNum . ' from remote server for method ' . $methodName);
790
+        if (!is_array($mSig) || count($mSig)<=$sigNum) {
791
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method signature nr.'.$sigNum.' from remote server for method '.$methodName);
792 792
             return false;
793 793
         }
794 794
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
      */
804 804
     protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array())
805 805
     {
806
-        $reqClass = static::$namespace . 'Request';
807
-        $valClass = static::$namespace . 'Value';
806
+        $reqClass = static::$namespace.'Request';
807
+        $valClass = static::$namespace.'Value';
808 808
 
809 809
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
810
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
810
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
811 811
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
812 812
 
813 813
         $mDesc = '';
@@ -841,11 +841,11 @@  discard block
 block discarded – undo
841 841
         $clientClone = clone $client;
842 842
         $function = function() use($clientClone, $methodName, $extraOptions, $mSig)
843 843
         {
844
-            $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
844
+            $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
845 845
             $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
846
-            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
847
-            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
848
-            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
846
+            $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
847
+            $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
848
+            $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
849 849
             $throwFault = false;
850 850
             $decodeFault = false;
851 851
             $faultResponse = null;
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
                 $faultResponse = $extraOptions['return_on_fault'];
857 857
             }
858 858
 
859
-            $reqClass = static::$namespace . 'Request';
860
-            $encoderClass = static::$namespace . 'Encoder';
861
-            $valueClass = static::$namespace . 'Value';
859
+            $reqClass = static::$namespace.'Request';
860
+            $encoderClass = static::$namespace.'Encoder';
861
+            $valueClass = static::$namespace.'Value';
862 862
 
863 863
             $encoder = new $encoderClass();
864 864
             $encodeOptions = array();
@@ -940,14 +940,14 @@  discard block
 block discarded – undo
940 940
      * @param string $mDesc
941 941
      * @return string[] keys: source, docstring
942 942
      */
943
-    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='')
943
+    public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc = '')
944 944
     {
945
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
945
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
946 946
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
947
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
948
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
949
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
950
-        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
947
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
948
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
949
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
950
+        $clientCopyMode = isset($extraOptions['simple_client_copy']) ? (int) ($extraOptions['simple_client_copy']) : 0;
951 951
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
952 952
         $throwFault = false;
953 953
         $decodeFault = false;
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
         }
961 961
 
962 962
         $code = "function $newFuncName(";
963
-        if ($clientCopyMode < 2) {
963
+        if ($clientCopyMode<2) {
964 964
             // client copy mode 0 or 1 == full / partial client copy in emitted code
965 965
             $verbatimClientCopy = !$clientCopyMode;
966
-            $innerCode = '  ' . str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
966
+            $innerCode = '  '.str_replace("\n", "\n  ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
967 967
             $innerCode .= "\$client->setDebug(\$debug);\n";
968 968
             $this_ = '';
969 969
         } else {
@@ -971,28 +971,28 @@  discard block
 block discarded – undo
971 971
             $innerCode = '';
972 972
             $this_ = 'this->';
973 973
         }
974
-        $innerCode .= "  \$req = new " . static::$namespace . "Request('$methodName');\n";
974
+        $innerCode .= "  \$req = new ".static::$namespace."Request('$methodName');\n";
975 975
 
976 976
         if ($mDesc != '') {
977 977
             // take care that PHP comment is not terminated unwillingly by method description
978 978
             /// @todo according to the spec, method desc can have html in it. We should run it through strip_tags...
979
-            $mDesc = "/**\n * " . str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc) . "\n";
979
+            $mDesc = "/**\n * ".str_replace(array("\n", '*/'), array("\n * ", '* /'), $mDesc)."\n";
980 980
         } else {
981 981
             $mDesc = "/**\n * Function $newFuncName.\n";
982 982
         }
983 983
 
984 984
         // param parsing
985
-        $innerCode .= "  \$encoder = new " . static::$namespace . "Encoder();\n";
985
+        $innerCode .= "  \$encoder = new ".static::$namespace."Encoder();\n";
986 986
         $plist = array();
987 987
         $pCount = count($mSig);
988
-        for ($i = 1; $i < $pCount; $i++) {
988
+        for ($i = 1; $i<$pCount; $i++) {
989 989
             $plist[] = "\$p$i";
990 990
             $pType = $mSig[$i];
991 991
             if ($pType == 'i4' || $pType == 'i8' || $pType == 'int' || $pType == 'boolean' || $pType == 'double' ||
992 992
                 $pType == 'string' || $pType == 'dateTime.iso8601' || $pType == 'base64' || $pType == 'null'
993 993
             ) {
994 994
                 // only build directly xml-rpc values when type is known and scalar
995
-                $innerCode .= "  \$p$i = new " . static::$namespace . "Value(\$p$i, '$pType');\n";
995
+                $innerCode .= "  \$p$i = new ".static::$namespace."Value(\$p$i, '$pType');\n";
996 996
             } else {
997 997
                 if ($encodePhpObjects || $encodeNulls) {
998 998
                     $encOpts = array();
@@ -1003,26 +1003,26 @@  discard block
 block discarded – undo
1003 1003
                         $encOpts[] = 'null_extension';
1004 1004
                     }
1005 1005
 
1006
-                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '" . implode("', '", $encOpts) . "'));\n";
1006
+                    $innerCode .= "  \$p$i = \$encoder->encode(\$p$i, array( '".implode("', '", $encOpts)."'));\n";
1007 1007
                 } else {
1008 1008
                     $innerCode .= "  \$p$i = \$encoder->encode(\$p$i);\n";
1009 1009
                 }
1010 1010
             }
1011 1011
             $innerCode .= "  \$req->addparam(\$p$i);\n";
1012
-            $mDesc .= " * @param " . $this->xmlrpc2PhpType($pType) . " \$p$i\n";
1012
+            $mDesc .= " * @param ".$this->xmlrpc2PhpType($pType)." \$p$i\n";
1013 1013
         }
1014
-        if ($clientCopyMode < 2) {
1014
+        if ($clientCopyMode<2) {
1015 1015
             $plist[] = '$debug = 0';
1016 1016
             $mDesc .= " * @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
1017 1017
         }
1018 1018
         $plist = implode(', ', $plist);
1019
-        $mDesc .= ' * @return ' . $this->xmlrpc2PhpType($mSig[0]);
1019
+        $mDesc .= ' * @return '.$this->xmlrpc2PhpType($mSig[0]);
1020 1020
         if ($throwFault) {
1021
-            $mDesc .= "\n * @throws " . (is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1021
+            $mDesc .= "\n * @throws ".(is_string($throwFault) ? $throwFault : '\\PhpXmlRpc\\Exception');
1022 1022
         } else if ($decodeFault) {
1023
-            $mDesc .= '|' . gettype($faultResponse) . " (a " . gettype($faultResponse) . " if call fails)";
1023
+            $mDesc .= '|'.gettype($faultResponse)." (a ".gettype($faultResponse)." if call fails)";
1024 1024
         } else {
1025
-            $mDesc .= '|' . static::$namespace . "Response (a " . static::$namespace . "Response obj instance if call fails)";
1025
+            $mDesc .= '|'.static::$namespace."Response (a ".static::$namespace."Response obj instance if call fails)";
1026 1026
         }
1027 1027
         $mDesc .= "\n */\n";
1028 1028
 
@@ -1034,9 +1034,9 @@  discard block
 block discarded – undo
1034 1034
             $respCode = "throw new $throwFault(\$res->faultString(), \$res->faultCode())";
1035 1035
         } else if ($decodeFault) {
1036 1036
             if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
1037
-                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
1037
+                $respCode = "return str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '".str_replace("'", "''", $faultResponse)."')";
1038 1038
             } else {
1039
-                $respCode = 'return ' . var_export($faultResponse, true);
1039
+                $respCode = 'return '.var_export($faultResponse, true);
1040 1040
             }
1041 1041
         } else {
1042 1042
             $respCode = 'return $res';
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             $innerCode .= "  if (\$res->faultCode()) $respCode; else return \$encoder->decode(\$res->value());";
1048 1048
         }
1049 1049
 
1050
-        $code = $code . $plist . ")\n{\n" . $innerCode . "\n}\n";
1050
+        $code = $code.$plist.")\n{\n".$innerCode."\n}\n";
1051 1051
 
1052 1052
         return array('source' => $code, 'docstring' => $mDesc);
1053 1053
     }
@@ -1074,25 +1074,25 @@  discard block
 block discarded – undo
1074 1074
     public function wrapXmlrpcServer($client, $extraOptions = array())
1075 1075
     {
1076 1076
         $methodFilter = isset($extraOptions['method_filter']) ? $extraOptions['method_filter'] : '';
1077
-        $timeout = isset($extraOptions['timeout']) ? (int)$extraOptions['timeout'] : 0;
1077
+        $timeout = isset($extraOptions['timeout']) ? (int) $extraOptions['timeout'] : 0;
1078 1078
         $protocol = isset($extraOptions['protocol']) ? $extraOptions['protocol'] : '';
1079 1079
         $newClassName = isset($extraOptions['new_class_name']) ? $extraOptions['new_class_name'] : '';
1080
-        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool)$extraOptions['encode_nulls'] : false;
1081
-        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
1082
-        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
1080
+        $encodeNulls = isset($extraOptions['encode_nulls']) ? (bool) $extraOptions['encode_nulls'] : false;
1081
+        $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool) $extraOptions['encode_php_objs'] : false;
1082
+        $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool) $extraOptions['decode_php_objs'] : false;
1083 1083
         $verbatimClientCopy = isset($extraOptions['simple_client_copy']) ? !($extraOptions['simple_client_copy']) : true;
1084
-        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool)$extraOptions['throw_on_fault'] : false;
1084
+        $throwOnFault = isset($extraOptions['throw_on_fault']) ? (bool) $extraOptions['throw_on_fault'] : false;
1085 1085
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
1086 1086
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
1087 1087
 
1088
-        $reqClass = static::$namespace . 'Request';
1089
-        $decoderClass = static::$namespace . 'Encoder';
1088
+        $reqClass = static::$namespace.'Request';
1089
+        $decoderClass = static::$namespace.'Encoder';
1090 1090
 
1091 1091
         // retrieve the list of methods
1092 1092
         $req = new $reqClass('system.listMethods');
1093 1093
         $response = $client->send($req, $timeout, $protocol);
1094 1094
         if ($response->faultCode()) {
1095
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve method list from remote server');
1095
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve method list from remote server');
1096 1096
 
1097 1097
             return false;
1098 1098
         }
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
             $mList = $decoder->decode($mList);
1104 1104
         }
1105 1105
         if (!is_array($mList) || !count($mList)) {
1106
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not retrieve meaningful method list from remote server');
1106
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not retrieve meaningful method list from remote server');
1107 1107
 
1108 1108
             return false;
1109 1109
         }
@@ -1112,8 +1112,8 @@  discard block
 block discarded – undo
1112 1112
         if ($newClassName != '') {
1113 1113
             $xmlrpcClassName = $newClassName;
1114 1114
         } else {
1115
-            $xmlrpcClassName = $prefix . '_' . preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1116
-                    array('_', ''), $client->server) . '_client';
1115
+            $xmlrpcClassName = $prefix.'_'.preg_replace(array('/\./', '/[^a-zA-Z0-9_\x7f-\xff]/'),
1116
+                    array('_', ''), $client->server).'_client';
1117 1117
         }
1118 1118
         while ($buildIt && class_exists($xmlrpcClassName)) {
1119 1119
             $xmlrpcClassName .= 'x';
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
         /// @todo add method setDebug() to new class, to enable/disable debugging
1123 1123
         $source = "class $xmlrpcClassName\n{\n  public \$client;\n\n";
1124 1124
         $source .= "  function __construct()\n  {\n";
1125
-        $source .= '    ' . str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1125
+        $source .= '    '.str_replace("\n", "\n    ", $this->buildClientWrapperCode($client, $verbatimClientCopy, $prefix, static::$namespace));
1126 1126
         $source .= "\$this->client = \$client;\n  }\n\n";
1127 1127
         $opts = array(
1128 1128
             'return_source' => true,
@@ -1145,26 +1145,26 @@  discard block
 block discarded – undo
1145 1145
                 $methodWrap = $this->wrapXmlrpcMethod($client, $mName, $opts);
1146 1146
                 if ($methodWrap) {
1147 1147
                     if ($buildIt) {
1148
-                        $source .= $methodWrap['source'] . "\n";
1148
+                        $source .= $methodWrap['source']."\n";
1149 1149
 
1150 1150
                     } else {
1151
-                        $source .= '  ' . str_replace("\n", "\n  ", $methodWrap['docstring']);
1152
-                        $source .= str_replace("\n", "\n  ", $methodWrap['source']). "\n";
1151
+                        $source .= '  '.str_replace("\n", "\n  ", $methodWrap['docstring']);
1152
+                        $source .= str_replace("\n", "\n  ", $methodWrap['source'])."\n";
1153 1153
                     }
1154 1154
 
1155 1155
                 } else {
1156
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': will not create class method to wrap remote method ' . $mName);
1156
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': will not create class method to wrap remote method '.$mName);
1157 1157
                 }
1158 1158
             }
1159 1159
         }
1160 1160
         $source .= "}\n";
1161 1161
         if ($buildIt) {
1162 1162
             $allOK = 0;
1163
-            eval($source . '$allOK=1;');
1163
+            eval($source.'$allOK=1;');
1164 1164
             if ($allOK) {
1165 1165
                 return $xmlrpcClassName;
1166 1166
             } else {
1167
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': could not create class ' . $xmlrpcClassName . ' to wrap remote server ' . $client->server);
1167
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': could not create class '.$xmlrpcClassName.' to wrap remote server '.$client->server);
1168 1168
                 return false;
1169 1169
             }
1170 1170
         } else {
@@ -1183,8 +1183,8 @@  discard block
 block discarded – undo
1183 1183
      */
1184 1184
     protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\')
1185 1185
     {
1186
-        $code = "\$client = new {$namespace}Client('" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path) .
1187
-            "', '" . str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server) . "', $client->port);\n";
1186
+        $code = "\$client = new {$namespace}Client('".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->path).
1187
+            "', '".str_replace(array("\\", "'"), array("\\\\", "\'"), $client->server)."', $client->port);\n";
1188 1188
 
1189 1189
         // copy all client fields to the client that will be generated runtime
1190 1190
         // (this provides for future expansion or subclassing of client obj)
Please login to merge, or discard this patch.
tests/12ExtraFilesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'extras' directory.
Please login to merge, or discard this patch.
tests/10DemofilesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'demo' directory.
Please login to merge, or discard this patch.
tests/08ServerTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
4 4
 
5
-include_once __DIR__ . '/ServerAwareTestCase.php';
5
+include_once __DIR__.'/ServerAwareTestCase.php';
6 6
 
7 7
 /**
8 8
  * Tests which involve interaction with the server - carried out via the client.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         // (but only if not called from subclass objects / multitests)
30 30
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
31 31
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
32
-            for ($i = 0; $i < count($trace); $i++) {
32
+            for ($i = 0; $i<count($trace); $i++) {
33 33
                 if (strpos($trace[$i]['function'], 'test') === 0) {
34 34
                     self::$failed_tests[$trace[$i]['function']] = true;
35 35
                     break;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         parent::set_up();
46 46
 
47 47
         $server = explode(':', $this->args['HTTPSERVER']);
48
-        if (count($server) > 1) {
48
+        if (count($server)>1) {
49 49
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]);
50 50
         } else {
51 51
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']);
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
         }
76 76
         $this->validateResponse($r);
77 77
         if (is_array($errorCode)) {
78
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
78
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
79 79
         } else {
80
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
80
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
81 81
         }
82 82
         if (!$r->faultCode()) {
83 83
             if ($returnResponse) {
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
         $query = parse_url($this->client->path, PHP_URL_QUERY);
105 105
         parse_str($query, $vars);
106 106
         $query = http_build_query(array_merge($vars, $data));
107
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
107
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
108 108
     }
109 109
 
110 110
     public function testString()
111 111
     {
112
-        $sendString = "here are 3 \"entities\": < > & " .
113
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
114
-            " - isn't that great? \\\"hackery\\\" at it's best " .
115
-            " also don't want to miss out on \$item[0]. " .
116
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
117
-            "a simple CR here" . chr(13) .
118
-            "a simple LF here" . chr(10) .
119
-            "and then LFCR" . chr(10) . chr(13) .
120
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
112
+        $sendString = "here are 3 \"entities\": < > & ".
113
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
114
+            " - isn't that great? \\\"hackery\\\" at it's best ".
115
+            " also don't want to miss out on \$item[0]. ".
116
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
117
+            "a simple CR here".chr(13).
118
+            "a simple LF here".chr(10).
119
+            "and then LFCR".chr(10).chr(13).
120
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
121 121
         $m = new xmlrpcmsg('examples.stringecho', array(
122 122
             new xmlrpcval($sendString, 'string'),
123 123
         ));
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function testLatin1String()
139 139
     {
140 140
         $sendString =
141
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
141
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
142 142
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
143 143
             $sendString.
144 144
             '</value></param></params></methodCall>';
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     public function testUtf8Method()
248 248
     {
249 249
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
250
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
250
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
251 251
             new xmlrpcval('hello')
252 252
         ));
253 253
         $v = $this->send($m);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         ));
269 269
         $v = $this->send($m);
270 270
         if ($v) {
271
-            $this->assertEquals($a + $b, $v->scalarval());
271
+            $this->assertEquals($a+$b, $v->scalarval());
272 272
         }
273 273
     }
274 274
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         ));
281 281
         $v = $this->send($m);
282 282
         if ($v) {
283
-            $this->assertEquals(12 - 23, $v->scalarval());
283
+            $this->assertEquals(12-23, $v->scalarval());
284 284
         }
285 285
     }
286 286
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         if ($v) {
320 320
             $sz = $v->arraysize();
321 321
             $got = '';
322
-            for ($i = 0; $i < $sz; $i++) {
322
+            for ($i = 0; $i<$sz; $i++) {
323 323
                 $b = $v->arraymem($i);
324 324
                 if ($b->scalarval()) {
325 325
                     $got .= '1';
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $got = '';
367 367
             $expected = '37210';
368 368
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
369
-            foreach($expect_array as $val) {
369
+            foreach ($expect_array as $val) {
370 370
                 $b = $v->structmem($val);
371 371
                 $got .= $b->me['int'];
372 372
             }
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
     {
869 869
         // make a 'deep client copy' as the original one might have many properties set
870 870
         // also for speed only wrap one method of the whole server
871
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
871
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
872 872
         if ($class == '') {
873 873
             $this->fail('Registration of remote server failed');
874 874
         } else {
@@ -907,9 +907,9 @@  discard block
 block discarded – undo
907 907
         $cookies = array(
908 908
             //'c1' => array(),
909 909
             'c2' => array('value' => 'c2'),
910
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
911
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
912
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
910
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
911
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
912
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
913 913
         );
914 914
         $cookiesval = php_xmlrpc_encode($cookies);
915 915
         $m = new xmlrpcmsg('tests.setcookies', array($cookiesval));
@@ -957,10 +957,10 @@  discard block
 block discarded – undo
957 957
         $m = new xmlrpcmsg('tests.getcookies', array());
958 958
         foreach ($cookies as $cookie => $val) {
959 959
             $this->client->setCookie($cookie, $val);
960
-            $cookies[$cookie] = (string)$cookies[$cookie];
960
+            $cookies[$cookie] = (string) $cookies[$cookie];
961 961
         }
962 962
         $r = $this->client->send($m, $this->timeout, $this->method);
963
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
963
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
964 964
         if (!$r->faultCode()) {
965 965
             $v = $r->value();
966 966
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.
tests/WebTestCase.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/ServerAwareTestCase.php';
3
+include_once __DIR__.'/ServerAwareTestCase.php';
4 4
 
5 5
 abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_ServerAwareTestCase
6 6
 {
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     protected function request($path, $method = 'GET', $payload = '', $emptyPageOk = false)
17 17
     {
18
-        $url = $this->baseUrl . $path;
18
+        $url = $this->baseUrl.$path;
19 19
 
20 20
         $ch = curl_init($url);
21 21
         curl_setopt_array($ch, array(
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         {
34 34
             curl_setopt($ch, CURLOPT_COOKIE, 'PHPUNIT_SELENIUM_TEST_ID='.$this->testId);
35 35
         }
36
-        if ($this->args['DEBUG'] > 0) {
36
+        if ($this->args['DEBUG']>0) {
37 37
             curl_setopt($ch, CURLOPT_VERBOSE, 1);
38 38
         }
39 39
         $page = curl_exec($ch);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     protected function newClient($path)
59 59
     {
60
-        $client = new \PhpXmlRpc\Client($this->baseUrl . $path);
60
+        $client = new \PhpXmlRpc\Client($this->baseUrl.$path);
61 61
         if ($this->collectCodeCoverageInformation) {
62 62
             $client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId);
63 63
         }
Please login to merge, or discard this patch.
tests/11DebuggerTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for the bundled debugger.
Please login to merge, or discard this patch.
tests/01CharsetTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * @author JoakimLofgren
4 4
  */
5 5
 
6
-include_once __DIR__ . '/PolyfillTestCase.php';
6
+include_once __DIR__.'/PolyfillTestCase.php';
7 7
 
8 8
 use PhpXmlRpc\Helper\Charset;
9 9
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
     public function testUtf8ToLatin1All()
49 49
     {
50 50
         $latinString = "\n\r\t";
51
-        for($i = 32; $i < 127; $i++) {
51
+        for ($i = 32; $i<127; $i++) {
52 52
             $latinString .= chr($i);
53 53
         }
54
-        for($i = 160; $i < 256; $i++) {
54
+        for ($i = 160; $i<256; $i++) {
55 55
             $latinString .= chr($i);
56 56
         }
57 57
 
Please login to merge, or discard this patch.
tests/09HTTPTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/08ServerTest.php';
3
+include_once __DIR__.'/08ServerTest.php';
4 4
 
5 5
 /**
6 6
  * Tests which stress http features of the library.
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         );
26 26
 
27 27
         $methods = array();
28
-        foreach(get_class_methods('ServerTest') as $method)
28
+        foreach (get_class_methods('ServerTest') as $method)
29 29
         {
30 30
             if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
31 31
             {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
                 preg_match('/ubunutu([0-9]+)/', $output[0], $matches);
318 318
                 $ubuntuVersion = @$matches[1];
319 319
             }
320
-            if ($ubuntuVersion >= 20) {
320
+            if ($ubuntuVersion>=20) {
321 321
                 $this->markTestSkipped('HTTPS via Socket known to fail on php less than 7.2 on Ubuntu 20 and higher');
322 322
                 return;
323 323
             }
Please login to merge, or discard this patch.
src/Helper/Http.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
         // read chunk-size, chunk-extension (if any) and crlf
28 28
         // get the position of the linebreak
29
-        $chunkEnd = strpos($buffer, "\r\n") + 2;
29
+        $chunkEnd = strpos($buffer, "\r\n")+2;
30 30
         $temp = substr($buffer, 0, $chunkEnd);
31 31
         $chunkSize = hexdec(trim($temp));
32 32
         $chunkStart = $chunkEnd;
33
-        while ($chunkSize > 0) {
34
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart + $chunkSize);
33
+        while ($chunkSize>0) {
34
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart+$chunkSize);
35 35
 
36 36
             // just in case we got a broken connection
37 37
             if ($chunkEnd == false) {
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
             }
44 44
 
45 45
             // read chunk-data and crlf
46
-            $chunk = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
46
+            $chunk = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
47 47
             // append chunk-data to entity-body
48 48
             $new .= $chunk;
49 49
             // length := length + chunk-size
50 50
             $length += strlen($chunk);
51 51
             // read chunk-size and crlf
52
-            $chunkStart = $chunkEnd + 2;
52
+            $chunkStart = $chunkEnd+2;
53 53
 
54
-            $chunkEnd = strpos($buffer, "\r\n", $chunkStart) + 2;
54
+            $chunkEnd = strpos($buffer, "\r\n", $chunkStart)+2;
55 55
             if ($chunkEnd == false) {
56 56
                 break; // just in case we got a broken connection
57 57
             }
58
-            $temp = substr($buffer, $chunkStart, $chunkEnd - $chunkStart);
58
+            $temp = substr($buffer, $chunkStart, $chunkEnd-$chunkStart);
59 59
             $chunkSize = hexdec(trim($temp));
60 60
             $chunkStart = $chunkEnd;
61 61
         }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             // Look for CR/LF or simple LF as line separator (even though it is not valid http)
85 85
             $pos = strpos($data, "\r\n\r\n");
86 86
             if ($pos || is_int($pos)) {
87
-                $bd = $pos + 4;
87
+                $bd = $pos+4;
88 88
             } else {
89 89
                 $pos = strpos($data, "\n\n");
90 90
                 if ($pos || is_int($pos)) {
91
-                    $bd = $pos + 2;
91
+                    $bd = $pos+2;
92 92
                 } else {
93 93
                     // No separation between response headers and body: fault?
94 94
                     $bd = 0;
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
                 // this filters out all http headers from proxy. maybe we could take them into account, too?
99 99
                 $data = substr($data, $bd);
100 100
             } else {
101
-                $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
102
-                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
101
+                $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
102
+                throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' (HTTPS via proxy error, tunnel connection possibly failed)', PhpXmlRpc::$xmlrpcerr['http_error']);
103 103
             }
104 104
         }
105 105
 
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         if ($httpResponse['status_code'] !== '200') {
135
-            $errstr = substr($data, 0, strpos($data, "\n") - 1);
136
-            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
137
-            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'] . ' (' . $errstr . ')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
135
+            $errstr = substr($data, 0, strpos($data, "\n")-1);
136
+            $this->getLogger()->error('XML-RPC: '.__METHOD__.': HTTP error, got response: '.$errstr);
137
+            throw new HttpException(PhpXmlRpc::$xmlrpcstr['http_error'].' ('.$errstr.')', PhpXmlRpc::$xmlrpcerr['http_error'], null, $httpResponse['status_code']);
138 138
         }
139 139
 
140 140
         // be tolerant to usage of \n instead of \r\n to separate headers and data (even though it is not valid http)
141 141
         $pos = strpos($data, "\r\n\r\n");
142 142
         if ($pos || is_int($pos)) {
143
-            $bd = $pos + 4;
143
+            $bd = $pos+4;
144 144
         } else {
145 145
             $pos = strpos($data, "\n\n");
146 146
             if ($pos || is_int($pos)) {
147
-                $bd = $pos + 2;
147
+                $bd = $pos+2;
148 148
             } else {
149 149
                 // No separation between response headers and body: fault?
150 150
                 // we could take some action here instead of going on...
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         foreach ($ar as $line) {
159 159
             // take care of (multi-line) headers and cookies
160 160
             $arr = explode(':', $line, 2);
161
-            if (count($arr) > 1) {
161
+            if (count($arr)>1) {
162 162
                 /// @todo according to https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should reject with error
163 163
                 ///       400 any messages where a space is present between the header name and colon
164 164
                 $headerName = strtolower(trim($arr[0]));
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     $cookie = $arr[1];
167 167
                     // glue together all received cookies, using a comma to separate them (same as php does with getallheaders())
168 168
                     if (isset($httpResponse['headers'][$headerName])) {
169
-                        $httpResponse['headers'][$headerName] .= ', ' . trim($cookie);
169
+                        $httpResponse['headers'][$headerName] .= ', '.trim($cookie);
170 170
                     } else {
171 171
                         $httpResponse['headers'][$headerName] = trim($cookie);
172 172
                     }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             } elseif (isset($headerName)) {
198 198
                 /// @todo improve this: 1. check that the line starts with a space or tab; 2. according to
199 199
                 ///       https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4, we should flat out refuse these messages
200
-                $httpResponse['headers'][$headerName] .= ' ' . trim($line);
200
+                $httpResponse['headers'][$headerName] .= ' '.trim($line);
201 201
             }
202 202
         }
203 203
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             // Decode chunked encoding sent by http 1.1 servers
221 221
             if (isset($httpResponse['headers']['transfer-encoding']) && $httpResponse['headers']['transfer-encoding'] == 'chunked') {
222 222
                 if (!$data = static::decodeChunked($data)) {
223
-                    $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
223
+                    $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
224 224
                     throw new HttpException(PhpXmlRpc::$xmlrpcstr['dechunk_fail'], PhpXmlRpc::$xmlrpcerr['dechunk_fail'], null, $httpResponse['status_code']);
225 225
                 }
226 226
             }
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
                         if ($httpResponse['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
236 236
                             $data = $degzdata;
237 237
                             if ($debug) {
238
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
238
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
239 239
                             }
240 240
                         } elseif ($httpResponse['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
241 241
                             $data = $degzdata;
242 242
                             if ($debug) {
243
-                                $this->getLogger()->debug("---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n$data\n---END---");
243
+                                $this->getLogger()->debug("---INFLATED RESPONSE---[".strlen($data)." chars]---\n$data\n---END---");
244 244
                             }
245 245
                         } else {
246
-                            $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
246
+                            $this->getLogger()->error('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
247 247
                             throw new HttpException(PhpXmlRpc::$xmlrpcstr['decompress_fail'], PhpXmlRpc::$xmlrpcerr['decompress_fail'], null, $httpResponse['status_code']);
248 248
                         }
249 249
                     } else {
250
-                        $this->getLogger()->error('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
250
+                        $this->getLogger()->error('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
251 251
                         throw new HttpException(PhpXmlRpc::$xmlrpcstr['cannot_decompress'], PhpXmlRpc::$xmlrpcerr['cannot_decompress'], null, $httpResponse['status_code']);
252 252
                     }
253 253
                 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     public function parseAcceptHeader($header)
268 268
     {
269 269
         $accepted = array();
270
-        foreach(explode(',', $header) as $c) {
270
+        foreach (explode(',', $header) as $c) {
271 271
             if (preg_match('/^([^;]+); *q=([0-9.]+)/', $c, $matches)) {
272 272
                 $c = $matches[1];
273 273
                 $w = $matches[2];
Please login to merge, or discard this patch.