1 | <?php |
||
21 | final class CatalogueMessage |
||
22 | { |
||
23 | /** |
||
24 | * @var CatalogueManager |
||
25 | */ |
||
26 | private $catalogueManager; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $key; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $message; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $domain; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $locale; |
||
47 | |||
48 | /** |
||
49 | * @var Metadata|null |
||
50 | */ |
||
51 | private $metadata; |
||
52 | |||
53 | /** |
||
54 | * @param CatalogueManager $catalogueManager |
||
55 | * @param string $locale |
||
56 | * @param string $domain |
||
57 | * @param string $key |
||
58 | * @param string $message |
||
59 | */ |
||
60 | 4 | public function __construct(CatalogueManager $catalogueManager, $locale, $domain, $key, $message) |
|
68 | |||
69 | /** |
||
70 | * @param null|Metadata $metadata |
||
71 | */ |
||
72 | 4 | public function setMetadata(Metadata $metadata) |
|
76 | |||
77 | public function __toString() |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | 2 | public function getKey() |
|
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | public function getDomain() |
||
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | public function getLocale() |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | 1 | public function getMessage() |
|
110 | { |
||
111 | 1 | return $this->message; |
|
112 | } |
||
113 | |||
114 | 1 | public function getOtherTranslations() |
|
115 | { |
||
116 | 1 | $translations = $this->catalogueManager->getTranslations($this->domain, $this->getKey()); |
|
117 | |||
118 | 1 | unset($translations[$this->locale]); |
|
119 | |||
120 | 1 | return $translations; |
|
121 | } |
||
122 | |||
123 | 1 | public function getSourceLocations() |
|
124 | { |
||
125 | 1 | if (null === $this->metadata) { |
|
126 | return []; |
||
127 | } |
||
128 | |||
129 | 1 | return $this->metadata->getSourceLocations(); |
|
130 | } |
||
131 | |||
132 | 2 | public function isNew() |
|
140 | |||
141 | 2 | public function isObsolete() |
|
149 | |||
150 | 1 | public function isApproved() |
|
158 | } |
||
159 |