Conditions | 5 |
Paths | 8 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | function cacheResult($args, $phpCode, $widget) |
||
|
|||
20 | { |
||
21 | $key = $this->makeCacheKey($args,$widget); |
||
22 | |||
23 | $cache = app('cache'); |
||
24 | |||
25 | if ($widget->cacheTags) { |
||
26 | $cache = $cache->tags($widget->cacheTags); |
||
27 | } |
||
28 | |||
29 | if ($widget->cacheLifeTime > 0) { |
||
30 | return $cache->remember($key, $widget->cacheLifeTime, $phpCode); |
||
31 | } |
||
32 | |||
33 | if ($widget->cacheLifeTime < 0) { |
||
34 | return $cache->rememberForever($key, $phpCode); |
||
35 | } |
||
36 | |||
37 | if ($widget->cacheLifeTime === 0) { |
||
38 | return $phpCode(); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.