Passed
Pull Request — master (#28)
by Mike
02:21
created

Cachable::cache()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php namespace GeneaLabs\LaravelModelCaching\Traits;
2
3
use Illuminate\Cache\TaggableStore;
4
5
trait Cachable
6
{
7
    protected function cache(array $tags = [])
8
    {
9
        $cache = cache();
10
11
        if (is_subclass_of($cache->getStore(), TaggableStore::class)) {
12
            $cache = $cache->tags($tags);
13
        }
14
15
        return $cache;
16
    }
17
}
18