Passed
Push — master ( 994262...329e97 )
by
unknown
01:27
created

Category   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 3 1
A format() 0 3 1
A getMessage() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Translator;
6
7
final class Category
8
{
9
    private string $name;
10
    private MessageReaderInterface $reader;
11
    private MessageFormatterInterface $formatter;
12
13 17
    public function __construct(string $name, MessageReaderInterface $reader, MessageFormatterInterface $formatter)
14
    {
15 17
        $this->name = $name;
16 17
        $this->reader = $reader;
17 17
        $this->formatter = $formatter;
18 17
    }
19
20 17
    public function getName(): string
21
    {
22 17
        return $this->name;
23
    }
24
25 16
    public function getMessage(string $id, string $locale, array $parameters = []): ?string
26
    {
27 16
        return $this->reader->getMessage($id, $locale, $parameters);
28
    }
29
30 16
    public function format(string $message, array $parameters, string $locale): string
31
    {
32 16
        return $this->formatter->format($message, $parameters, $locale);
33
    }
34
}
35