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

security::admin_security_settings_common()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 7
nc 2
nop 1
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 6
rs 9.6666
c 0
b 0
f 0
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;
11
use
12
	cs\Config;
13
14
trait security {
15
	protected static $security_options_keys = [
16
		'key_expire',
17
		'gravatar_support'
18
	];
19
	/**
20
	 * Get security settings
21
	 */
22
	public static function admin_security_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...
23
		$Config = Config::instance();
24
		return $Config->core(static::$security_options_keys) + [
25
			'applied' => $Config->cancel_available()
26
		];
27
	}
28
	/**
29
	 * Apply security settings
30
	 *
31
	 * @param \cs\Request $Request
32
	 *
33
	 * @throws \cs\ExitException
34
	 */
35
	public static function admin_security_apply_settings ($Request) {
36
		static::admin_core_options_apply($Request, static::$security_options_keys);
37
	}
38
	/**
39
	 * Save security settings
40
	 *
41
	 * @param \cs\Request $Request
42
	 *
43
	 * @throws \cs\ExitException
44
	 */
45
	public static function admin_security_save_settings ($Request) {
46
		static::admin_core_options_save($Request, static::$security_options_keys);
47
	}
48
	/**
49
	 * Cancel security settings
50
	 *
51
	 * @throws \cs\ExitException
52
	 */
53
	public static function admin_security_cancel_settings () {
54
		static::admin_core_options_cancel();
55
	}
56
}
57