From 982cda6805b97b2365fd5d625403cd4a8713ac0c Mon Sep 17 00:00:00 2001 From: Alexander Klimov Date: Fri, 5 Sep 2014 12:01:14 +0200 Subject: [PATCH] Implement Icinga\Util\Enumerate --- library/Icinga/Util/Enumerate.php | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 library/Icinga/Util/Enumerate.php diff --git a/library/Icinga/Util/Enumerate.php b/library/Icinga/Util/Enumerate.php new file mode 100644 index 000000000..0861f7f65 --- /dev/null +++ b/library/Icinga/Util/Enumerate.php @@ -0,0 +1,62 @@ +iterator = $iterator; + } + + public function rewind() + { + $this->iterator->rewind(); + $this->key = 0; + } + + public function next() + { + $this->iterator->next(); + ++$this->key; + } + + public function valid() + { + return $this->iterator->valid(); + } + + public function current() + { + return $this->iterator->current(); + } + + public function key() + { + return $this->key; + } +}