Skip to content

Commit

Permalink
Code style, use renamed operators
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayjest committed Apr 8, 2016
1 parent c4984fb commit 4e54fec
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Processor/FilterProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@ public function process($src, OperationInterface $operation)
$value = $operation->getValue();
$operator = $operation->getOperator();
$field = $operation->getField();
if($operator == FilterOperation::STR_STARTS_WITH){
$operator = FilterOperation::OPERATOR_LIKE;
$value = $value."%";
}else if($operator == FilterOperation::STR_ENDS_WITH){
$operator = FilterOperation::OPERATOR_LIKE;
$value = "%".$value;
}else if($operator == FilterOperation::STR_CONTAINS){
$operator = FilterOperation::OPERATOR_LIKE;
$value = "%".$value."%";
switch ($operator) {
case FilterOperation::OPERATOR_STR_STARTS_WITH:
$operator = FilterOperation::OPERATOR_LIKE;
$value .= '%';
break;
case FilterOperation::OPERATOR_STR_ENDS_WITH:
$operator = FilterOperation::OPERATOR_LIKE;
$value = '%' . $value;
break;
case FilterOperation::OPERATOR_STR_CONTAINS:
$operator = FilterOperation::OPERATOR_LIKE;
$value = '%' . $value . '%';
break;
}
$src->where($field, $operator, $value);
return $src;
Expand Down

0 comments on commit 4e54fec

Please sign in to comment.