/** * @internal * * @param Section $section * @param string $name * * @return eOption * @throws \LogicException * @throws \InvalidArgumentException * @throws \LTDBeget\sphinx\configurator\exceptions\DeserializeException */ private function getOptionName(Section $section, string $name) : eOption { try { /** * @var eOption $optionClass */ $optionClass = $this->getOptionNameClass($section->getType()); $option = $optionClass::get($name); } catch (\InvalidArgumentException $e) { throw new DeserializeException("Unknown option name {$name} in section type {$section->getType()}"); } return $option; }
/** * Delete option and its child * * @throws LogicException * @throws SectionException * @throws InvalidArgumentException */ public function delete() { foreach ($this->getSelfTypeIterator() as $definition) { if ($definition->isHasInheritance() && $definition->getInheritance() === $this) { $definition->delete(); } } parent::delete(); }