diff options
author | Silvio <silvio@devlet.com.br> | 2010-07-15 18:15:21 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-07-15 18:15:21 -0300 |
commit | d9f864a13f9216b7ee78a85c53d3184220eb01c3 (patch) | |
tree | 803d9f3095a58cd638b596781eb54d6369a97708 /classes/IsisMethodIterator.php | |
parent | 995ab5bad89603d40b7d9d60fef4bb8bae1dc9d3 (diff) | |
download | cinisis-d9f864a13f9216b7ee78a85c53d3184220eb01c3.tar.gz cinisis-d9f864a13f9216b7ee78a85c53d3184220eb01c3.tar.bz2 |
Moving iterators to their own folder
Diffstat (limited to 'classes/IsisMethodIterator.php')
-rw-r--r-- | classes/IsisMethodIterator.php | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/classes/IsisMethodIterator.php b/classes/IsisMethodIterator.php deleted file mode 100644 index 4e5871c..0000000 --- a/classes/IsisMethodIterator.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -/** - * Iterates over all callable methods for database mapping. - */ -class IsisMethodIterator implements Iterator -{ - private $total = 0; - private $class; - private $keys; - - /** - * Constructor. - * - * @param $class - * Instance of IsisConnector or child class. - */ - public function __construct($class) { - $this->class = $class; - $this->total = count($class->fields); - $this->keys = array_keys($class->fields); - } - - /** - * Rewind the Iterator to the first element. - */ - function rewind() { - $this->position = 0; - } - - /** - * Return the key of the current element. - */ - function key() { - $type = $this->class->getMapType($this->current()); - return $this->class->methodName($type); - } - - /** - * Return the current element. - */ - function current() { - return $this->class->fields[$this->keys[$this->position]]; - } - - /** - * Move forward to next element. The method should be callable, otherwise - * we move to the next position. - */ - function next() { - do { - ++$this->position; - } - while (!is_callable(array($this->class, $this->key())) && $this->valid()); - } - - /** - * Check if there is a current element after calls to rewind() or next(). - */ - function valid() { - return $this->position <= $this->total; - } -} |