next = $first; $this->last = $last; } /** * Get next key, incrementing the internal state * * @return string */ public function next() { if (!$this->hasMore()) throw new \OutOfBoundsException("Column numerator has run out of allocated GCID slots"); $key = $this->getKey($this->next); $this->next++; return $key; } /** * Convert numeric index to a key * * @param int $index * @return mixed */ protected function getKey($index) { return $index; // simple default } /** * @return bool - true iof there are more keys available */ protected function hasMore() { return $this->next <= $this->last; } /** * Generate all keys * * @return \Generator */ public function generate() { while ($this->hasMore()) { yield $this->next(); } } }