Total Complexity | 3 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class FilterClause extends Clause |
||
11 | { |
||
12 | /** |
||
13 | * @var array<mixed>|PredicateExpression |
||
14 | */ |
||
15 | protected array|PredicateExpression $predicates = []; |
||
16 | |||
17 | protected string $defaultLogicalOperator = 'AND'; |
||
18 | |||
19 | /** |
||
20 | * Filter statement. |
||
21 | * |
||
22 | * @param array<mixed> $predicates |
||
23 | */ |
||
24 | 14 | public function __construct( |
|
25 | array|PredicateExpression $predicates |
||
26 | ) { |
||
27 | 14 | parent::__construct(); |
|
28 | |||
29 | 14 | $this->predicates = $predicates; |
|
30 | } |
||
31 | |||
32 | 13 | public function compile(QueryBuilder $queryBuilder): string |
|
33 | { |
||
34 | 13 | $this->predicates = $queryBuilder->normalizePredicates($this->predicates); |
|
35 | |||
36 | 13 | $compiledPredicates = $queryBuilder->compilePredicates($this->predicates); |
|
37 | |||
38 | 13 | return 'FILTER ' . rtrim($compiledPredicates); |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * @return PredicateExpression|array<mixed> |
||
43 | */ |
||
44 | 1 | public function getPredicates(): array|PredicateExpression |
|
47 | } |
||
48 | } |
||
49 |