31 lines
653 B
PHP
31 lines
653 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
final class LocalizedException extends RuntimeException
|
|
{
|
|
/** @var array<string,string|int|float> */
|
|
private array $vars;
|
|
|
|
/**
|
|
* @param array<string,string|int|float> $vars
|
|
*/
|
|
public function __construct(string $key, array $vars = [], int $code = 0, ?Throwable $previous = null)
|
|
{
|
|
parent::__construct($key, $code, $previous);
|
|
$this->vars = $vars;
|
|
}
|
|
|
|
public function key(): string
|
|
{
|
|
return $this->getMessage();
|
|
}
|
|
|
|
/**
|
|
* @return array<string,string|int|float>
|
|
*/
|
|
public function vars(): array
|
|
{
|
|
return $this->vars;
|
|
}
|
|
}
|