TimberCommand::clear_cache_twig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * These are methods that can be executed by WPCLI, other CLI mechanism or other external controllers
5
 * @package  timber
6
 */
7
class TimberCommand {
8
9
    public static function clear_cache($mode = 'all'){
10
        if (is_array($mode)){
11
            $mode = reset($mode);
12
        }
13
        if ($mode == 'all') {
14
            $twig_cache = self::clear_cache_twig();
15
            $timber_cache = self::clear_cache_timber();
16
            if ($twig_cache && $timber_cache){
17
                return true;
18
            }
19
        } else if ($mode == 'twig') {
20
            return self::clear_cache_twig();
21
        } else if ($mode == 'timber') {
22
            return self::clear_cache_timber();
23
        }
24
    }
25
26
    static function clear_cache_timber(){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
        $loader = new TimberLoader();
28
        return $loader->clear_cache_timber();
29
    }
30
31
    static function clear_cache_twig(){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
32
        $loader = new TimberLoader();
33
        return $loader->clear_cache_twig();
34
    }
35
36
}
37