Between   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A condition() 0 3 1
A __construct() 0 4 1
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