values[] = $option; } /** * @param string $option * * @return void */ public function remove(string $option): void { foreach ($this->values as $key => $tableOption) { if ($tableOption->getOption() === $option) { unset($this->values[$key]); } } $this->values = array_values($this->values); } /** * @param string $option * * @return TableOption|null */ public function getTableOption(string $option): ?TableOption { foreach ($this->values as $tableOption) { if ($tableOption->getOption() === $option) { return $tableOption; } } return null; } /** * @param string $option * * @return bool */ public function hasOption(string $option): bool { foreach ($this->values as $tableOption) { if ($tableOption->getOption() === $option) { return true; } } return false; } /** * @return ArrayIterator|TableOption[] */ public function getIterator() { return new ArrayIterator($this->values); } }