Skip to content

Commit 4e54fec

Browse files
committed
Code style, use renamed operators
1 parent c4984fb commit 4e54fec

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/Processor/FilterProcessor.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ public function process($src, OperationInterface $operation)
1919
$value = $operation->getValue();
2020
$operator = $operation->getOperator();
2121
$field = $operation->getField();
22-
if($operator == FilterOperation::STR_STARTS_WITH){
23-
$operator = FilterOperation::OPERATOR_LIKE;
24-
$value = $value."%";
25-
}else if($operator == FilterOperation::STR_ENDS_WITH){
26-
$operator = FilterOperation::OPERATOR_LIKE;
27-
$value = "%".$value;
28-
}else if($operator == FilterOperation::STR_CONTAINS){
29-
$operator = FilterOperation::OPERATOR_LIKE;
30-
$value = "%".$value."%";
22+
switch ($operator) {
23+
case FilterOperation::OPERATOR_STR_STARTS_WITH:
24+
$operator = FilterOperation::OPERATOR_LIKE;
25+
$value .= '%';
26+
break;
27+
case FilterOperation::OPERATOR_STR_ENDS_WITH:
28+
$operator = FilterOperation::OPERATOR_LIKE;
29+
$value = '%' . $value;
30+
break;
31+
case FilterOperation::OPERATOR_STR_CONTAINS:
32+
$operator = FilterOperation::OPERATOR_LIKE;
33+
$value = '%' . $value . '%';
34+
break;
3135
}
3236
$src->where($field, $operator, $value);
3337
return $src;

0 commit comments

Comments
 (0)