Passed
Push — master ( 9b8fdb...e88b61 )
by Mike
02:53
created

CachePrefixing   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getDatabaseConnectionName() 0 3 1
A getCachePrefix() 0 7 2
1
<?php namespace GeneaLabs\LaravelModelCaching\Traits;
2
3
trait CachePrefixing
4
{
5
    protected function getCachePrefix() : string
6
    {
7
        return "genealabs:laravel-model-caching:"
8
            . $this->getDatabaseConnectionName() . ":"
9
            . (config("laravel-model-caching.cache-prefix")
10
                ? config("laravel-model-caching.cache-prefix", "") . ":"
11
                : "");
12
    }
13
14
    protected function getDatabaseConnectionName() : string
15
    {
16
        return $this->query->connection->getName();
0 ignored issues
show
Bug Best Practice introduced by
The property query does not exist on GeneaLabs\LaravelModelCa...g\Traits\CachePrefixing. Did you maybe forget to declare it?
Loading history...
17
    }
18
}
19