From 7ddd9521b3f3a397da3b0a6b56238d31414eb4be Mon Sep 17 00:00:00 2001 From: brettp Date: Thu, 28 Oct 2010 19:17:36 +0000 Subject: Standardized code in all of core, not including language files, tests, or core mods. git-svn-id: http://code.elgg.org/elgg/trunk@7124 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggMetadata.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'engine/classes/ElggMetadata.php') diff --git a/engine/classes/ElggMetadata.php b/engine/classes/ElggMetadata.php index fe8bb4959..851397a93 100644 --- a/engine/classes/ElggMetadata.php +++ b/engine/classes/ElggMetadata.php @@ -4,14 +4,16 @@ * ElggMetadata * This class describes metadata that can be attached to ElggEntities. * - * @package Elgg - * @subpackage Core + * @package Elgg.Core + * @subpackage Metadata */ class ElggMetadata extends ElggExtender { /** * Construct a new site object, optionally from a given id value or row. * - * @param mixed $id + * @param mixed $id ID of metadata from DB + * + * @return void */ function __construct($id = null) { $this->attributes = array(); @@ -26,7 +28,7 @@ class ElggMetadata extends ElggExtender { if ($metadata) { $objarray = (array) $metadata; - foreach($objarray as $key => $value) { + foreach ($objarray as $key => $value) { $this->attributes[$key] = $value; } $this->attributes['type'] = "metadata"; @@ -37,7 +39,8 @@ class ElggMetadata extends ElggExtender { /** * Class member get overloading * - * @param string $name + * @param string $name Name + * * @return mixed */ function __get($name) { @@ -47,8 +50,9 @@ class ElggMetadata extends ElggExtender { /** * Class member set overloading * - * @param string $name - * @param mixed $value + * @param string $name Name + * @param mixed $value Value + * * @return mixed */ function __set($name, $value) { @@ -74,9 +78,12 @@ class ElggMetadata extends ElggExtender { */ function save() { if ($this->id > 0) { - return update_metadata($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id); + return update_metadata($this->id, $this->name, $this->value, + $this->value_type, $this->owner_guid, $this->access_id); } else { - $this->id = create_metadata($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id); + $this->id = create_metadata($this->entity_guid, $this->name, $this->value, + $this->value_type, $this->owner_guid, $this->access_id); + if (!$this->id) { throw new IOException(sprintf(elgg_echo('IOException:UnableToSaveNew'), get_class())); } @@ -86,6 +93,8 @@ class ElggMetadata extends ElggExtender { /** * Delete a given metadata. + * + * @return bool */ function delete() { return delete_metadata($this->id); @@ -106,6 +115,10 @@ class ElggMetadata extends ElggExtender { * For a given ID, return the object associated with it. * This is used by the river functionality primarily. * This is useful for checking access permissions etc on objects. + * + * @param int $id Metadata ID + * + * @return ElggMetadata */ public function getObjectFromID($id) { return get_metadata($id); -- cgit v1.2.3