count = $count; $this->generator = $generator; } /** * Get an iterator from the generator. * * @return mixed */ public function getIterator() { return ($this->generator)(); } /** * Get the total number of tagged services. * * @return int */ public function count() { if (is_callable($count = $this->count)) { $this->count = $count(); } return $this->count; } }