Between::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by enea dhack - 29/12/2019 12:24.
4
 */
5
6
namespace Vaened\Searcher\Constraints;
7
8
use Illuminate\Database\Eloquent\Builder;
9
use Vaened\Searcher\Constraint;
10
use Vaened\Searcher\Rangeable;
11
12
class Between implements Constraint
13
{
14
    private Rangeable $range;
15
16
    private string $column;
17
18
    public function __construct(Rangeable $range, string $column)
19
    {
20
        $this->range = $range;
21
        $this->column = $column;
22
    }
23
24
    public function condition(Builder $builder): Builder
25
    {
26
        return $builder->whereBetween($this->column, $this->range->getRange());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $builder->whereBe...his->range->getRange()) 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...
27
    }
28
}
29