public function takeWhile(callable $condition) { $count = $this->countWhileTrue($condition); return $count ? $this->take($count) : $this->clear(); }