@@ 17-247 (lines=231) @@ | ||
14 | /** |
|
15 | * @author Sascha-Oliver Prolic <[email protected]> |
|
16 | */ |
|
17 | class TranslationCreated implements CreatableFromArray |
|
18 | { |
|
19 | /** |
|
20 | * @var string |
|
21 | */ |
|
22 | private $id; |
|
23 | ||
24 | /** |
|
25 | * @var string |
|
26 | */ |
|
27 | private $content; |
|
28 | ||
29 | /** |
|
30 | * @var bool |
|
31 | */ |
|
32 | private $unverified; |
|
33 | ||
34 | /** |
|
35 | * @var bool |
|
36 | */ |
|
37 | private $excluded; |
|
38 | ||
39 | /** |
|
40 | * @var string |
|
41 | */ |
|
42 | private $pluralSuffix; |
|
43 | ||
44 | /** |
|
45 | * @var string |
|
46 | */ |
|
47 | private $createdAt; |
|
48 | ||
49 | /** |
|
50 | * @var string |
|
51 | */ |
|
52 | private $updatedAt; |
|
53 | ||
54 | /** |
|
55 | * @var array |
|
56 | */ |
|
57 | private $placeholders = []; |
|
58 | ||
59 | /** |
|
60 | * @var int |
|
61 | */ |
|
62 | private $wordCount; |
|
63 | ||
64 | /** |
|
65 | * @var Key |
|
66 | */ |
|
67 | private $key; |
|
68 | ||
69 | /** |
|
70 | * @var Locale |
|
71 | */ |
|
72 | private $locale; |
|
73 | ||
74 | /** |
|
75 | * @var User |
|
76 | */ |
|
77 | private $user; |
|
78 | ||
79 | /** |
|
80 | * @param array $data |
|
81 | * |
|
82 | * @return TranslationCreated |
|
83 | */ |
|
84 | public static function createFromArray(array $data) |
|
85 | { |
|
86 | $self = new self(); |
|
87 | ||
88 | if (isset($data['id'])) { |
|
89 | $self->setId($data['id']); |
|
90 | } |
|
91 | if (isset($data['content'])) { |
|
92 | $self->setContent($data['content']); |
|
93 | } |
|
94 | if (isset($data['unverified'])) { |
|
95 | $self->setUnverified($data['unverified']); |
|
96 | } |
|
97 | if (isset($data['excluded'])) { |
|
98 | $self->setExcluded($data['excluded']); |
|
99 | } |
|
100 | if (isset($data['plural_suffix'])) { |
|
101 | $self->setPluralSuffix($data['plural_suffix']); |
|
102 | } |
|
103 | if (isset($data['created_at'])) { |
|
104 | $self->setCreatedAt($data['created_at']); |
|
105 | } |
|
106 | if (isset($data['updated_at'])) { |
|
107 | $self->setUpdatedAt($data['updated_at']); |
|
108 | } |
|
109 | if (isset($data['placeholders'])) { |
|
110 | $self->setPlaceholders($data['placeholders']); |
|
111 | } |
|
112 | if (isset($data['word_count'])) { |
|
113 | $self->setWordCount($data['word_count']); |
|
114 | } |
|
115 | if (isset($data['key']) && is_array($data['key'])) { |
|
116 | $self->setKey(Key::createFromArray($data['key'])); |
|
117 | } |
|
118 | if (isset($data['locale']) && is_array($data['locale'])) { |
|
119 | $self->setLocale(Locale::createFromArray($data['locale'])); |
|
120 | } |
|
121 | if (isset($data['user']) && is_array($data['user'])) { |
|
122 | $self->setUser(User::createFromArray($data['user'])); |
|
123 | } |
|
124 | ||
125 | return $self; |
|
126 | } |
|
127 | ||
128 | public function getId(): string |
|
129 | { |
|
130 | return $this->id; |
|
131 | } |
|
132 | ||
133 | private function setId(string $id) |
|
134 | { |
|
135 | $this->id = $id; |
|
136 | } |
|
137 | ||
138 | public function getContent(): string |
|
139 | { |
|
140 | return $this->content; |
|
141 | } |
|
142 | ||
143 | private function setContent(string $content) |
|
144 | { |
|
145 | $this->content = $content; |
|
146 | } |
|
147 | ||
148 | public function isUnverified(): bool |
|
149 | { |
|
150 | return $this->unverified; |
|
151 | } |
|
152 | ||
153 | private function setUnverified(bool $unverified) |
|
154 | { |
|
155 | $this->unverified = $unverified; |
|
156 | } |
|
157 | ||
158 | public function isExcluded(): bool |
|
159 | { |
|
160 | return $this->excluded; |
|
161 | } |
|
162 | ||
163 | private function setExcluded(bool $excluded) |
|
164 | { |
|
165 | $this->excluded = $excluded; |
|
166 | } |
|
167 | ||
168 | public function getPluralSuffix(): string |
|
169 | { |
|
170 | return $this->pluralSuffix; |
|
171 | } |
|
172 | ||
173 | private function setPluralSuffix(string $pluralSuffix) |
|
174 | { |
|
175 | $this->pluralSuffix = $pluralSuffix; |
|
176 | } |
|
177 | ||
178 | public function getKey(): Key |
|
179 | { |
|
180 | return $this->key; |
|
181 | } |
|
182 | ||
183 | private function setKey(Key $key) |
|
184 | { |
|
185 | $this->key = $key; |
|
186 | } |
|
187 | ||
188 | public function getCreatedAt(): string |
|
189 | { |
|
190 | return $this->createdAt; |
|
191 | } |
|
192 | ||
193 | private function setCreatedAt(string $createdAt) |
|
194 | { |
|
195 | $this->createdAt = $createdAt; |
|
196 | } |
|
197 | ||
198 | public function getUpdatedAt(): string |
|
199 | { |
|
200 | return $this->updatedAt; |
|
201 | } |
|
202 | ||
203 | private function setUpdatedAt(string $updatedAt) |
|
204 | { |
|
205 | $this->updatedAt = $updatedAt; |
|
206 | } |
|
207 | ||
208 | public function getWordCount(): int |
|
209 | { |
|
210 | return $this->wordCount; |
|
211 | } |
|
212 | ||
213 | private function setWordCount(int $wordCount) |
|
214 | { |
|
215 | $this->wordCount = $wordCount; |
|
216 | } |
|
217 | ||
218 | public function getPlaceholders(): array |
|
219 | { |
|
220 | return $this->placeholders; |
|
221 | } |
|
222 | ||
223 | private function setPlaceholders(array $placeholders) |
|
224 | { |
|
225 | $this->placeholders = $placeholders; |
|
226 | } |
|
227 | ||
228 | public function getLocale(): Locale |
|
229 | { |
|
230 | return $this->locale; |
|
231 | } |
|
232 | ||
233 | private function setLocale(Locale $locale) |
|
234 | { |
|
235 | $this->locale = $locale; |
|
236 | } |
|
237 | ||
238 | public function getUser(): User |
|
239 | { |
|
240 | return $this->user; |
|
241 | } |
|
242 | ||
243 | private function setUser(User $user) |
|
244 | { |
|
245 | $this->user = $user; |
|
246 | } |
|
247 | } |
|
248 |
@@ 17-247 (lines=231) @@ | ||
14 | /** |
|
15 | * @author Sascha-Oliver Prolic <[email protected]> |
|
16 | */ |
|
17 | class TranslationUpdated implements CreatableFromArray |
|
18 | { |
|
19 | /** |
|
20 | * @var string |
|
21 | */ |
|
22 | private $id; |
|
23 | ||
24 | /** |
|
25 | * @var string |
|
26 | */ |
|
27 | private $content; |
|
28 | ||
29 | /** |
|
30 | * @var bool |
|
31 | */ |
|
32 | private $unverified; |
|
33 | ||
34 | /** |
|
35 | * @var bool |
|
36 | */ |
|
37 | private $excluded; |
|
38 | ||
39 | /** |
|
40 | * @var string |
|
41 | */ |
|
42 | private $pluralSuffix; |
|
43 | ||
44 | /** |
|
45 | * @var string |
|
46 | */ |
|
47 | private $createdAt; |
|
48 | ||
49 | /** |
|
50 | * @var string |
|
51 | */ |
|
52 | private $updatedAt; |
|
53 | ||
54 | /** |
|
55 | * @var array |
|
56 | */ |
|
57 | private $placeholders = []; |
|
58 | ||
59 | /** |
|
60 | * @var int |
|
61 | */ |
|
62 | private $wordCount; |
|
63 | ||
64 | /** |
|
65 | * @var Key |
|
66 | */ |
|
67 | private $key; |
|
68 | ||
69 | /** |
|
70 | * @var Locale |
|
71 | */ |
|
72 | private $locale; |
|
73 | ||
74 | /** |
|
75 | * @var User |
|
76 | */ |
|
77 | private $user; |
|
78 | ||
79 | /** |
|
80 | * @param array $data |
|
81 | * |
|
82 | * @return TranslationUpdated |
|
83 | */ |
|
84 | public static function createFromArray(array $data) |
|
85 | { |
|
86 | $self = new self(); |
|
87 | ||
88 | if (isset($data['id'])) { |
|
89 | $self->setId($data['id']); |
|
90 | } |
|
91 | if (isset($data['content'])) { |
|
92 | $self->setContent($data['content']); |
|
93 | } |
|
94 | if (isset($data['unverified'])) { |
|
95 | $self->setUnverified($data['unverified']); |
|
96 | } |
|
97 | if (isset($data['excluded'])) { |
|
98 | $self->setExcluded($data['excluded']); |
|
99 | } |
|
100 | if (isset($data['plural_suffix'])) { |
|
101 | $self->setPluralSuffix($data['plural_suffix']); |
|
102 | } |
|
103 | if (isset($data['created_at'])) { |
|
104 | $self->setCreatedAt($data['created_at']); |
|
105 | } |
|
106 | if (isset($data['updated_at'])) { |
|
107 | $self->setUpdatedAt($data['updated_at']); |
|
108 | } |
|
109 | if (isset($data['placeholders'])) { |
|
110 | $self->setPlaceholders($data['placeholders']); |
|
111 | } |
|
112 | if (isset($data['word_count'])) { |
|
113 | $self->setWordCount($data['word_count']); |
|
114 | } |
|
115 | if (isset($data['key']) && is_array($data['key'])) { |
|
116 | $self->setKey(Key::createFromArray($data['key'])); |
|
117 | } |
|
118 | if (isset($data['locale']) && is_array($data['locale'])) { |
|
119 | $self->setLocale(Locale::createFromArray($data['locale'])); |
|
120 | } |
|
121 | if (isset($data['user']) && is_array($data['user'])) { |
|
122 | $self->setUser(User::createFromArray($data['user'])); |
|
123 | } |
|
124 | ||
125 | return $self; |
|
126 | } |
|
127 | ||
128 | public function getId(): string |
|
129 | { |
|
130 | return $this->id; |
|
131 | } |
|
132 | ||
133 | private function setId(string $id) |
|
134 | { |
|
135 | $this->id = $id; |
|
136 | } |
|
137 | ||
138 | public function getContent(): string |
|
139 | { |
|
140 | return $this->content; |
|
141 | } |
|
142 | ||
143 | private function setContent(string $content) |
|
144 | { |
|
145 | $this->content = $content; |
|
146 | } |
|
147 | ||
148 | public function isUnverified(): bool |
|
149 | { |
|
150 | return $this->unverified; |
|
151 | } |
|
152 | ||
153 | private function setUnverified(bool $unverified) |
|
154 | { |
|
155 | $this->unverified = $unverified; |
|
156 | } |
|
157 | ||
158 | public function isExcluded(): bool |
|
159 | { |
|
160 | return $this->excluded; |
|
161 | } |
|
162 | ||
163 | private function setExcluded(bool $excluded) |
|
164 | { |
|
165 | $this->excluded = $excluded; |
|
166 | } |
|
167 | ||
168 | public function getPluralSuffix(): string |
|
169 | { |
|
170 | return $this->pluralSuffix; |
|
171 | } |
|
172 | ||
173 | private function setPluralSuffix(string $pluralSuffix) |
|
174 | { |
|
175 | $this->pluralSuffix = $pluralSuffix; |
|
176 | } |
|
177 | ||
178 | public function getKey(): Key |
|
179 | { |
|
180 | return $this->key; |
|
181 | } |
|
182 | ||
183 | private function setKey(Key $key) |
|
184 | { |
|
185 | $this->key = $key; |
|
186 | } |
|
187 | ||
188 | public function getCreatedAt(): string |
|
189 | { |
|
190 | return $this->createdAt; |
|
191 | } |
|
192 | ||
193 | private function setCreatedAt(string $createdAt) |
|
194 | { |
|
195 | $this->createdAt = $createdAt; |
|
196 | } |
|
197 | ||
198 | public function getUpdatedAt(): string |
|
199 | { |
|
200 | return $this->updatedAt; |
|
201 | } |
|
202 | ||
203 | private function setUpdatedAt(string $updatedAt) |
|
204 | { |
|
205 | $this->updatedAt = $updatedAt; |
|
206 | } |
|
207 | ||
208 | public function getWordCount(): int |
|
209 | { |
|
210 | return $this->wordCount; |
|
211 | } |
|
212 | ||
213 | private function setWordCount(int $wordCount) |
|
214 | { |
|
215 | $this->wordCount = $wordCount; |
|
216 | } |
|
217 | ||
218 | public function getPlaceholders(): array |
|
219 | { |
|
220 | return $this->placeholders; |
|
221 | } |
|
222 | ||
223 | private function setPlaceholders(array $placeholders) |
|
224 | { |
|
225 | $this->placeholders = $placeholders; |
|
226 | } |
|
227 | ||
228 | public function getLocale(): Locale |
|
229 | { |
|
230 | return $this->locale; |
|
231 | } |
|
232 | ||
233 | private function setLocale(Locale $locale) |
|
234 | { |
|
235 | $this->locale = $locale; |
|
236 | } |
|
237 | ||
238 | public function getUser(): User |
|
239 | { |
|
240 | return $this->user; |
|
241 | } |
|
242 | ||
243 | private function setUser(User $user) |
|
244 | { |
|
245 | $this->user = $user; |
|
246 | } |
|
247 | } |
|
248 |