[Sungrazr-svn] [92] Sungrazr_Server_Api: [CHG] Completed server-visible namespacing support.

0 views
Skip to first unread message

cl...@killersoft.com

unread,
Dec 17, 2007, 2:51:07 PM12/17/07
to Sungra...@googlegroups.com
Revision
92
Author
clay
Date
2007-12-17 11:51:07 -0800 (Mon, 17 Dec 2007)

Log Message

Sungrazr_Server_Api: [CHG] Completed server-visible namespacing support.

Modified Paths

Diff

Modified: trunk/Sungrazr/Server/Api.php (91 => 92)


--- trunk/Sungrazr/Server/Api.php	2007-12-17 19:50:01 UTC (rev 91)
+++ trunk/Sungrazr/Server/Api.php	2007-12-17 19:51:07 UTC (rev 92)
@@ -26,9 +26,13 @@
      * 
      * Config keys are ...
      * 
-     * `life`
-     * : (int) The lifetime of each cache entry in seconds.
+     * `phpdoc`
+     * : (dependency) Config container for the Sungrazr_Docs_Phpdoc 
+     * dependency object.
      * 
+     * `cache`
+     * : (array) Factory configuration for a Solar_Cache adapter.
+     * 
      * @var array
      * 
      */
@@ -149,25 +153,41 @@
         foreach ($this->api[$class]['methods'] as $method => $info) {
             if ($info['from'] == 'Solar_Base' || 
                 in_array($method, $this->_magic_methods)) {
-                
                 unset($this->api[$class]['methods'][$method]);
-                
             }
         }
         
+        // drop non-public properties, and properties from Solar_Base
         foreach ($this->api[$class]['properties'] as $property => $info) {
             if ($info['from'] == 'Solar_Base' || $info['access'] != 'public') {
-                
-                unset($this->api[$class]['properties'][$property]);
-                
+                unset($this->api[$class]['properties'][$property]);                
             }
         }
         
+        // remap with namespace
+        $ns = '';
+        if (! empty($namespace)) {
+            if ($namespace == 'auto') {
+                $ns = strtolower(end(explode('_', $class))) . '.';
+            } else {
+                $ns = (string) $namespace . '.';
+            }
+        }
+        
+        // populate server api
+        $this->api[$class]['server_api'] = array();
+        foreach ($this->api[$class]['methods'] as $method => $info) {
+            $server_method = $ns . $method;
+            // keep track of where method originated
+            $info['callback'] = array($class, $method);
+            $this->api[$class]['server_api'][$server_method] = $info;
+        }        
+        
         // cache result
         $this->_addCachedClass($class);
-                
+        
+        // done!
         return true;
-        
     }
     
     /**
Reply all
Reply to author
Forward
0 new messages