Passed
Push — main ( 954523...045e26 )
by Breno
01:54
created

ArrayTranslator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A translate() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace BrenoRoosevelt\Validation\Translation;
5
6
class ArrayTranslator implements TranslatorInterface
7
{
8
    public function __construct(protected array $translations = [])
9
    {
10
    }
11
12
    public function translate(string $message, string ...$args): ?string
13
    {
14
        return $this->translations[$message] ?? null;
15
    }
16
}
17