Archived
1
0
Fork 0

Formatting fixes and cleanup.

This commit is contained in:
Henrik Hautakoski 2023-01-31 07:34:02 +01:00
parent a1e14a3e60
commit 51fb71e469
41 changed files with 394 additions and 392 deletions

View file

@ -13,12 +13,12 @@ class Set implements \Countable
public function __construct($items = [])
{
foreach($items as $k => $v) {
foreach ($items as $k => $v) {
$this->set($k, $v);
}
}
public function set($key, bool $value = true) : self
public function set($key, bool $value = true): self
{
if ($value) {
$this->items[$key] = true;
@ -29,40 +29,40 @@ class Set implements \Countable
return $this;
}
public function fill($array) : self
public function fill($array): self
{
$this->clear();
foreach($array as $k => $v) {
foreach ($array as $k => $v) {
$this->set($k, $v);
}
return $this;
}
public function has($key) : bool
public function has($key): bool
{
return isset($this->items[$key]);
}
public function toggle($key) : self
public function toggle($key): self
{
$this->set($key, !$this->has($key));
return $this;
}
public function clear() : self
public function clear(): self
{
$this->items = [];
return $this;
}
public function all() : Collection
public function all(): Collection
{
return collect($this->items)->keys();
}
public function count() : int
public function count(): int
{
return count($this->items);
}