From: Jan Schneider Date: Thu, 16 Dec 2010 21:19:03 +0000 (+0100) Subject: Make methods abstract. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3cae0632df1395949560ef28641423159e9b57d2;p=horde.git Make methods abstract. --- diff --git a/framework/Share/lib/Horde/Share/Datatree.php b/framework/Share/lib/Horde/Share/Datatree.php index a551f65e0..22731557a 100644 --- a/framework/Share/lib/Horde/Share/Datatree.php +++ b/framework/Share/lib/Horde/Share/Datatree.php @@ -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; } - } diff --git a/framework/Share/lib/Horde/Share/Object.php b/framework/Share/lib/Horde/Share/Object.php index 66e03d2a9..4b71c2d0e 100644 --- a/framework/Share/lib/Horde/Share/Object.php +++ b/framework/Share/lib/Horde/Share/Object.php @@ -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(); - } diff --git a/framework/Share/lib/Horde/Share/Object/Datatree.php b/framework/Share/lib/Horde/Share/Object/Datatree.php index f5737f4e6..65f5cc882 100644 --- a/framework/Share/lib/Horde/Share/Object/Datatree.php +++ b/framework/Share/lib/Horde/Share/Object/Datatree.php @@ -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(); } diff --git a/framework/Share/lib/Horde/Share/Object/Datatree/Share.php b/framework/Share/lib/Horde/Share/Object/Datatree/Share.php index 83f62997f..103932c5f 100644 --- a/framework/Share/lib/Horde/Share/Object/Datatree/Share.php +++ b/framework/Share/lib/Horde/Share/Object/Datatree/Share.php @@ -1,5 +1,4 @@ _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': diff --git a/framework/Share/lib/Horde/Share/Object/Sql.php b/framework/Share/lib/Horde/Share/Object/Sql.php index 72e0950f2..743bf79d9 100644 --- a/framework/Share/lib/Horde/Share/Object/Sql.php +++ b/framework/Share/lib/Horde/Share/Object/Sql.php @@ -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']; } diff --git a/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php b/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php index 8e2c1257d..f1dc236f0 100644 --- a/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php +++ b/framework/Share/lib/Horde/Share/Object/Sql/Hierarchical.php @@ -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 ''; } - }