Completed
Push — master ( e247e1...423d9f )
by Nazar
04:02
created

optimization   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 1
dl 0
loc 50
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A optimization_clean_cache() 0 4 1
A optimization_clean_pcache() 0 4 1
A optimization_help() 0 21 1
1
<?php
2
/**
3
 * @package    CleverStyle CMS
4
 * @subpackage System module
5
 * @category   modules
6
 * @author     Nazar Mokrynskyi <[email protected]>
7
 * @copyright  Copyright (c) 2016, Nazar Mokrynskyi
8
 * @license    MIT License, see license.txt
9
 */
10
namespace cs\modules\System\cli\Controller;
11
use
12
	cs\modules\System\api\Controller as Api_controller;
13
use function
14
	cli\line;
15
16
trait optimization {
17
	/**
18
	 * Clean cache
19
	 *
20
	 * @param \cs\Request $Request
21
	 *
22
	 * @return string
23
	 *
24
	 * @throws \cs\ExitException
25
	 */
26
	static function optimization_clean_cache ($Request) {
27
		Api_controller::admin_optimization_clean_cache($Request);
28
		return "%gOK%n\n";
29
	}
30
	/**
31
	 * Clean public cache (CSS/JS/HTML)
32
	 *
33
	 * @return string
34
	 *
35
	 * @throws \cs\ExitException
36
	 */
37
	static function optimization_clean_pcache () {
38
		Api_controller::admin_optimization_clean_pcache();
39
		return "%gOK%n\n";
40
	}
41
	/**
42
	 * @return string
43
	 */
44
	static function optimization_help () {
45
		return <<<HELP
46
%ySystem optimization%n
47
48
%yMethods:%n
49
  %gclean_cache%n  Clean system cache
50
  %gclean_pcache%n Clear the cache of scripts and styles
51
52
%yArguments:%n
53
  %gprefix_path%n If present, will clean only part of cache (%gclean_cache%n only)
54
55
%yExamples%n
56
  Clean the whole system cache:
57
    %g./cli clean_cache:System/optimization%n
58
  Clean only languages cache:
59
    %g./cli clean_cache:System/optimization prefix_path=languages%n
60
  Clean the whole system public cache:
61
    %g./cli clean_pcache:System/optimization%n
62
63
HELP;
64
	}
65
}
66