ModuleOptions   B
last analyzed

Complexity

Total Complexity 36

Size/Duplication

Total Lines 493
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 36
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 493
rs 8.8

36 Methods

Rating   Name   Duplication   Size   Complexity  
A getLoginRedirectRoute() 0 4 1
A setLogoutRedirectRoute() 0 5 1
A getLogoutRedirectRoute() 0 4 1
A setUseRedirectParameterIfPresent() 0 5 1
A getUseRedirectParameterIfPresent() 0 4 1
A setUserLoginWidgetViewTemplate() 0 5 1
A getUserLoginWidgetViewTemplate() 0 4 1
A setEnableRegistration() 0 5 1
A getEnableRegistration() 0 4 1
A setLoginFormTimeout() 0 5 1
A getLoginFormTimeout() 0 4 1
A setUserFormTimeout() 0 5 1
A getUserFormTimeout() 0 4 1
A setLoginAfterRegistration() 0 5 1
A getLoginAfterRegistration() 0 4 1
A getEnableUserState() 0 4 1
A setEnableUserState() 0 5 1
A getDefaultUserState() 0 4 1
A setDefaultUserState() 0 5 1
A getAllowedLoginStates() 0 4 1
A setAllowedLoginStates() 0 5 1
A setAuthAdapters() 0 5 1
A getAuthAdapters() 0 4 1
A setAuthIdentityFields() 0 5 1
A getAuthIdentityFields() 0 4 1
A setEnableUsername() 0 5 1
A getEnableUsername() 0 4 1
A setEnableDisplayName() 0 5 1
A getEnableDisplayName() 0 4 1
A setUserEntityClass() 0 5 1
A getPasswordCost() 0 4 1
A setTableName() 0 4 1
A getTableName() 0 4 1
A setLoginRedirectRoute() 0 5 1
A getUserEntityClass() 0 4 1
A setPasswordCost() 0 5 1
1
<?php
2
3
namespace ZfcUser\Options;
4
5
use Zend\Stdlib\AbstractOptions;
6
7
class ModuleOptions extends AbstractOptions implements UserControllerOptionsInterface, UserServiceOptionsInterface
8
{
9
    /**
10
     * Turn off strict options mode
11
     */
12
    protected $__strictMode__ = false;
13
14
    /**
15
     * @var bool
16
     */
17
    protected $useRedirectParameterIfPresent = true;
18
19
    /**
20
     * @var string
21
     */
22
    protected $loginRedirectRoute = 'zfcuser';
23
24
    /**
25
     * @var string
26
     */
27
    protected $logoutRedirectRoute = 'zfcuser/login';
28
29
    /**
30
     * @var int
31
     */
32
    protected $loginFormTimeout = 300;
33
34
    /**
35
     * @var int
36
     */
37
    protected $userFormTimeout = 300;
38
39
    /**
40
     * @var bool
41
     */
42
    protected $loginAfterRegistration = true;
43
44
    /**
45
     * @var int
46
     */
47
    protected $enableUserState = false;
48
49
    /**
50
     * @var int
51
     */
52
    protected $defaultUserState = 1;
53
54
    /**
55
     * @var Array
56
     */
57
    protected $allowedLoginStates = array( null, 1 );
58
59
    /**
60
     * @var array
61
     */
62
    protected $authAdapters = array( 100 => 'ZfcUser\Authentication\Adapter\Db' );
63
64
    /**
65
     * @var array
66
     */
67
    protected $authIdentityFields = array( 'email' );
68
69
    /**
70
     * @var string
71
     */
72
    protected $userEntityClass = 'ZfcUser\Entity\User';
73
74
    /**
75
     * @var string
76
     */
77
    protected $userLoginWidgetViewTemplate = 'zfc-user/user/login.phtml';
78
79
    /**
80
     * @var bool
81
     */
82
    protected $enableRegistration = true;
83
84
    /**
85
     * @var bool
86
     */
87
    protected $enableUsername = false;
88
89
    /**
90
     * @var bool
91
     */
92
    protected $enableDisplayName = false;
93
94
    /**
95
     * @var int
96
     */
97
    protected $passwordCost = 14;
98
99
    /**
100
     * @var string
101
     */
102
103
    protected $tableName = 'user';
104
105
106
    /**
107
     * set login redirect route
108
     *
109
     * @param string $loginRedirectRoute
110
     * @return ModuleOptions
111
     */
112
    public function setLoginRedirectRoute($loginRedirectRoute)
113
    {
114
        $this->loginRedirectRoute = $loginRedirectRoute;
115
        return $this;
116
    }
117
118
    /**
119
     * get login redirect route
120
     *
121
     * @return string
122
     */
123
    public function getLoginRedirectRoute()
124
    {
125
        return $this->loginRedirectRoute;
126
    }
127
128
    /**
129
     * set logout redirect route
130
     *
131
     * @param string $logoutRedirectRoute
132
     * @return ModuleOptions
133
     */
134
    public function setLogoutRedirectRoute($logoutRedirectRoute)
135
    {
136
        $this->logoutRedirectRoute = $logoutRedirectRoute;
137
        return $this;
138
    }
139
140
    /**
141
     * get logout redirect route
142
     *
143
     * @return string
144
     */
145
    public function getLogoutRedirectRoute()
146
    {
147
        return $this->logoutRedirectRoute;
148
    }
149
150
    /**
151
     * set use redirect param if present
152
     *
153
     * @param bool $useRedirectParameterIfPresent
154
     * @return ModuleOptions
155
     */
156
    public function setUseRedirectParameterIfPresent($useRedirectParameterIfPresent)
157
    {
158
        $this->useRedirectParameterIfPresent = $useRedirectParameterIfPresent;
159
        return $this;
160
    }
161
162
    /**
163
     * get use redirect param if present
164
     *
165
     * @return bool
166
     */
167
    public function getUseRedirectParameterIfPresent()
168
    {
169
        return $this->useRedirectParameterIfPresent;
170
    }
171
172
    /**
173
     * set the view template for the user login widget
174
     *
175
     * @param string $userLoginWidgetViewTemplate
176
     * @return ModuleOptions
177
     */
178
    public function setUserLoginWidgetViewTemplate($userLoginWidgetViewTemplate)
179
    {
180
        $this->userLoginWidgetViewTemplate = $userLoginWidgetViewTemplate;
181
        return $this;
182
    }
183
184
    /**
185
     * get the view template for the user login widget
186
     *
187
     * @return string
188
     */
189
    public function getUserLoginWidgetViewTemplate()
190
    {
191
        return $this->userLoginWidgetViewTemplate;
192
    }
193
194
    /**
195
     * set enable user registration
196
     *
197
     * @param bool $enableRegistration
198
     * @return ModuleOptions
199
     */
200
    public function setEnableRegistration($enableRegistration)
201
    {
202
        $this->enableRegistration = $enableRegistration;
203
        return $this;
204
    }
205
206
    /**
207
     * get enable user registration
208
     *
209
     * @return bool
210
     */
211
    public function getEnableRegistration()
212
    {
213
        return $this->enableRegistration;
214
    }
215
216
    /**
217
     * set login form timeout
218
     *
219
     * @param int $loginFormTimeout
220
     * @return ModuleOptions
221
     */
222
    public function setLoginFormTimeout($loginFormTimeout)
223
    {
224
        $this->loginFormTimeout = $loginFormTimeout;
225
        return $this;
226
    }
227
228
    /**
229
     * get login form timeout in seconds
230
     *
231
     * @return int
232
     */
233
    public function getLoginFormTimeout()
234
    {
235
        return $this->loginFormTimeout;
236
    }
237
238
    /**
239
     * set user form timeout in seconds
240
     *
241
     * @param int $userFormTimeout
242
     * @return ModuleOptions
243
     */
244
    public function setUserFormTimeout($userFormTimeout)
245
    {
246
        $this->userFormTimeout = $userFormTimeout;
247
        return $this;
248
    }
249
250
    /**
251
     * get user form timeout in seconds
252
     *
253
     * @return int
254
     */
255
    public function getUserFormTimeout()
256
    {
257
        return $this->userFormTimeout;
258
    }
259
260
    /**
261
     * set login after registration
262
     *
263
     * @param bool $loginAfterRegistration
264
     * @return ModuleOptions
265
     */
266
    public function setLoginAfterRegistration($loginAfterRegistration)
267
    {
268
        $this->loginAfterRegistration = $loginAfterRegistration;
269
        return $this;
270
    }
271
272
    /**
273
     * get login after registration
274
     *
275
     * @return bool
276
     */
277
    public function getLoginAfterRegistration()
278
    {
279
        return $this->loginAfterRegistration;
280
    }
281
282
    /**
283
     * get user state usage for registration/login process
284
     *
285
     * @return int
286
     */
287
    public function getEnableUserState()
288
    {
289
        return $this->enableUserState;
290
    }
291
292
    /**
293
     * set user state usage for registration/login process
294
     *
295
     * @param boolean $flag
296
     * @return ModuleOptions
297
     */
298
    public function setEnableUserState($flag)
299
    {
300
        $this->enableUserState = $flag;
301
        return $this;
302
    }
303
304
    /**
305
     * get default user state on registration
306
     *
307
     * @return int
308
     */
309
    public function getDefaultUserState()
310
    {
311
        return $this->defaultUserState;
312
    }
313
314
    /**
315
     * set default user state on registration
316
     *
317
     * @param int $state
318
     * @return ModuleOptions
319
     */
320
    public function setDefaultUserState($state)
321
    {
322
        $this->defaultUserState = $state;
323
        return $this;
324
    }
325
326
    /**
327
     * get list of states to allow user login
328
     *
329
     * @return array
330
     */
331
    public function getAllowedLoginStates()
332
    {
333
        return $this->allowedLoginStates;
334
    }
335
336
    /**
337
     * set list of states to allow user login
338
     *
339
     * @param Array $states
340
     * @return ModuleOptions
341
     */
342
    public function setAllowedLoginStates(Array $states)
343
    {
344
        $this->allowedLoginStates = $states;
345
        return $this;
346
    }
347
348
    /**
349
     * set auth adapters
350
     *
351
     * @param array $authAdapterss
352
     * @return ModuleOptions
353
     */
354
    public function setAuthAdapters($authAdapters)
355
    {
356
        $this->authAdapters = $authAdapters;
357
        return $this;
358
    }
359
360
    /**
361
     * get auth adapters
362
     *
363
     * @return array
364
     */
365
    public function getAuthAdapters()
366
    {
367
        return $this->authAdapters;
368
    }
369
370
    /**
371
     * set auth identity fields
372
     *
373
     * @param array $authIdentityFields
374
     * @return ModuleOptions
375
     */
376
    public function setAuthIdentityFields($authIdentityFields)
377
    {
378
        $this->authIdentityFields = $authIdentityFields;
379
        return $this;
380
    }
381
382
    /**
383
     * get auth identity fields
384
     *
385
     * @return array
386
     */
387
    public function getAuthIdentityFields()
388
    {
389
        return $this->authIdentityFields;
390
    }
391
392
    /**
393
     * set enable username
394
     *
395
     * @param bool $flag
396
     * @return ModuleOptions
397
     */
398
    public function setEnableUsername($flag)
399
    {
400
        $this->enableUsername = (bool) $flag;
401
        return $this;
402
    }
403
404
    /**
405
     * get enable username
406
     *
407
     * @return bool
408
     */
409
    public function getEnableUsername()
410
    {
411
        return $this->enableUsername;
412
    }
413
414
    /**
415
     * set enable display name
416
     *
417
     * @param bool $flag
418
     * @return ModuleOptions
419
     */
420
    public function setEnableDisplayName($flag)
421
    {
422
        $this->enableDisplayName = (bool) $flag;
423
        return $this;
424
    }
425
426
    /**
427
     * get enable display name
428
     *
429
     * @return bool
430
     */
431
    public function getEnableDisplayName()
432
    {
433
        return $this->enableDisplayName;
434
    }
435
436
    /**
437
     * set user entity class name
438
     *
439
     * @param string $userEntityClass
440
     * @return ModuleOptions
441
     */
442
    public function setUserEntityClass($userEntityClass)
443
    {
444
        $this->userEntityClass = $userEntityClass;
445
        return $this;
446
    }
447
448
    /**
449
     * get user entity class name
450
     *
451
     * @return string
452
     */
453
    public function getUserEntityClass()
454
    {
455
        return $this->userEntityClass;
456
    }
457
458
    /**
459
     * set password cost
460
     *
461
     * @param int $passwordCost
462
     * @return ModuleOptions
463
     */
464
    public function setPasswordCost($passwordCost)
465
    {
466
        $this->passwordCost = $passwordCost;
467
        return $this;
468
    }
469
470
    /**
471
     * get password cost
472
     *
473
     * @return int
474
     */
475
    public function getPasswordCost()
476
    {
477
        return $this->passwordCost;
478
    }
479
480
    /**
481
     * set user table name
482
     *
483
     * @param string $tableName
484
     */
485
    public function setTableName($tableName)
486
    {
487
        $this->tableName=$tableName;
488
    }
489
490
    /**
491
     * get user table name
492
     *
493
     * @return string
494
     */
495
    public function getTableName()
496
    {
497
        return $this->tableName;
498
    }
499
}
500