Filterable   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 9
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getConstraints() 0 5 1
1
<?php
2
/**
3
 * Created by enea dhack - 28/12/2019 15:06.
4
 */
5
6
namespace Vaened\Searcher;
7
8
use Closure;
9
use Illuminate\Support\Arr;
10
11
abstract class Filterable
12
{
13
    abstract protected function getAvailableConstraints(): ConstraintCollection;
14
15
    public function getConstraints(array $keys): array
16
    {
17
        $collection = $this->getAvailableConstraints();
18
        $closures = Arr::only($collection->all(), $keys);
19
        return array_map(fn(Closure $callable): Constraint => $callable(), $closures);
20
    }
21
}
22