summaryrefslogtreecommitdiff
path: root/app/EventBuilder/EventIteratorBuilder.php
diff options
context:
space:
mode:
authorJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
committerJLGC @monolinux <monolinux@junglacode.org>2016-08-15 23:13:16 -0500
commit683c0464093f6a7976236c68653c2a2cc5dae280 (patch)
treebf176ecd82415cc4952eea071b7d264dd5fd68b4 /app/EventBuilder/EventIteratorBuilder.php
parentb1e795fc5b45369f7b9b565b1e106d2673361977 (diff)
parent5f82a942c0011bf91947b2c1d627c0907bda0c92 (diff)
Merge https://github.com/kanboard/kanboard
Diffstat (limited to 'app/EventBuilder/EventIteratorBuilder.php')
-rw-r--r--app/EventBuilder/EventIteratorBuilder.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/app/EventBuilder/EventIteratorBuilder.php b/app/EventBuilder/EventIteratorBuilder.php
new file mode 100644
index 00000000..ba821753
--- /dev/null
+++ b/app/EventBuilder/EventIteratorBuilder.php
@@ -0,0 +1,52 @@
+<?php
+
+namespace Kanboard\EventBuilder;
+
+use Iterator;
+
+/**
+ * Class EventIteratorBuilder
+ *
+ * @package Kanboard\EventBuilder
+ * @author Frederic Guillot
+ */
+class EventIteratorBuilder implements Iterator {
+ private $position = 0;
+ private $builders = array();
+
+ /**
+ * Set builder
+ *
+ * @access public
+ * @param BaseEventBuilder $builder
+ * @return $this
+ */
+ public function withBuilder(BaseEventBuilder $builder)
+ {
+ $this->builders[] = $builder;
+ return $this;
+ }
+
+ public function rewind() {
+ $this->position = 0;
+ }
+
+ /**
+ * @return BaseEventBuilder
+ */
+ public function current() {
+ return $this->builders[$this->position];
+ }
+
+ public function key() {
+ return $this->position;
+ }
+
+ public function next() {
+ ++$this->position;
+ }
+
+ public function valid() {
+ return isset($this->builders[$this->position]);
+ }
+}