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

system::admin_system_settings_common()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 11
c 1
b 1
f 0
nc 2
nop 1
dl 0
loc 13
ccs 0
cts 12
cp 0
crap 6
rs 9.4285

1 Method

Rating   Name   Duplication   Size   Complexity  
A system::admin_system_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;
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