Make methods abstract.
authorJan Schneider <jan@horde.org>
Thu, 16 Dec 2010 21:19:03 +0000 (22:19 +0100)
committerJan Schneider <jan@horde.org>
Thu, 16 Dec 2010 23:17:10 +0000 (00:17 +0100)
framework/Share/lib/Horde/Share/Datatree.php
framework/Share/lib/Horde/Share/Object.php
framework/Share/lib/Horde/Share/Object/Datatree.php
framework/Share/lib/Horde/Share/Object/Datatree/Share.php
framework/Share/lib/Horde/Share/Object/Kolab.php
framework/Share/lib/Horde/Share/Object/Sql.php
framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php

index a551f65..2273155 100644 (file)
@@ -114,7 +114,7 @@ class Horde_Share_Datatree extends Horde_Share_Base
     protected function _getShares($ids)
     {
         $shares = array();
-        $objects = &$this->_datatree->getObjects($ids, 'DataTreeObject_Share');
+        $objects = $this->_datatree->getObjects($ids, 'DataTreeObject_Share');
         if (is_a($objects, 'PEAR_Error')) {
             throw new Horde_Share_Exception($objects->getMessage());
         }
@@ -134,7 +134,7 @@ class Horde_Share_Datatree extends Horde_Share_Base
      * @return array  All shares for the current app/share.
      * @throws Horde_Share_Exception
      */
-    function _listAllShares()
+    protected function _listAllShares()
     {
         $sharelist = $this->_datatree->get(DATATREE_FORMAT_FLAT, DATATREE_ROOT, true);
         if ($sharelist instanceof PEAR_Error) {
@@ -161,9 +161,9 @@ class Horde_Share_Datatree extends Horde_Share_Base
      * @return array  The shares the user has access to.
      * @throws Horde_Share_Exception
      */
-    function _listShares($userid, $perm = Horde_Perms::SHOW,
-                         $attributes = null, $from = 0, $count = 0,
-                         $sort_by = null, $direction = 0)
+    protected function _listShares($userid, $perm = Horde_Perms::SHOW,
+                                   $attributes = null, $from = 0, $count = 0,
+                                   $sort_by = null, $direction = 0)
     {
         $key = serialize(array($userid, $perm, $attributes));
         if (empty($this->_listCache[$key])) {
@@ -216,9 +216,7 @@ class Horde_Share_Datatree extends Horde_Share_Base
         }
         $datatreeObject = new Horde_Share_Object_DataTree_Share($name);
         $datatreeObject->setDataTree($this->_datatree);
-        $share = $this->_createObject($datatreeObject);
-
-        return $share;
+        return $this->_createObject($datatreeObject);
     }
 
     /**
@@ -346,5 +344,4 @@ class Horde_Share_Datatree extends Horde_Share_Base
 
         return $criteria;
     }
-
 }
index 66e03d2..4b71c2d 100644 (file)
@@ -64,10 +64,7 @@ abstract class Horde_Share_Object implements Serializable
      *
      * @return boolean
      */
-    public function set($attribute, $value)
-    {
-        return $this->_set($attribute, $value);
-    }
+    abstract public function set($attribute, $value);
 
     /**
      * Returns an attribute value from this object.
@@ -76,30 +73,21 @@ abstract class Horde_Share_Object implements Serializable
      *
      * @return mixed  The value for $attribute.
      */
-    public function get($attribute)
-    {
-        return $this->_get($attribute);
-    }
+    abstract public function get($attribute);
 
     /**
      * Returns the ID of this share.
      *
      * @return string  The share's ID.
      */
-    public function getId()
-    {
-        return $this->_getId();
-    }
+    abstract public function getId();
 
     /**
      * Returns the name of this share.
      *
      * @return string  The share's name.
      */
-    public function getName()
-    {
-        return $this->_getName();
-    }
+    abstract public function getName();
 
     /**
      * Saves the current attribute values.
@@ -115,6 +103,11 @@ abstract class Horde_Share_Object implements Serializable
     }
 
     /**
+     * Saves the current attribute values.
+     */
+    abstract protected function _save();
+
+    /**
      * Gives a user a certain privilege for this share.
      *
      * @param string $userid       The userid of the user.
@@ -244,7 +237,8 @@ abstract class Horde_Share_Object implements Serializable
      *
      * @return boolean  Whether or not $userid has $permission.
      */
-    abstract public function hasPermission($userid, $permission, $creator = null);
+    abstract public function hasPermission($userid, $permission,
+                                           $creator = null);
 
     /**
      * Sets the permission of this share.
@@ -264,5 +258,4 @@ abstract class Horde_Share_Object implements Serializable
      *                                 permissions on this share.
      */
     abstract public function getPermission();
-
 }
index f5737f4..65f5cc8 100644 (file)
@@ -37,7 +37,7 @@ class Horde_Share_Object_Datatree extends Horde_Share_Object
      * @return mixed  True if setting the attribute did succeed, a PEAR_Error
      *                otherwise.
      */
-    public function _set($attribute, $value)
+    public function set($attribute, $value)
     {
         return $this->datatreeObject->set($attribute, $value);
     }
@@ -50,7 +50,7 @@ class Horde_Share_Object_Datatree extends Horde_Share_Object
      *
      * @return mixed  The value of the attribute, or an empty string.
      */
-    public function _get($attribute)
+    public function get($attribute)
     {
         return $this->datatreeObject->get($attribute);
     }
@@ -60,7 +60,7 @@ class Horde_Share_Object_Datatree extends Horde_Share_Object
      *
      * @return string  The share's ID.
      */
-    protected function _getId()
+    public function getId()
     {
         return $this->datatreeObject->getId();
     }
@@ -70,7 +70,7 @@ class Horde_Share_Object_Datatree extends Horde_Share_Object
      *
      * @return string  The share's name.
      */
-    protected function _getName()
+    public function getName()
     {
         return $this->datatreeObject->getName();
     }
index 83f6299..103932c 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * Extension of the DataTreeObject class for storing Share information in the
  * DataTree driver. If you want to store specialized Share information, you
@@ -95,5 +94,4 @@ class Horde_Share_Object_DataTree_Share extends DataTreeObject
             }
         }
     }
