Simplify, phpdoc
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 11 Apr 2010 16:22:21 +0000 (12:22 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 11 Apr 2010 16:22:21 +0000 (12:22 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde.php
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php

index 62d7640..edcd8be 100644 (file)
@@ -300,7 +300,7 @@ class Horde_ActiveSync_Driver_Horde extends Horde_ActiveSync_Driver_Base
 
         case self::CONTACTS_FOLDER:
             try {
-                $contact = $this->_connector->contacts_export($id, 'array');
+                $contact = $this->_connector->contacts_export($id);
             } catch (Horde_Exception $e) {
                 $this->_logger->err($e->GetMessage());
                 return false;
@@ -418,7 +418,7 @@ class Horde_ActiveSync_Driver_Horde extends Horde_ActiveSync_Driver_Base
             $content = self::_toHash($message);
             if (!$id) {
                 try {
-                    $id = $this->_connector->contacts_import($content, 'array');
+                    $id = $this->_connector->contacts_import($content);
                 } catch (Horde_Exception $e) {
                     $this->_logger->err($e->getMessage());
                     return false;
@@ -426,7 +426,7 @@ class Horde_ActiveSync_Driver_Horde extends Horde_ActiveSync_Driver_Base
                 $stat = $this->_smartStatMessage($folderid, $id, false);
             } else {
                 try {
-                    $this->_connector->contacts_replace($id, $content, 'array');
+                    $this->_connector->contacts_replace($id, $content);
                 } catch (Horde_Exception $e) {
                     $this->_logger->err($e->getMessage());
                     return false;
index 7a901e4..3cae543 100644 (file)
@@ -6,6 +6,8 @@
 class Horde_ActiveSync_Driver_Horde_Connector_Registry
 {
     /**
+     * Horde registry intance
+     *
      * @var Horde_Registry
      */
     private $_registry;
@@ -13,6 +15,12 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
     /**
      * Const'r
      *
+     * @param array $params  Configuration parameters. Requires:
+     * <pre>
+     *   'registry' - An instance of Horde_Registry
+     * </pre>
+     *
+     * @return Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function __construct($params = array())
     {
@@ -52,7 +60,9 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      *
      * @param string $action      The action to check for (add, modify, delete)
      * @param timestamp $from_ts  The timestamp to start checking from
-     * @param string $calendar
+     * @param string $calendar    The calendar to limit results to
+     *
+     * @return array  An array of event uids
      */
     public function calendar_listBy($action, $from_ts, $calendar = null)
     {
@@ -63,21 +73,18 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      * Export the specified calendar in the specified content type
      *
      * @param string $uid          The calendar id
-     * @param string $contentType  The content type specifier
      *
      * @return The iCalendar representation of the calendar
      */
     public function calendar_export($uid)
     {
-        $result = $this->_registry->calendar->export($uid, 'activesync');
-        return $result;
+        return $this->_registry->calendar->export($uid, 'activesync');
     }
 
     /**
      * Import an event into Horde's calendar store.
      *
-     * @param Horde_ActiveSync_Message_Appointmetn $content  The event content
-     * @param string $contentType                            The content type of $content
+     * @param Horde_ActiveSync_Message_Appointment $content  The event content
      * @param string $calendar                               The calendar to import event into
      *
      * @return string  The event's UID
@@ -88,18 +95,16 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
     }
 
     /**
-     * Replcae the event with new data
+     * Replace the event with new data
      *
-     * @param string $uid          The UID of the event to replace
-     * @param string $content      The new event content
-     * @param string $contentType  The content type of $content
+     * @param string $uid                                    The UID of the event to replace
+     * @param Horde_ActiveSync_Message_Appointment $content  The new event content
      *
      * @return boolean
      */
     public function calendar_replace($uid, $content)
     {
-        $result = $this->_registry->calendar->replace($uid, $content, 'activesync');
-        return $result;
+        return $this->_registry->calendar->replace($uid, $content, 'activesync');
     }
 
     /**
@@ -111,8 +116,7 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function calendar_delete($uid)
     {
-        $result = $this->_registry->calendar->delete($uid);
-        return $result;
+        return $this->_registry->calendar->delete($uid);
     }
 
     /**
@@ -125,8 +129,7 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function calendar_getActionTimestamp($uid, $action)
     {
-        $result = $this->_registry->calendar->getActionTimestamp($uid, $action);
-        return $result;
+        return $this->_registry->calendar->getActionTimestamp($uid, $action);
     }
 
     /**
@@ -136,38 +139,32 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function contacts_list()
     {
-        $result = $this->_registry->contacts->listContacts();
-        return $result;
+        return $this->_registry->contacts->listContacts();
     }
 
     /**
      * Export the specified contact from Horde's contacts storage
      *
      * @param string $uid          The contact's UID
-     * @param string $contentType  The content type to export in
-     *                             (text/directory text/vcard text/x-vcard)
      *
-     * @return the contact in the requested content type
+     * @return array The contact hash
      */
-    public function contacts_export($uid, $contentType)
+    public function contacts_export($uid)
     {
-        $result = $this->_registry->contacts->export($uid, $contentType);
-        return $result;
+        return $this->_registry->contacts->export($uid, 'array');
     }
 
     /**
      * Import the provided contact data into Horde's contacts storage
      *
      * @param string $content      The contact data
-     * @param string $contentType  The content type specifier of $content
      * @param string $source       The contact source to import to
      *
      * @return boolean
      */
-    public function contacts_import($content, $contentType, $import_source = null)
+    public function contacts_import($content, $import_source = null)
     {
-        $result = $this->_registry->contacts->import($content, $contentType, $import_source);
-        return $result;
+        return $this->_registry->contacts->import($content, 'array', $import_source);
     }
 
     /**
@@ -175,15 +172,13 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      *
      * @param string $uid          The UID of the contact to replace
      * @param string $content      The contact data
-     * @param string $contentType  The content type of $content
      * @param string $sources      The sources where UID will be replaced
      *
      * @return boolean
      */
-    public function contacts_replace($uid, $content, $contentType, $sources = null)
+    public function contacts_replace($uid, $content, $sources = null)
     {
-        $result = $this->_registry->contacts->replace($uid, $content, $contentType, $sources);
-        return $result;
+        return $this->_registry->contacts->replace($uid, $content, 'array', $sources);
     }
 
     /**
@@ -195,8 +190,7 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function contacts_delete($uid)
     {
-        $result = $this->_registry->contacts->delete($uid);
-        return $result;
+        return $this->_registry->contacts->delete($uid);
     }
 
     /**
@@ -210,10 +204,14 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function contacts_getActionTimestamp($uid, $action)
     {
-        $result = $this->_registry->contacts->getActionTimestamp($uid, $action);
-        return $result;
+        return $this->_registry->contacts->getActionTimestamp($uid, $action);
     }
 
+    /**
+     * List all tasks in the user's default tasklist.
+     *
+     * @return array  An array of task uids.
+     */
     public function tasks_listTasks()
     {
         $app = $this->horde_hasInterface('tasks');
@@ -221,41 +219,99 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
         return $this->_registry->tasks->listTaskUids($tasklist);
     }
 
+    /**
+     * Export a single task from the backend.
+     *
+     * @param string $uid  The task uid
+     *
+     * @return Horde_ActiveSync_Message_Task  The task message object
+     */
     public function tasks_export($uid)
     {
         return $this->_registry->tasks->export($uid, 'activesync');
     }
 
+    /**
+     * Importa a single task into the backend.
+     *
+     * @param Horde_ActiveSync_Message_Task $message  The task message object
+     *
+     * @return string  The newly added task's uid.
+     */
     public function tasks_import($message)
     {
         return $this->_registry->tasks->import($message, 'activesync');
     }
 
+    /**
+     * Replace an existing task with the provided task.
+     *
+     * @param string $uid  The existing tasks's uid
+     * @param Horde_ActiveSync_Message_Task $message  The task object
+     *
+     * @return boolean
+     */
     public function tasks_replace($uid, $message)
     {
         return $this->_registry->tasks->replace($uid, $message, 'activesync');
     }
 
+    /**
+     * Delete a task from the backend.
+     *
+     * @param string $id  The task's uid
+     *
+     * @return boolean
+     */
     public function tasks_delete($id)
     {
         return $this->_registry->tasks->delete($id);
     }
 
+    /**
+     * Return the timestamp for the last time $action was performed.
+     *
+     * @param string $uid     The UID of the task we are interested in.
+     * @param string $action  The action we are interested in (add, modify...)
+     *
+     * @return timestamp
+     */
     public function tasks_getActionTimestamp($uid, $action)
     {
         return $this->_registry->tasks->getActionTimestamp($uid, $action);
     }
 
+    /**
+     * Return all active api interfaces.
+     *
+     * @return array  An array of interface names.
+     */
     public function horde_listApis()
     {
         return $this->_registry->horde->listAPIs();
     }
 
+    /**
+     * Obtain a user's preference setting.
+     *
+     * @param string $app  The Horde application providing the setting.
+     * @param string $pref The name of the preference setting.
+     *
+     * @return mixed  The preference value
+     */
     public function horde_getPref($app, $pref)
     {
         return $this->_registry->horde->getPreference($app, $pref);
     }
 
+    /**
+     * Obtain the name of the Horde application that provides the specified api
+     * interface.
+     *
+     * @param string $api  The interface name
+     *
+     * @return string  The application name.
+     */
     public function horde_hasInterface($api)
     {
         return $this->_registry->hasInterface($api);