FiltersTrashed   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 16 3
1
<?php
2
3
namespace Spatie\QueryBuilder\Filters;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class FiltersTrashed implements Filter
8
{
9
    /** {@inheritdoc} */
10
    public function __invoke(Builder $query, $value, string $property)
11
    {
12
        if ($value === 'with') {
13
            $query->withTrashed();
14
15
            return;
16
        }
17
18
        if ($value === 'only') {
19
            $query->onlyTrashed();
20
21
            return;
22
        }
23
24
        $query->withoutTrashed();
25
    }
26
}
27