Total Complexity | 7 |
Total Lines | 93 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class Translator implements TranslatorInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var LoaderInterface |
||
20 | */ |
||
21 | protected LoaderInterface $loader; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | protected string $locale; |
||
27 | |||
28 | /** |
||
29 | * @var BookmarkInterface |
||
30 | */ |
||
31 | protected BookmarkInterface $bookmark; |
||
32 | |||
33 | /** |
||
34 | * Translator constructor. |
||
35 | * |
||
36 | * @param LoaderInterface $loader |
||
37 | * @param string $locale |
||
38 | * @param BookmarkInterface|null $bookmark |
||
39 | */ |
||
40 | public function __construct( |
||
41 | LoaderInterface $loader, |
||
42 | string $locale = '', |
||
43 | BookmarkInterface $bookmark = null |
||
44 | ) { |
||
45 | $this->loader = $loader; |
||
46 | |||
47 | $this->setLocale($locale); |
||
48 | |||
49 | $this->bookmark = $bookmark ?? new Bookmark(); |
||
50 | |||
51 | $this->bookmark->setLoader($loader); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @inheritdoc |
||
56 | */ |
||
57 | public function getBookmark(): BookmarkInterface |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @inheritdoc |
||
64 | */ |
||
65 | public function getLoader(): LoaderInterface |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | public function getLocale(): string |
||
74 | { |
||
75 | return $this->locale; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * @inheritdoc |
||
80 | */ |
||
81 | public function setLocale(string $locale): TranslatorInterface |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @inheritdoc |
||
90 | */ |
||
91 | public function trans( |
||
111 |