public function count() { if ($this->isInfinite()) { throw new \LogicException('Cannot count an infinite recurrence rule.'); } if ($this->total === null) { foreach ($this as $occurrence) { } } return $this->total; }