WithFilters   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A filter() 0 7 2
1
<?php
2
/**
3
 * Created by enea dhack - 12/06/2020 17:07.
4
 */
5
6
namespace Vaened\Searcher;
7
8
trait WithFilters
9
{
10
    abstract protected function getFilterProvider(): Filterable;
11
12
    public function filter(array $filters): self
13
    {
14
        $constraints = $this->getFilterProvider()->getConstraints($filters);
15
        foreach ($constraints as $constraint) {
16
            $this->apply($constraint);
0 ignored issues
show
Bug introduced by
It seems like apply() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
            $this->/** @scrutinizer ignore-call */ 
17
                   apply($constraint);
Loading history...
17
        }
18
        return $this;
19
    }
20
}
21