Completed
Push — master ( 3f79ab...6d3a78 )
by Nazar
04:26
created

general::admin_users_general_settings_common()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 28
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 25
nc 2
nop 1
dl 0
loc 28
ccs 0
cts 26
cp 0
crap 6
rs 8.8571
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A general::admin_users_general_cancel_settings() 0 3 1
1
<?php
2
/**
3
 * @package    CleverStyle Framework
4
 * @subpackage System module
5
 * @category   modules
6
 * @author     Nazar Mokrynskyi <[email protected]>
7
 * @copyright  Copyright (c) 2015-2016, Nazar Mokrynskyi
8
 * @license    MIT License, see license.txt
9
 */
10
namespace cs\modules\System\api\Controller\admin\users;
11
use
12
	cs\Config;
13
14
trait general {
15
	protected static $users_general_options_keys = [
16
		'session_expire',
17
		'sign_in_attempts_block_count',
18
		'sign_in_attempts_block_time',
19
		'remember_user_ip',
20
		'password_min_length',
21
		'password_min_strength',
22
		'allow_user_registration',
23
		'require_registration_confirmation',
24
		'registration_confirmation_time',
25
		'auto_sign_in_after_registration'
26
	];
27
	/**
28
	 * Get general users settings
29
	 */
30
	public static function admin_users_general_get_settings () {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
31
		$Config = Config::instance();
32
		return $Config->core(static::$users_general_options_keys) + [
33
			'applied' => $Config->cancel_available()
34
		];
35
	}
36
	/**
37
	 * Apply general users settings
38
	 *
39
	 * @param \cs\Request $Request
40
	 *
41
	 * @throws \cs\ExitException
42
	 */
43
	public static function admin_users_general_apply_settings ($Request) {
44
		static::admin_core_options_apply($Request, static::$users_general_options_keys);
45
	}
46
	/**
47
	 * Save general users settings
48
	 *
49
	 * @param \cs\Request $Request
50
	 *
51
	 * @throws \cs\ExitException
52
	 */
53
	public static function admin_users_general_save_settings ($Request) {
54
		static::admin_core_options_save($Request, static::$users_general_options_keys);
55
	}
56
	/**
57
	 * Cancel general users settings
58
	 *
59
	 * @throws \cs\ExitException
60
	 */
61
	public static function admin_users_general_cancel_settings () {
62
		static::admin_core_options_cancel();
63
	}
64
}
65