1 | <?php |
||
14 | final class Message implements MessageInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var string |
||
18 | * |
||
19 | * The domain the message belongs to |
||
20 | */ |
||
21 | private $domain; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | * |
||
26 | * The key/phrase you write in the source code |
||
27 | */ |
||
28 | private $key; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | * |
||
33 | * The locale the translations is on |
||
34 | */ |
||
35 | private $locale; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | * |
||
40 | * The translated string. This is the preview of the message. Ie no placeholders is visible. |
||
41 | */ |
||
42 | private $translation; |
||
43 | |||
44 | /** |
||
45 | * Key value array with metadata. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | private $meta = []; |
||
50 | |||
51 | /** |
||
52 | * @param string $key |
||
53 | * @param string $domain |
||
54 | * @param string $locale |
||
55 | * @param string $translation |
||
56 | * @param array $meta |
||
57 | */ |
||
58 | 3 | public function __construct($key, $domain = '', $locale = '', $translation = '', array $meta = []) |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 2 | public function getDomain() |
|
74 | |||
75 | /** |
||
76 | * {@inheritdoc} |
||
77 | */ |
||
78 | 2 | public function withDomain($domain) |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 2 | public function getKey() |
|
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | 2 | public function getLocale() |
|
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | 2 | public function withLocale($locale) |
|
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | 2 | public function getTranslation() |
|
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | 2 | public function withTranslation($translation) |
|
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | 2 | public function getAllMeta() |
|
139 | |||
140 | /** |
||
141 | * {@inheritdoc} |
||
142 | */ |
||
143 | 2 | public function withMeta(array $meta) |
|
150 | |||
151 | /** |
||
152 | * {@inheritdoc} |
||
153 | */ |
||
154 | 2 | public function withAddedMeta($key, $value) |
|
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | 1 | public function getMeta($key, $default = null) |
|
173 | } |
||
174 |