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/ODD.php | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'engine/classes/ODD.php') diff --git a/engine/classes/ODD.php b/engine/classes/ODD.php index 1d553c7c4..fa5b616fc 100644 --- a/engine/classes/ODD.php +++ b/engine/classes/ODD.php @@ -1,8 +1,9 @@ body = ""; } + /** + * Returns an array of attributes + * + * @return array + */ public function getAttributes() { return $this->attributes; } + /** + * Sets an attribute + * + * @param string $key Name + * @param mixed $value Value + * + * @return void + */ public function setAttribute($key, $value) { $this->attributes[$key] = $value; } + /** + * Returns an attribute + * + * @param string $key Name + * + * @return mixed + */ public function getAttribute($key) { if (isset($this->attributes[$key])) { return $this->attributes[$key]; @@ -38,10 +59,22 @@ abstract class ODD { return NULL; } + /** + * Sets the body of the ODD. + * + * @param mixed $value Value + * + * @return void + */ public function setBody($value) { $this->body = $value; } + /** + * Gets the body of the ODD. + * + * @return mixed + */ public function getBody() { return $this->body; } @@ -50,6 +83,8 @@ abstract class ODD { * Set the published time. * * @param int $time Unix timestamp + * + * @return void */ public function setPublished($time) { $this->attributes['published'] = date("r", $time); @@ -66,25 +101,28 @@ abstract class ODD { /** * For serialisation, implement to return a string name of the tag eg "header" or "metadata". + * * @return string */ abstract protected function getTagName(); /** * Magic function to generate valid ODD XML for this item. + * + * @return string */ public function __toString() { // Construct attributes $attr = ""; foreach ($this->attributes as $k => $v) { - $attr .= ($v!="") ? "$k=\"$v\" " : ""; + $attr .= ($v != "") ? "$k=\"$v\" " : ""; } $body = $this->getBody(); $tag = $this->getTagName(); $end = "/>"; - if ($body!="") { + if ($body != "") { $end = ">"; } -- cgit v1.2.3