|
@@ -74,7 +74,7 @@ discard block |
|
|
block discarded – undo |
|
74
|
74
|
*/ |
|
75
|
75
|
public function shouldJoinTags(ISearchOperator $operator) { |
|
76
|
76
|
if ($operator instanceof ISearchBinaryOperator) { |
|
77
|
|
- return array_reduce($operator->getArguments(), function ($shouldJoin, ISearchOperator $operator) { |
|
|
77
|
+ return array_reduce($operator->getArguments(), function($shouldJoin, ISearchOperator $operator) { |
|
78
|
78
|
return $shouldJoin || $this->shouldJoinTags($operator); |
|
79
|
79
|
}, false); |
|
80
|
80
|
} else if ($operator instanceof ISearchComparison) { |
|
@@ -88,7 +88,7 @@ discard block |
|
|
block discarded – undo |
|
88
|
88
|
* @param ISearchOperator $operator |
|
89
|
89
|
*/ |
|
90
|
90
|
public function searchOperatorArrayToDBExprArray(IQueryBuilder $builder, array $operators) { |
|
91
|
|
- return array_map(function ($operator) use ($builder) { |
|
|
91
|
+ return array_map(function($operator) use ($builder) { |
|
92
|
92
|
return $this->searchOperatorToDBExpr($builder, $operator); |
|
93
|
93
|
}, $operators); |
|
94
|
94
|
} |
|
@@ -109,12 +109,12 @@ discard block |
|
|
block discarded – undo |
|
109
|
109
|
case ISearchBinaryOperator::OPERATOR_OR: |
|
110
|
110
|
return call_user_func_array([$expr, 'orX'], $this->searchOperatorArrayToDBExprArray($builder, $operator->getArguments())); |
|
111
|
111
|
default: |
|
112
|
|
- throw new \InvalidArgumentException('Invalid operator type: ' . $operator->getType()); |
|
|
112
|
+ throw new \InvalidArgumentException('Invalid operator type: '.$operator->getType()); |
|
113
|
113
|
} |
|
114
|
114
|
} else if ($operator instanceof ISearchComparison) { |
|
115
|
115
|
return $this->searchComparisonToDBExpr($builder, $operator, self::$searchOperatorMap); |
|
116
|
116
|
} else { |
|
117
|
|
- throw new \InvalidArgumentException('Invalid operator type: ' . get_class($operator)); |
|
|
117
|
+ throw new \InvalidArgumentException('Invalid operator type: '.get_class($operator)); |
|
118
|
118
|
} |
|
119
|
119
|
} |
|
120
|
120
|
|
|
@@ -126,7 +126,7 @@ discard block |
|
|
block discarded – undo |
|
126
|
126
|
$queryOperator = $operatorMap[$type]; |
|
127
|
127
|
return $builder->expr()->$queryOperator($field, $this->getParameterForValue($builder, $value)); |
|
128
|
128
|
} else { |
|
129
|
|
- throw new \InvalidArgumentException('Invalid operator type: ' . $comparison->getType()); |
|
|
129
|
+ throw new \InvalidArgumentException('Invalid operator type: '.$comparison->getType()); |
|
130
|
130
|
} |
|
131
|
131
|
} |
|
132
|
132
|
|
|
@@ -145,7 +145,7 @@ discard block |
|
|
block discarded – undo |
|
145
|
145
|
$type = ISearchComparison::COMPARE_EQUAL; |
|
146
|
146
|
} |
|
147
|
147
|
if (strpos($value, '%') !== false) { |
|
148
|
|
- throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); |
|
|
148
|
+ throw new \InvalidArgumentException('Unsupported query value for mimetype: '.$value.', only values in the format "mime/type" or "mime/%" are supported'); |
|
149
|
149
|
} |
|
150
|
150
|
} |
|
151
|
151
|
} else if ($field === 'favorite') { |
|
@@ -178,14 +178,14 @@ discard block |
|
|
block discarded – undo |
|
178
|
178
|
]; |
|
179
|
179
|
|
|
180
|
180
|
if (!isset($types[$operator->getField()])) { |
|
181
|
|
- throw new \InvalidArgumentException('Unsupported comparison field ' . $operator->getField()); |
|
|
181
|
+ throw new \InvalidArgumentException('Unsupported comparison field '.$operator->getField()); |
|
182
|
182
|
} |
|
183
|
183
|
$type = $types[$operator->getField()]; |
|
184
|
184
|
if (gettype($operator->getValue()) !== $type) { |
|
185
|
|
- throw new \InvalidArgumentException('Invalid type for field ' . $operator->getField()); |
|
|
185
|
+ throw new \InvalidArgumentException('Invalid type for field '.$operator->getField()); |
|
186
|
186
|
} |
|
187
|
187
|
if (!in_array($operator->getType(), $comparisons[$operator->getField()])) { |
|
188
|
|
- throw new \InvalidArgumentException('Unsupported comparison for field ' . $operator->getField() . ': ' . $operator->getType()); |
|
|
188
|
+ throw new \InvalidArgumentException('Unsupported comparison for field '.$operator->getField().': '.$operator->getType()); |
|
189
|
189
|
} |
|
190
|
190
|
} |
|
191
|
191
|
|