aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ODD.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-28 19:17:36 +0000
commit7ddd9521b3f3a397da3b0a6b56238d31414eb4be (patch)
tree6eb6a9a51db5fa0f5d3cc2ec6de29b9e258b12a1 /engine/classes/ODD.php
parentbd3484417d170e62bc94e9db81d4ad37e8ddee6a (diff)
downloadelgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.gz
elgg-7ddd9521b3f3a397da3b0a6b56238d31414eb4be.tar.bz2
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
Diffstat (limited to 'engine/classes/ODD.php')
-rw-r--r--engine/classes/ODD.php46
1 files changed, 42 insertions, 4 deletions
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 @@
<?php
/**
* Open Data Definition (ODD) superclass.
- * @package Elgg
- * @subpackage Core
+ *
+ * @package Elgg.Core
+ * @subpackage ODD
*/
abstract class ODD {
/**
@@ -22,14 +23,34 @@ abstract class ODD {
$this->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 = "><![CDATA[$body]]></{$tag}>";
}