protected function getFormatter($formatterType)
{
$foundFormatter = false;
$formatterType = ltrim($formatterType, '\\');
if (isset($this->formatters[$formatterType])) {
$foundFormatter = $this->formatters[$formatterType];
}
if ($foundFormatter === false) {
if ($this->objectManager->isRegistered($formatterType)) {
$possibleClassName = $formatterType;
} else {
$possibleClassName = sprintf('Neos\\Flow\\I18n\\Formatter\\%sFormatter', ucfirst($formatterType));
if (!$this->objectManager->isRegistered($possibleClassName)) {
throw new Exception\UnknownFormatterException('Could not find formatter for "' . $formatterType . '".', 1278057791);
}
}
if (!$this->reflectionService->isClassImplementationOf($possibleClassName, Formatter\FormatterInterface::class)) {
throw new Exception\InvalidFormatterException(sprintf('The resolved internationalization formatter class name "%s" does not implement "%s" as required.', $possibleClassName, FormatterInterface::class), 1358162557);
}
$foundFormatter = $this->objectManager->get($possibleClassName);
}
$this->formatters[$formatterType] = $foundFormatter;
return $foundFormatter;
}