Completed
Push — master ( 83b49e...84b670 )
by Nazar
04:49
created

Controller::edit_page()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 73
Code Lines 42

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 42
nc 1
nop 1
dl 0
loc 73
rs 9.0675
c 0
b 0
f 0

How to fix   Long Method   

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   Static Pages
4
 * @category  modules
5
 * @author    Nazar Mokrynskyi <[email protected]>
6
 * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi
7
 * @license   MIT License, see license.txt
8
 */
9
namespace cs\modules\Static_pages\admin;
10
use
11
	h,
12
	cs\Language\Prefix,
13
	cs\Page,
14
	cs\modules\Static_pages\Categories;
15
16
class Controller {
17
	/**
18
	 * @return string
19
	 */
20
	public static function browse_categories () {
21
		return h::cs_static_pages_admin_categories_list();
22
	}
23
	/**
24
	 * @param \cs\Request $Request
25
	 *
26
	 * @return string
27
	 */
28
	public static function browse_pages ($Request) {
29
		$L        = new Prefix('static_pages_');
30
		$category = $Request->route_ids(0);
31
		Page::instance()->title(
32
			$category ? Categories::instance()->get($category)['title'] : $L->root_category
33
		);
34
		return h::cs_static_pages_admin_pages_list(
35
			[
36
				'category' => $category
37
			]
38
		);
39
	}
40
}
41