Total Complexity | 8 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class MessageSource implements MessageReaderInterface |
||
10 | { |
||
11 | private string $path; |
||
12 | private array $boundDomains = []; |
||
13 | |||
14 | 30 | public function __construct(string $path) |
|
15 | { |
||
16 | 30 | if (!is_dir($path)) { |
|
17 | 1 | throw new \RuntimeException(sprintf('Directory "%s" does not exist.', $path)); |
|
18 | } |
||
19 | 29 | $this->path = $path; |
|
20 | 29 | } |
|
21 | |||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | * |
||
25 | * We use first parameter as `$n` for plurals if its value type is int. |
||
26 | */ |
||
27 | 29 | public function getMessage(string $id, string $category, string $locale, array $parameters = []): ?string |
|
36 | } |
||
37 | |||
38 | 29 | private function bindDomain(string $category): void |
|
42 | } |
||
43 | 29 | } |
|
44 | |||
45 | 29 | private function setLocale(string $locale): void |
|
52 |