for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Install GitHub App
<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <[email protected]>
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Message;
/**
* Uses a key value array to translate messages.
* @author Henrique Moody <[email protected]>
* @since 2.0.0
final class ArrayTranslator implements Translator
{
* @var array
private $messages = [];
* Initializes the translator.
* @param array $messages Key value array with the messages
public function __construct(array $messages)
$this->messages = $messages;
}
* {@inheritdoc}
public function translate(string $message): string
if (array_key_exists($message, $this->messages)) {
$message = $this->messages[$message];
return $message;