WhereFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 7 2
1
<?php
2
3
namespace San4io\EloquentFilter\Filters;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class WhereFilter extends AbstractFilter
8
{
9
    /**
10
     * @param string $key
11
     * @param array|int $value
12
     * @return Builder
13
     */
14 4
    public function filter(string $key, $value): Builder
15
    {
16 4
        if (is_array($value)) {
17 1
            return $this->model->whereIn($key, $value);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->whereIn($key, $value) could return the type Illuminate\Database\Query\Builder which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
18
        }
19
20 3
        return $this->model->where($key, $value);
21
    }
22
}