Completed
Push — master ( 6ee53d...bb5f21 )
by ARCANEDEV
04:30
created

ViewComposer::cacheResults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php namespace Arcanesoft\Pages\Bases;
2
3
use Closure;
4
use Illuminate\Support\Facades\Cache;
5
6
/**
7
 * Class     ViewComposer
8
 *
9
 * @package  Arcanesoft\Pages\Bases
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
abstract class ViewComposer
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * The View instance.
20
     *
21
     * @var \Illuminate\Contracts\View\View
22
     */
23
    protected $view;
24
25
    /**
26
     * Caching time.
27
     *
28
     * @var int
29
     */
30
    protected $minutes = 5;
31
32
    /* ------------------------------------------------------------------------------------------------
33
     |  Other Functions
34
     | ------------------------------------------------------------------------------------------------
35
     */
36
    /**
37
     * Cache the results.
38
     *
39
     * @param  string    $name
40
     * @param  \Closure  $callback
41
     *
42
     * @return mixed
43
     */
44
    protected function cacheResults($name, Closure $callback)
45
    {
46
        return Cache::remember('cache::' . $name, $this->minutes, $callback);
47
    }
48
}
49