InFilterDirective   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 3
c 1
b 0
f 0
dl 0
loc 13
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 3 1
A name() 0 3 1
1
<?php
2
3
namespace DeInternetJongens\LighthouseUtils\Directives;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class InFilterDirective extends BaseDirective
8
{
9
    /**
10
     * @inheritdoc
11
     */
12
    public function handle(string $fieldName, $value, Builder $builder): Builder
13
    {
14
        return $builder->whereIn($fieldName, $value);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $builder->whereIn($fieldName, $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...
15
    }
16
17
    public function name(): string
18
    {
19
        return 'in';
20
    }
21
}
22