19 declare(strict_types=1);
    36     public function format(array $errors): string
    42         $errorsToDisplay = [];
    43         foreach ($errors as $error) {
    44             $translation = $this->
lng->txt($error->getLanguageVariable());
    45             if ($translation === 
'-' . $error->getLanguageVariable() . 
'-') {
    46                 $translation = $error->getLanguageVariable();
    50                 $translation === $error->getLanguageVariable() ||
    51                 [] === $error->getPlaceHolderValues()
    53                 $errorsToDisplay[] = $translation;
    55                 $escapedPlaceholderValues = array_map(
static function (
string $address): 
string {
    57                 }, $error->getPlaceHolderValues());
    59                 array_unshift($escapedPlaceholderValues, $translation);
    60                 $errorsToDisplay[] = sprintf(...$escapedPlaceholderValues);
    65             'tpl.mail_new_submission_errors.html',
    70         if (1 === count($errorsToDisplay)) {
    71             $tpl->setCurrentBlock(
'single_error');
    72             $tpl->setVariable(
'SINGLE_ERROR', current($errorsToDisplay));
    74             $firstError = array_shift($errorsToDisplay);
    76             foreach ($errorsToDisplay as $error) {
    77                 $tpl->setCurrentBlock(
'error_loop');
    78                 $tpl->setVariable(
'ERROR', $error);
    79                 $tpl->parseCurrentBlock();
    82             $tpl->setCurrentBlock(
'multiple_errors');
    83             $tpl->setVariable(
'FIRST_ERROR', $firstError);
    85         $tpl->parseCurrentBlock();