BetweenFilter::filter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
3
namespace San4io\EloquentFilter\Filters;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class BetweenFilter extends AbstractFilter
8
{
9
    /**
10
     * @param string $key
11
     * @param array $value
12
     * @return Builder
13
     */
14 1
    public function filter(string $key, $value): Builder
15
    {
16 1
        return $this->model->whereBetween($key, [
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->model->whe...rom'], $value['till'])) 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...
17 1
            $value['from'],
18 1
            $value['till']
19
        ]);
20
    }
21
}