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

Category::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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