-
 }
index 6f95894..d219af5 100644 (file)
@@ -136,10 +136,10 @@ class Horde_Share_Object_Kolab extends Horde_Share_Object implements Serializabl
      * @param string $folder  Name of the Kolab folder.
      * @param array  $perms  The permissions of the folder if they are known.
      */
-    public function setFolder(&$folder)
+    public function setFolder($folder)
     {
         if (!isset($this->_folder)) {
-            $this->_folder = &$folder;
+            $this->_folder = $folder;
             $this->_folder_name = $folder->name;
         } else {
            throw new Horde_Share_Exception(Horde_Share_Translation::t("The share has already been initialized!"));
@@ -151,7 +151,7 @@ class Horde_Share_Object_Kolab extends Horde_Share_Object implements Serializabl
      *
      * @return string  The share's ID.
      */
-    protected function _getId()
+    public function getId()
     {
         return $this->_folder->getShareId();
     }
@@ -161,7 +161,7 @@ class Horde_Share_Object_Kolab extends Horde_Share_Object implements Serializabl
      *
      * @return string  The share's name.
      */
-    protected function _getName()
+    public function getName()
     {
         return $this->_folder->getShareId();
     }
@@ -173,7 +173,7 @@ class Horde_Share_Object_Kolab extends Horde_Share_Object implements Serializabl
      *
      * @return mixed  The value for $attribute.
      */
-    protected function _get($attribute)
+    public function get($attribute)
     {
         if (isset($this->_data[$attribute])) {
             return $this->_data[$attribute];
@@ -239,7 +239,7 @@ class Horde_Share_Object_Kolab extends Horde_Share_Object implements Serializabl
      * @return mixed  True if setting the attribute did succeed, a PEAR_Error
      *                otherwise.
      */
-    protected function _set($attribute, $value)
+    public function set($attribute, $value)
     {
         switch ($attribute) {
         case 'name':
index 72e0950..743bf79 100644 (file)
@@ -90,7 +90,7 @@ class Horde_Share_Object_Sql extends Horde_Share_Object implements Serializable
      *
      * @return boolean
      */
-    public function _set($attribute, $value)
+    public function set($attribute, $value)
     {
         if ($attribute == 'owner') {
             return $this->data['share_owner'] = $value;
@@ -107,7 +107,7 @@ class Horde_Share_Object_Sql extends Horde_Share_Object implements Serializable
      *
      * @return mixed  The value of the attribute, or an empty string.
      */
-    protected function _get($attribute)
+    public function get($attribute)
     {
         if ($attribute == 'owner') {
             return $this->data['share_owner'];
@@ -121,7 +121,7 @@ class Horde_Share_Object_Sql extends Horde_Share_Object implements Serializable
      *
      * @return string  The share's ID.
      */
-    protected function _getId()
+    public function getId()
     {
         return isset($this->data['share_id']) ? $this->data['share_id'] : null;
     }
@@ -131,7 +131,7 @@ class Horde_Share_Object_Sql extends Horde_Share_Object implements Serializable
      *
      * @return string  The share's name.
      */
-    protected function _getName()
+    public function getName()
     {
         return $this->data['share_name'];
     }
index 8e2c125..f1dc236 100644 (file)
@@ -159,7 +159,7 @@ class Horde_Share_Object_Sql_Hierarchical extends Horde_Share_Object_Sql
      *
      * @return mixed  The value of the attribute, or an empty string.
      */
-    protected function _get($attribute)
+    public function get($attribute)
     {
         if ($attribute == 'owner' || $attribute == 'parents') {
             return $this->data['share_' . $attribute];
@@ -175,9 +175,8 @@ class Horde_Share_Object_Sql_Hierarchical extends Horde_Share_Object_Sql
      *
      * @return unknown
      */
-    protected function _getName()
+    public function getName()
     {
         return '';
     }
-
 }