$v) { $this->set($k, $v); } } public function set($key, bool $value = true): self { if ($value) { $this->items[$key] = true; } else { unset($this->items[$key]); } return $this; } public function fill($array): self { $this->clear(); foreach ($array as $k => $v) { $this->set($k, $v); } return $this; } public function has($key): bool { return isset($this->items[$key]); } public function toggle($key): self { $this->set($key, !$this->has($key)); return $this; } public function clear(): self { $this->items = []; return $this; } public function all(): Collection { return collect($this->items)->keys(); } public function count(): int { return count($this->items); } public function toArray() { return $this->items; } }