Fix newlines (to satisfy automated code quality scanners)
authorgggeek <giunta.gaetano@gmail.com>
Sat, 21 Feb 2015 21:23:53 +0000 (21:23 +0000)
committergggeek <giunta.gaetano@gmail.com>
Sat, 21 Feb 2015 21:23:53 +0000 (21:23 +0000)
composer.json
demo/client/introspect.php
demo/client/which.php
doc/.gitignore

index 3064490..7e1a9af 100644 (file)
@@ -18,4 +18,4 @@
     "autoload": {
         "psr-4": {"PhpXmlRpc\\": "src/"}
     }
-}
\ No newline at end of file
+}
index 1fff47a..cd08423 100644 (file)
@@ -1 +1,79 @@
-<html>\r\r<head><title>xmlrpc</title></head>\r\r<body>\r\r<h1>Introspect demo</h1>\r\r<h2>Query server for available methods and their description</h2>\r\r<h3>The code demonstrates usage of multicall and introspection methods</h3>\r\r<?php\r\rinclude "xmlrpc.inc";\r\r\rfunction display_error($r)\r\r\r{\r\r\r    print "An error occurred: ";\r\r\r    print "Code: " . $r->faultCode()\r\r        . " Reason: '" . $r->faultString() . "'<br/>";\r\r\r}\r\r\r// 'new style' client constuctor\r\r$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");\r\rprint "<h3>methods available at http://" . $c->server . $c->path . "</h3>\n";\r\r\r$m = new xmlrpcmsg('system.listMethods');\r\r$r = &$c->send($m);\r\rif ($r->faultCode()) {\r\r\r    display_error($r);\r\r\r} else {\r\r\r    $v = $r->value();\r\r\r    for ($i = 0; $i < $v->arraysize(); $i++) {\r\r\r        $mname = $v->arraymem($i);\r\r\r        print "<h4>" . $mname->scalarval() . "</h4>\n";\r\r\r        // build messages first, add params later\r\r        $m1 = new xmlrpcmsg('system.methodHelp');\r\r\r        $m2 = new xmlrpcmsg('system.methodSignature');\r\r\r        $val = new xmlrpcval($mname->scalarval(), "string");\r\r\r        $m1->addParam($val);\r\r\r        $m2->addParam($val);\r\r\r        // send multiple messages in one pass.\r\r        // If server does not support multicall, client will fall back to 2 separate calls\r\r        $ms = array($m1, $m2);\r\r\r        $rs = &$c->send($ms);\r\r\r        if ($rs[0]->faultCode()) {\r\r\r            display_error($rs[0]);\r\r\r        } else {\r\r\r            $val = $rs[0]->value();\r\r\r            $txt = $val->scalarval();\r\r\r            if ($txt != "") {\r\r\r                print "<h4>Documentation</h4><p>${txt}</p>\n";\r\r\r            } else {\r\r\r                print "<p>No documentation available.</p>\n";\r\r\r            }\r\r\r        }\r\r\r        if ($rs[1]->faultCode()) {\r\r\r            display_error($rs[1]);\r\r\r        } else {\r\r\r            print "<h4>Signature</h4><p>\n";\r\r\r            $val = $rs[1]->value();\r\r\r            if ($val->kindOf() == "array") {\r\r\r                for ($j = 0; $j < $val->arraysize(); $j++) {\r\r\r                    $x = $val->arraymem($j);\r\r\r                    $ret = $x->arraymem(0);\r\r\r                    print "<code>" . $ret->scalarval() . " "\r\r                        . $mname->scalarval() . "(";\r\r\r                    if ($x->arraysize() > 1) {\r\r\r                        for ($k = 1; $k < $x->arraysize(); $k++) {\r\r\r                            $y = $x->arraymem($k);\r\r\r                            print $y->scalarval();\r\r\r                            if ($k < $x->arraysize() - 1) {\r\r\r                                print ", ";\r\r\r                            }\r\r\r                        }\r\r\r                    }\r\r\r                    print ")</code><br/>\n";\r\r\r                }\r\r\r            } else {\r\r\r                print "Signature unknown\n";\r\r\r            }\r\r\r            print "</p>\n";\r\r\r        }\r\r\r    }\r\r\r}\r\r?>\r\r</body>\r\r</html>\r
\ No newline at end of file
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Introspect demo</h1>
+<h2>Query server for available methods and their description</h2>
+<h3>The code demonstrates usage of multicall and introspection methods</h3>
+<?php
+include "xmlrpc.inc";
+function display_error($r)
+{
+    print "An error occurred: ";
+    print "Code: " . $r->faultCode()
+        . " Reason: '" . $r->faultString() . "'<br/>";
+}
+// 'new style' client constructor
+$c = new xmlrpc_client("http://phpxmlrpc.sourceforge.net/server.php");
+print "<h3>methods available at http://" . $c->server . $c->path . "</h3>\n";
+$m = new xmlrpcmsg('system.listMethods');
+$r = &$c->send($m);
+if ($r->faultCode()) {
+    display_error($r);
+} else {
+    $v = $r->value();
+    for ($i = 0; $i < $v->arraysize(); $i++) {
+        $mname = $v->arraymem($i);
+        print "<h4>" . $mname->scalarval() . "</h4>\n";
+        // build messages first, add params later
+        $m1 = new xmlrpcmsg('system.methodHelp');
+        $m2 = new xmlrpcmsg('system.methodSignature');
+        $val = new xmlrpcval($mname->scalarval(), "string");
+        $m1->addParam($val);
+        $m2->addParam($val);
+        // send multiple messages in one pass.
+        // If server does not support multicall, client will fall back to 2 separate calls
+        $ms = array($m1, $m2);
+        $rs = &$c->send($ms);
+        if ($rs[0]->faultCode()) {
+            display_error($rs[0]);
+        } else {
+            $val = $rs[0]->value();
+            $txt = $val->scalarval();
+            if ($txt != "") {
+                print "<h4>Documentation</h4><p>${txt}</p>\n";
+            } else {
+                print "<p>No documentation available.</p>\n";
+            }
+        }
+        if ($rs[1]->faultCode()) {
+            display_error($rs[1]);
+        } else {
+            print "<h4>Signature</h4><p>\n";
+            $val = $rs[1]->value();
+            if ($val->kindOf() == "array") {
+                for ($j = 0; $j < $val->arraysize(); $j++) {
+                    $x = $val->arraymem($j);
+                    $ret = $x->arraymem(0);
+                    print "<code>" . $ret->scalarval() . " "
+                        . $mname->scalarval() . "(";
+                    if ($x->arraysize() > 1) {
+                        for ($k = 1; $k < $x->arraysize(); $k++) {
+                            $y = $x->arraymem($k);
+                            print $y->scalarval();
+                            if ($k < $x->arraysize() - 1) {
+                                print ", ";
+                            }
+                        }
+                    }
+                    print ")</code><br/>\n";
+                }
+            } else {
+                print "Signature unknown\n";
+            }
+            print "</p>\n";
+        }
+    }
+}
+?>
+</body>
+</html>
index db2d8c1..f6ef45d 100644 (file)
@@ -1 +1,26 @@
-<html>\r\r<head><title>xmlrpc</title></head>\r\r<body>\r\r<h1>Which toolkit demo</h1>\r\r<h2>Query server for toolkit information</h2>\r\r<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>\r\r<?php\r\rinclude "xmlrpc.inc";\r\r\r$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());\r\r$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);\r\r$r = $c->send($f);\r\rif (!$r->faultCode()) {\r\r\r    $v = php_xmlrpc_decode($r->value());\r\r\r    print "<pre>";\r\r\r    print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";\r\r\r    print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";\r\r\r    print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";\r\r\r    print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";\r\r\r    print "</pre>";\r\r\r} else {\r\r\r    print "An error occurred: ";\r\r\r    print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";\r\r\r}\r\r?>\r\r</body>\r\r</html>\r
\ No newline at end of file
+<html>
+<head><title>xmlrpc</title></head>
+<body>
+<h1>Which toolkit demo</h1>
+<h2>Query server for toolkit information</h2>
+<h3>The code demonstrates usage of the php_xmlrpc_decode function</h3>
+<?php
+include "xmlrpc.inc";
+$f = new xmlrpcmsg('interopEchoTests.whichToolkit', array());
+$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
+$r = $c->send($f);
+if (!$r->faultCode()) {
+    $v = php_xmlrpc_decode($r->value());
+    print "<pre>";
+    print "name: " . htmlspecialchars($v["toolkitName"]) . "\n";
+    print "version: " . htmlspecialchars($v["toolkitVersion"]) . "\n";
+    print "docs: " . htmlspecialchars($v["toolkitDocsUrl"]) . "\n";
+    print "os: " . htmlspecialchars($v["toolkitOperatingSystem"]) . "\n";
+    print "</pre>";
+} else {
+    print "An error occurred: ";
+    print "Code: " . htmlspecialchars($r->faultCode()) . " Reason: '" . htmlspecialchars($r->faultString()) . "'\n";
+}
+?>
+</body>
+</html>
index 898ede1..bace140 100644 (file)
@@ -1,4 +1,4 @@
 out/
 javadoc-out/
 xmlrpc_php.pdf
-xmlrpc_php.fo.xml
\ No newline at end of file
+xmlrpc_php.fo.xml