ViewComposer::cacheResults()   A
last analyzed

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