|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
* @author [email protected] |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Core\Options; |
|
12
|
|
|
|
|
13
|
|
|
use Core\Options\Exception\MissingOptionException; |
|
14
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ModuleOptions |
|
18
|
|
|
* |
|
19
|
|
|
* Default options of the Core Module |
|
20
|
|
|
* |
|
21
|
|
|
* @author Carsten Bleek <[email protected]> |
|
22
|
|
|
* @author Mathias Weitz <[email protected]> |
|
23
|
|
|
* @author Mathias Gelhausen <[email protected]> |
|
24
|
|
|
*/ |
|
25
|
|
|
class ModuleOptions extends AbstractOptions |
|
26
|
|
|
{ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* The sitename is used in Mails. Typically it's the name of your website |
|
30
|
|
|
* |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $siteName = "YAWIK"; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The logo of the site |
|
37
|
|
|
* |
|
38
|
|
|
* @var string |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $siteLogo = "/Core/images/logo.jpg"; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Contact Data, which can be used in Mail signatures or the imprint page. |
|
44
|
|
|
* |
|
45
|
|
|
* @var array $operator |
|
46
|
|
|
*/ |
|
47
|
|
|
protected $operator = array( |
|
48
|
|
|
'companyShortName' => 'Example Company Name', |
|
49
|
|
|
'companyFullName' => 'Example Company Name Ltd. & Co KG', |
|
50
|
|
|
'companyTax' => 'Your VAT Number', |
|
51
|
|
|
'postalCode' => '4711', |
|
52
|
|
|
'city' => 'Froschmoorstetten', |
|
53
|
|
|
'country' => 'Auenland', |
|
54
|
|
|
'street' => 'Rath Dínen 112', |
|
55
|
|
|
'name' => 'Gimli & Legolas', |
|
56
|
|
|
'email' => '[email protected]', |
|
57
|
|
|
'fax' => '+49-0815-4711', |
|
58
|
|
|
'homepage' => 'http://example.com' |
|
59
|
|
|
); |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* This array defines the languages, which can be used. |
|
63
|
|
|
* |
|
64
|
|
|
* @var array $supportedLanguages |
|
65
|
|
|
*/ |
|
66
|
|
|
protected $supportedLanguages = array( |
|
67
|
|
|
'de' => 'de_DE', |
|
68
|
|
|
'fr' => 'fr', |
|
69
|
|
|
'en' => 'en_US', |
|
70
|
|
|
'es' => 'es', |
|
71
|
|
|
'it' => 'it', |
|
72
|
|
|
); |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* if true, YAWIK tries to detect the browser settings |
|
76
|
|
|
* |
|
77
|
|
|
* @var bool |
|
78
|
|
|
*/ |
|
79
|
|
|
protected $detectLanguage = true; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* The default language is used, if no language is set |
|
83
|
|
|
* |
|
84
|
|
|
* @var string |
|
85
|
|
|
*/ |
|
86
|
|
|
protected $defaultLanguage = 'en'; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* default currency used, if no currency is set |
|
90
|
|
|
* |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
protected $defaultCurrencyCode = "USD"; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* default tax rate used, if no tax rate is set |
|
97
|
|
|
* |
|
98
|
|
|
* @var string |
|
99
|
|
|
*/ |
|
100
|
|
|
protected $defaultTaxRate = "19"; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Email address to send system messages to. |
|
104
|
|
|
* |
|
105
|
|
|
* @var string |
|
106
|
|
|
*/ |
|
107
|
|
|
protected $systemMessageEmail; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @return string |
|
111
|
|
|
* @throws MissingOptionException |
|
112
|
|
|
* @since 0.20 throws MissingOptionException instead of InvalidArgumentException |
|
113
|
|
|
*/ |
|
114
|
|
|
public function getSiteName() |
|
115
|
|
|
{ |
|
116
|
|
|
if (empty($this->siteName)) { |
|
117
|
|
|
throw new MissingOptionException('siteName', $this); |
|
|
|
|
|
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
return $this->siteName; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @param $siteName |
|
125
|
|
|
* |
|
126
|
|
|
* @return $this |
|
127
|
|
|
*/ |
|
128
|
|
|
public function setSiteName($siteName) |
|
129
|
|
|
{ |
|
130
|
|
|
$this->siteName = $siteName; |
|
131
|
|
|
return $this; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return string |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getSiteLogo() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->siteLogo; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @param $siteLogo |
|
144
|
|
|
* |
|
145
|
|
|
* @return $this |
|
146
|
|
|
*/ |
|
147
|
|
|
public function setSiteLogo($siteLogo) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->siteLogo = $siteLogo; |
|
150
|
|
|
return $this; |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* Gets the operators contact data |
|
156
|
|
|
* |
|
157
|
|
|
* @return array |
|
158
|
|
|
*/ |
|
159
|
|
|
public function getOperator() |
|
160
|
|
|
{ |
|
161
|
|
|
return $this->operator; |
|
162
|
|
|
} |
|
163
|
|
|
|
|
164
|
|
|
/** |
|
165
|
|
|
* Sets the operators contact data |
|
166
|
|
|
* |
|
167
|
|
|
* @param $operator |
|
168
|
|
|
* |
|
169
|
|
|
* @return $this |
|
170
|
|
|
*/ |
|
171
|
|
|
public function setOperator($operator) |
|
172
|
|
|
{ |
|
173
|
|
|
$this->operator = $operator; |
|
174
|
|
|
|
|
175
|
|
|
return $this; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
/** |
|
179
|
|
|
* Gets supported languages |
|
180
|
|
|
* |
|
181
|
|
|
* @return array |
|
182
|
|
|
*/ |
|
183
|
|
|
public function getSupportedLanguages() |
|
184
|
|
|
{ |
|
185
|
|
|
return $this->supportedLanguages; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* Sets supported languages |
|
190
|
|
|
* |
|
191
|
|
|
* @param $supportedLanguages |
|
192
|
|
|
* |
|
193
|
|
|
* @return $this |
|
194
|
|
|
*/ |
|
195
|
|
|
public function setSupportedLanguages($supportedLanguages) |
|
196
|
|
|
{ |
|
197
|
|
|
$this->supportedLanguages = $supportedLanguages; |
|
198
|
|
|
|
|
199
|
|
|
return $this; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Gets the default languages |
|
204
|
|
|
* |
|
205
|
|
|
* @return string |
|
206
|
|
|
*/ |
|
207
|
|
|
public function getDefaultLanguage() |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->defaultLanguage; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* Sets the default language |
|
214
|
|
|
* |
|
215
|
|
|
* @param $defaultLanguage |
|
216
|
|
|
* |
|
217
|
|
|
* @return $this |
|
218
|
|
|
*/ |
|
219
|
|
|
public function setDefaultLanguage($defaultLanguage) |
|
220
|
|
|
{ |
|
221
|
|
|
$this->defaultLanguage = $defaultLanguage; |
|
222
|
|
|
|
|
223
|
|
|
return $this; |
|
224
|
|
|
} |
|
225
|
|
|
|
|
226
|
|
|
/** |
|
227
|
|
|
* Enable or disable the detection of language setting of the browser |
|
228
|
|
|
* |
|
229
|
|
|
* @param $detectLanguage |
|
230
|
|
|
* |
|
231
|
|
|
* @return $this |
|
232
|
|
|
*/ |
|
233
|
|
|
public function setDetectLanguage($detectLanguage) |
|
234
|
|
|
{ |
|
235
|
|
|
$this->detectLanguage = $detectLanguage; |
|
236
|
|
|
|
|
237
|
|
|
return $this; |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
/** |
|
241
|
|
|
* Gets the browser language detecting setting |
|
242
|
|
|
* |
|
243
|
|
|
* @return bool |
|
244
|
|
|
*/ |
|
245
|
|
|
public function isDetectLanguage() |
|
246
|
|
|
{ |
|
247
|
|
|
return $this->detectLanguage; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* Gets the default languages |
|
252
|
|
|
* |
|
253
|
|
|
* @return string |
|
254
|
|
|
*/ |
|
255
|
|
|
public function getDefaultCurrencyCode() |
|
256
|
|
|
{ |
|
257
|
|
|
return $this->defaultCurrencyCode; |
|
258
|
|
|
} |
|
259
|
|
|
|
|
260
|
|
|
/** |
|
261
|
|
|
* Sets the default language |
|
262
|
|
|
* |
|
263
|
|
|
* @param $defaultCurrency |
|
264
|
|
|
* |
|
265
|
|
|
* @return $this |
|
266
|
|
|
*/ |
|
267
|
|
|
public function setDefaultCurrencyCode($defaultCurrency) |
|
268
|
|
|
{ |
|
269
|
|
|
$this->defaultCurrencyCode = $defaultCurrency; |
|
270
|
|
|
|
|
271
|
|
|
return $this; |
|
272
|
|
|
} |
|
273
|
|
|
|
|
274
|
|
|
/** |
|
275
|
|
|
* Gets the default tax rate |
|
276
|
|
|
* |
|
277
|
|
|
* @return string |
|
278
|
|
|
*/ |
|
279
|
|
|
public function getDefaultTaxRate() |
|
280
|
|
|
{ |
|
281
|
|
|
return $this->defaultTaxRate; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* Sets the default tax rate |
|
286
|
|
|
* |
|
287
|
|
|
* @param $defaultTaxRate |
|
288
|
|
|
* |
|
289
|
|
|
* @return $this |
|
290
|
|
|
*/ |
|
291
|
|
|
public function setDefaultTaxRate($defaultTaxRate) |
|
292
|
|
|
{ |
|
293
|
|
|
$this->defaultTaxRate = $defaultTaxRate; |
|
294
|
|
|
|
|
295
|
|
|
return $this; |
|
296
|
|
|
} |
|
297
|
|
|
|
|
298
|
|
|
/** |
|
299
|
|
|
* Gets system message email address. |
|
300
|
|
|
* |
|
301
|
|
|
* @return string |
|
302
|
|
|
* @throws MissingOptionException if no value is set. |
|
303
|
|
|
* @since 0.20 |
|
304
|
|
|
*/ |
|
305
|
|
|
public function getSystemMessageEmail() |
|
306
|
|
|
{ |
|
307
|
|
|
if (!$this->systemMessageEmail) { |
|
308
|
|
|
throw new MissingOptionException('systemMessageEmail', $this); |
|
|
|
|
|
|
309
|
|
|
} |
|
310
|
|
|
return $this->systemMessageEmail; |
|
311
|
|
|
} |
|
312
|
|
|
|
|
313
|
|
|
/** |
|
314
|
|
|
* Sets system message email address. |
|
315
|
|
|
* |
|
316
|
|
|
* @param string $systemMessageEmail |
|
317
|
|
|
* |
|
318
|
|
|
* @return self |
|
319
|
|
|
* @since 0.20 |
|
320
|
|
|
*/ |
|
321
|
|
|
public function setSystemMessageEmail($systemMessageEmail) |
|
322
|
|
|
{ |
|
323
|
|
|
$this->systemMessageEmail = $systemMessageEmail; |
|
324
|
|
|
|
|
325
|
|
|
return $this; |
|
326
|
|
|
} |
|
327
|
|
|
} |
|
328
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: