Passed
Push — master ( 269118...f38a4a )
by Mike
02:39
created

BuilderCaching   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A all() 0 7 2
1
<?php namespace GeneaLabs\LaravelModelCaching\Traits;
2
3
use Illuminate\Database\Eloquent\Collection;
4
5
trait BuilderCaching
6
{
7
    public function all($columns = ['*']) : Collection
8
    {
9
        if (! $this->isCachable()) {
1 ignored issue
show
Bug introduced by
It seems like isCachable() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

9
        if (! $this->/** @scrutinizer ignore-call */ isCachable()) {
Loading history...
10
            $this->model->disableModelCaching();
0 ignored issues
show
Bug Best Practice introduced by
The property model does not exist on GeneaLabs\LaravelModelCa...g\Traits\BuilderCaching. Did you maybe forget to declare it?
Loading history...
11
        }
12
13
        return $this->model->get($columns);
14
    }
15
}
16