diff options
author | Silvio <silvio@devlet.com.br> | 2010-07-01 10:54:58 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-07-01 10:54:58 -0300 |
commit | 833f13ca5c2bc5a96f82388b22cf1ca5a445c07b (patch) | |
tree | c7a8b34842e654be0293625a1d913b3772ba97a3 /classes | |
parent | 44e7ef315dc560cd0de34e2b680cc914ba160377 (diff) | |
download | cinisis-833f13ca5c2bc5a96f82388b22cf1ca5a445c07b.tar.gz cinisis-833f13ca5c2bc5a96f82388b22cf1ca5a445c07b.tar.bz2 |
Adding a non-working IsisSubfieldIterator
Diffstat (limited to 'classes')
-rw-r--r-- | classes/IsisSubfieldIterator.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/classes/IsisSubfieldIterator.php b/classes/IsisSubfieldIterator.php new file mode 100644 index 0000000..ad1851d --- /dev/null +++ b/classes/IsisSubfieldIterator.php @@ -0,0 +1,51 @@ +<?php + +// TODO: not working +class IsisSubfieldIterator implements Iterator +{ + private $position = 0; + private $class; + private $field; + private $subfields; + private $keys; + + public function __construct($class, $field) + { + $this->class = $class; + $this->field = $field; + $this->subfields = $class->getSubfields($field); + $this->keys = array_values($this->subfields); + print_r($field); + } + + function subfield() + { + return $this->subfields[$this->key()]; + } + + function rewind() + { + $this->position = 0; + } + + function current() + { + $value = $this->class->getSubfield($this->field, $this->subfield()); + return $this->class->explodeValue($value); + } + + function key() + { + return $this->keys[$this->position]; + } + + function next() + { + ++$this->position; + } + + function valid() + { + return isset($this->keys[$this->position]) && ($this->current() != null); + } +} |