<?php /** * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * https://www.d3data.de * * @copyright (C) D3 Data Development (Inh. Thomas Dartsch) * @author D3 Data Development - Daniel Seifert <info@shopmodule.com> * @link https://www.oxidmodule.com */ declare(strict_types=1); namespace D3\MailConfigChecker\Application\Model\Exception; use Assert\LazyAssertionException; use OxidEsales\Eshop\Core\Registry; class d3TranslatableLazyAssertionException extends LazyAssertionException { public static function fromErrors(array $errors): LazyAssertionException { $text = Registry::getLang()->translateString('D3_MAILCHECKER_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 LazyAssertionException($message, $errors); } }