[Sungrazr-svn] [98] Sungrazr_Server_Handler: [CHG] Set the _type property in the contructor so extended classes can easily check what web services method was used to call the handler .

0 views
Skip to first unread message

cl...@killersoft.com

unread,
Dec 18, 2007, 6:14:42 PM12/18/07
to Sungra...@googlegroups.com
Revision
98
Author
clay
Date
2007-12-18 15:14:42 -0800 (Tue, 18 Dec 2007)

Log Message

Sungrazr_Server_Handler: [CHG] Set the _type property in the contructor so extended classes can easily check what web services method was used to call the handler.

Modified Paths

Diff

Modified: trunk/Sungrazr/Server/Handler.php (97 => 98)


--- trunk/Sungrazr/Server/Handler.php	2007-12-18 07:01:15 UTC (rev 97)
+++ trunk/Sungrazr/Server/Handler.php	2007-12-18 23:14:42 UTC (rev 98)
@@ -60,6 +60,33 @@
     
     /**
      * 
+     * Web Services request type, picked from last segment of the caller's 
+     * class name and lowercased. (Ex: jsonrpc, xmlrpc, rest, etc.)
+     * 
+     * @var string
+     * 
+     */
+    protected $_type;
+    
+    /**
+     * 
+     * Constructor.
+     * 
+     * @param array $config User-provided configuration values.
+     * 
+     */
+    public function __construct($config = null)
+    {
+        parent::__construct($config);
+        
+        if (is_object($this->_config['caller'])) {
+            $caller_class = get_class($this->_config['caller']);
+            $this->_type = strtolower(end(explode('_', $caller_class)));
+        }
+    }
+    
+    /**
+     * 
      * Return the fault
      * 
      * @return array
Reply all
Reply to author
Forward
0 new messages