respect-validation/library/Message/Formatter.php
Henrique Moody d356696af9
Upgrade translation mechanism
Currently, defining translations is quite cumbersome, and the translator
callback is passed to the constructor of multiple classes, which makes
it quite ugly and could make translations inconsistent.

This commit completely changes how translations are done in Validation.
Instead of using a callback, it uses a specific class, and `Validator`
will pass that object through the objects that render the messages.
2024-12-05 15:42:40 +01:00

32 lines
753 B
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Message;
use Respect\Validation\Result;
interface Formatter
{
/**
* @param array<string, mixed> $templates
*/
public function main(Result $result, array $templates, Translator $translator): string;
/**
* @param array<string, mixed> $templates
*/
public function full(Result $result, array $templates, Translator $translator, int $depth = 0): string;
/**
* @param array<string, mixed> $templates
*
* @return array<string, mixed>
*/
public function array(Result $result, array $templates, Translator $translator): array;
}