aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-07-01 15:30:54 -0300
committerSilvio <silvio@devlet.com.br>2010-07-01 15:30:54 -0300
commitd1ba6eb119236ba38c50b07c75d5ff433f5221d6 (patch)
treee9571340ddb93753c6acaf65c8b7879618277ebf
parentc2381df90612de26f2b3524897a61f0d8ad8cb0b (diff)
downloadcinisis-d1ba6eb119236ba38c50b07c75d5ff433f5221d6.tar.gz
cinisis-d1ba6eb119236ba38c50b07c75d5ff433f5221d6.tar.bz2
Updating comments
-rw-r--r--classes/IsisSubfieldIterator.php35
1 files changed, 33 insertions, 2 deletions
diff --git a/classes/IsisSubfieldIterator.php b/classes/IsisSubfieldIterator.php
index 4c6086b..6f70d87 100644
--- a/classes/IsisSubfieldIterator.php
+++ b/classes/IsisSubfieldIterator.php
@@ -1,6 +1,11 @@
<?php
-// TODO: not working
+/**
+ * Isis subfield iterator.
+ *
+ * @todo
+ * It's not working.
+ */
class IsisSubfieldIterator implements Iterator
{
private $position = 0;
@@ -9,36 +14,62 @@ class IsisSubfieldIterator implements Iterator
private $subfields;
private $keys;
+ /**
+ * Constructor.
+ *
+ * @param $class
+ * Instance of IsisConnector or child class.
+ *
+ * @param $field
+ * Field to iterate over.
+ */
public function __construct($class, $field) {
$this->class = $class;
$this->field = $field;
$this->subfields = $class->getSubfields($field);
$this->keys = array_values($this->subfields);
$this->total = count($this->class->result[$field['name']);
- print_r($field);
}
+ /**
+ * Get the current subfield.
+ */
function subfield() {
return $this->subfields[$this->key()];
}
+ /**
+ * Rewind the Iterator to the first element.
+ */
function rewind() {
$this->position = 0;
}
+ /**
+ * Return the current element.
+ */
function current() {
$value = $this->class->getSubfield($this->field, $this->subfield());
return $this->class->explodeValue($value);
}
+ /**
+ * Return the key of the current element.
+ */
function key() {
return $this->keys[$this->position];
}
+ /**
+ * Move forward to next element.
+ */
function next() {
++$this->position;
}
+ /**
+ * Check if there is a current element after calls to rewind() or next().
+ */
function valid() {
return isset($this->keys[$this->position]) && ($this->current() != null);
}