Total Complexity | 8 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 52.17% |
Changes | 0 |
1 | <?php |
||
10 | class Banner { |
||
11 | |||
12 | /** |
||
13 | * DB handle |
||
14 | */ |
||
15 | private $db; |
||
16 | |||
17 | /* |
||
18 | * Memcache handle |
||
19 | */ |
||
20 | private $mem; |
||
21 | |||
22 | 1 | public function __construct() |
|
26 | 1 | } |
|
27 | |||
28 | public function get_text() { |
||
29 | $text = $this->mem->get('banner'); |
||
30 | |||
31 | if ( $text === false ) { |
||
|
|||
32 | $q = $this->db->query("SELECT value FROM editorial WHERE item = 'banner'")->first(); |
||
33 | |||
34 | if ($q) { |
||
35 | $text = $q['value']; |
||
36 | if ( trim($text) == '' ) { |
||
37 | $text = NULL; |
||
38 | } |
||
39 | $this->mem->set('banner', $text, 86400); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | return $text; |
||
44 | } |
||
45 | |||
46 | 1 | public function set_text($text) { |
|
61 | } |
||
62 | } |
||
63 |