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

BuilderCaching::all()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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