Completed
Push — master ( cd0bb4...2c65ad )
by Nazar
04:31
created

Controller::save()   D

Complexity

Conditions 18
Paths 12

Size

Total Lines 40
Code Lines 29

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 1
Metric Value
c 5
b 0
f 1
dl 0
loc 40
rs 4.9471
cc 18
eloc 29
nc 12
nop 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * @package    CleverStyle CMS
4
 * @subpackage System module
5
 * @category   modules
6
 * @author     Nazar Mokrynskyi <[email protected]>
7
 * @copyright  Copyright (c) 2015, Nazar Mokrynskyi
8
 * @license    MIT License, see license.txt
9
 */
10
namespace cs\modules\System\admin;
11
use
12
	cs\Language,
13
	cs\Page,
14
	cs\modules\System\admin\Controller\components,
15
	cs\modules\System\admin\Controller\general,
16
	cs\modules\System\admin\Controller\users,
17
	cs\modules\System\admin\Controller\users_save,
18
	cs\modules\System\admin\Controller\layout_elements;
19
20
class Controller {
21
	use
22
		components,
23
		general,
24
		users,
25
		users_save,
26
		layout_elements;
27
	static function index (
28
		/** @noinspection PhpUnusedParameterInspection */
29
		$route_ids,
30
		$route_path
31
	) {
32
		$L           = Language::instance();
33
		$Page        = Page::instance();
34
		$save_method = "$route_path[0]_$route_path[1]_save";
35
		if (method_exists(__CLASS__, $save_method)) {
36
			self::$save_method();
37
		}
38
		$Page->title($L->{$route_path[0]});
39
		$Page->title($L->{$route_path[1]});
40
	}
41
}
42