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

system::admin_system_cancel_settings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
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 system {
15
	protected static $system_options_keys = [
16
		'site_mode',
17
		'closed_title',
18
		'closed_text',
19
		'title_delimiter',
20
		'title_reverse',
21
		'simple_admin_mode'
22
	];
23
	/**
24
	 * Get system settings
25
	 */
26
	public static function admin_system_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...
27
		$Config = Config::instance();
28
		return $Config->core(static::$system_options_keys) + [
29
			'applied' => $Config->cancel_available()
30
		];
31
	}
32
	/**
33
	 * Apply system settings
34
	 *
35
	 * @param \cs\Request $Request
36
	 *
37
	 * @throws \cs\ExitException
38
	 */
39
	public static function admin_system_apply_settings ($Request) {
40
		static::admin_core_options_apply($Request, static::$system_options_keys);
41
	}
42
	/**
43
	 * Save system settings
44
	 *
45
	 * @param \cs\Request $Request
46
	 *
47
	 * @throws \cs\ExitException
48
	 */
49
	public static function admin_system_save_settings ($Request) {
50
		static::admin_core_options_save($Request, static::$system_options_keys);
51
	}
52
	/**
53
	 * Cancel system settings
54
	 *
55
	 * @throws \cs\ExitException
56
	 */
57
	public static function admin_system_cancel_settings () {
58
		static::admin_core_options_cancel();
59
	}
60
}
61