MailConfigChecker/Application/Model/Exception/d3TranslatableLazyAssertionException.php

35 lines
1008 B
PHP
Raw Normal View History

2023-12-11 10:38:59 +01:00
<?php
/**
2023-12-11 15:48:31 +01:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
2023-12-11 10:38:59 +01:00
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2023-12-11 15:48:31 +01:00
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
2023-12-11 10:38:59 +01:00
*/
2023-12-11 15:48:31 +01:00
declare(strict_types=1);
2023-12-11 10:38:59 +01:00
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);
}
}