$id * * @return T * @throws ServiceNotFoundException */ public function get(string $id): ParserInterface { return $this->locator->get($id); } public function getBySnip(Snip $snip): ParserInterface { $parser = $snip->getParser(); if (null === $parser) { throw new ServiceNotFoundException(sprintf('Unknown parser for snip "%s"', $snip->getParser())); } return $this->get($parser); } /** * @return iterable */ public function getAll(): iterable { return $this->locator->getIterator(); } public function getChoices(): iterable { foreach ($this->getAll() as $parser) yield $parser::getName(); } }