1st pass at cleanup of unit tests; a couple of nitpicks from SLInsights
[plcapi.git] / demo / client / proxy.php
index 2ffc0c4..a8c696c 100644 (file)
@@ -3,7 +3,7 @@
 <body>
 <h1>proxy demo</h1>
 <h2>Query server using a 'proxy' object</h2>
-<h3>The code demonstrates usage for the terminally lazy</h3>
+<h3>The code demonstrates usage for the terminally lazy. For a more complete proxy, look at at the Wrapper class</h3>
 <?php
 
 include_once __DIR__ . "/../../src/Autoloader.php";
@@ -20,6 +20,8 @@ class PhpXmlRpcProxy
     }
 
     /**
+     * Translates any method call to an xmlrpc call.
+     *
      * @author Toth Istvan
      *
      * @param string $name remote function name. Will be prefixed
@@ -29,7 +31,7 @@ class PhpXmlRpcProxy
      *
      * @throws Exception
      */
-    function __call($name, $arguments)
+    public function __call($name, $arguments)
     {
         $encoder = new PhpXmlRpc\Encoder();
         $valueArray = array();
@@ -43,7 +45,7 @@ class PhpXmlRpcProxy
         $resp = $this->client->send(new PhpXmlRpc\Request($this->prefix.$name, $valueArray));
 
         if ($resp->faultCode()) {
-            throw new Exception($resp->faultMessage(), $resp->faultCode);
+            throw new Exception($resp->faultString(), $resp->faultCode());
         } else {
             return $resp->value();
         }
@@ -55,4 +57,4 @@ $stateNo = rand(1, 51);
 $proxy = new PhpXmlRpcProxy(new \PhpXmlRpc\Client('http://phpxmlrpc.sourceforge.net/server.php'));
 $stateName = $proxy->getStateName($stateNo);
 
-echo "State $stateNo is ".htmlspecialchars($stateName);
\ No newline at end of file
+echo "State $stateNo is ".htmlspecialchars($stateName);