logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

cvs: pecl /http/lib XmlRpcServer.php: msg#00037

Subject: cvs: pecl /http/lib XmlRpcServer.php
mike            Tue Oct 10 19:35:01 2006 UTC

  Modified files:              
    /pecl/http/lib      XmlRpcServer.php 
  Log:
  - CS
  
  
http://cvs.php.net/viewvc.cgi/pecl/http/lib/XmlRpcServer.php?r1=1.1&r2=1.2&diff_format=u
Index: pecl/http/lib/XmlRpcServer.php
diff -u pecl/http/lib/XmlRpcServer.php:1.1 pecl/http/lib/XmlRpcServer.php:1.2
--- pecl/http/lib/XmlRpcServer.php:1.1  Tue Jun  6 21:43:22 2006
+++ pecl/http/lib/XmlRpcServer.php      Tue Oct 10 19:35:01 2006
@@ -5,7 +5,7 @@
 
 /**
  * XMLRPC Server, very KISS
- * $Id: XmlRpcServer.php,v 1.1 2006/06/06 21:43:22 mike Exp $
+ * $Id: XmlRpcServer.php,v 1.2 2006/10/10 19:35:01 mike Exp $
  * 
  * NOTE: requires ext/xmlrpc
  * 
@@ -28,7 +28,7 @@
  * @copyright   Michael Wallner, <mike@xxxxxxxxx>
  * @license     BSD, revised
  * @package     pecl/http
- * @version     $Revision: 1.1 $
+ * @version     $Revision: 1.2 $
  */
 
 class XmlRpcServer extends HttpResponse
@@ -65,7 +65,8 @@
         * @param string $namespace
         * @param string $encoding
         */
-       public function __construct($namespace) {
+       public function __construct($namespace)
+       {
                $this->namespace = $namespace;
                self::initialize();
        }
@@ -73,7 +74,8 @@
        /**
         * Destructor
         */
-       public function __destruct() {
+       public function __destruct()
+       {
                if (self::$refcnt && !--self::$refcnt) {
                        xmlrpc_server_destroy(self::$xmlrpc);
                }
@@ -85,7 +87,8 @@
         * @param string $namespace
         * @return XmlRpcServer
         */
-       public static function factory($namespace) {
+       public static function factory($namespace)
+       {
                return new XmlRpcServer($namespace);
        }
        
@@ -94,9 +97,10 @@
         *
         * @param array $options
         */
-       public static function run(array $options = null) {
+       public static function run(array $options = null)
+       {
                self::initialize(false, true);
-               HttpResponse::setContentType("text/xml; charset=". 
self::$encoding);
+               self::setContentType("text/xml; charset=". self::$encoding);
                echo xmlrpc_server_call_method(self::$xmlrpc, self::$xmlreq, 
null, 
                        array("encoding" => self::$encoding) + (array) 
$options);
        }
@@ -108,7 +112,8 @@
         * @param array $params
         * @param array $options
         */
-       public static function test($method, array $params, array $options = 
null) {
+       public static function test($method, array $params, array $options = 
null)
+       {
                self::$xmlreq = xmlrpc_encode_request($method, $params);
                self::run();
        }
@@ -119,7 +124,8 @@
         * @param int $code
         * @param string $msg
         */
-       public static function error($code, $msg) {
+       public static function error($code, $msg)
+       {
                echo xmlrpc_encode(array("faultCode" => $code, "faultString" => 
$msg));
        }
        
@@ -131,7 +137,8 @@
         * @param mixed $dispatch
         * @param array $spec
         */
-       public function registerMethod($name, $callback, $dispatch = null, 
array $spec = null) {
+       public function registerMethod($name, $callback, $dispatch = null, 
array $spec = null)
+       {
                if (!is_callable($callback, false, $cb_name)) {
                        throw new Exception("$cb_name is not a valid callback");
                }
@@ -155,7 +162,8 @@
         *
         * @param XmlRpcRequestHandler $handler
         */
-       public function registerHandler(XmlRpcRequestHandler $handler) {
+       public function registerHandler(XmlRpcRequestHandler $handler)
+       {
                $this->handler = $handler;
                
                foreach (get_class_methods($handler) as $method) {
@@ -172,21 +180,24 @@
                }
        }
        
-       private function method($method, $namespace = null) {
+       private function method($method, $namespace = null)
+       {
                if (!strlen($namespace)) {
                        $namespace = strlen($this->namespace) ? 
$this->namespace : "xmlrpc";
                }
                return $namespace .".". strtolower($method[6]) . 
substr($method, 7);
        }
        
-       private function dispatch($method, array $params = null) {
+       private function dispatch($method, array $params = null)
+       {
                if (array_key_exists($method, self::$handle)) {
                        return call_user_func(self::$handle[$method], $params);
                }
                throw new Exception("Unknown XMLRPC method: $method");
        }
        
-       private static function initialize($server = true, $data = false) {
+       private static function initialize($server = true, $data = false)
+       {
                if ($data) {
                        if (!self::$xmlreq && !(self::$xmlreq = 
http_get_request_body())) {
                                throw new Exception("Failed to fetch XMLRPC 
request body");
@@ -219,7 +230,8 @@
  *     }
  * </code>
  */
-interface XmlRpcRequestHandler {
+interface XmlRpcRequestHandler
+{
        public function getNamespace();
        public function getIntrospectionData(array &$spec = null);
 }
@@ -227,10 +239,13 @@
 /**
  * XmlRpcRequestHandlerStub
  */
-abstract class XmlRpcRequestHandlerStub implements XmlRpcRequestHandler {
-       public function getNamespace() {
+abstract class XmlRpcRequestHandlerStub implements XmlRpcRequestHandler
+{
+       public function getNamespace()
+       {
        }
-       public function getIntrospectionData(array &$spec = null) {
+       public function getIntrospectionData(array &$spec = null)
+       {
        }
 }
 



<Prev in Thread] Current Thread [Next in Thread>