* @link http://www.oxidmodule.com */ namespace D3\MailConfigChecker\Application\Model\Exception; use Assert\LazyAssertionException; use OxidEsales\Eshop\Core\Registry; class d3TranslatableLazyAssertionException extends LazyAssertionException { public static function fromErrors(array $errors): self { $text = Registry::getLang()->translateString('D3_ASSERTIONS_FAILED'); $message = \sprintf($text, \count($errors))."\n"; $i = 1; foreach ($errors as $error) { $message .= \sprintf("%d) %s: %s\n", $i++, $error->getPropertyPath(), $error->getMessage()); } return new static($message, $errors); } }