@@ 320-322 (lines=3) @@ | ||
317 | } |
|
318 | // Unary operators need a single value. |
|
319 | else if (!empty($operator) && $this->isUnaryOperator($operator)) { |
|
320 | if (empty($value) || count($value) > 1) { |
|
321 | throw new Error(sprintf("Unary operators must be associated with a single value (field '%s').", $field)); |
|
322 | } |
|
323 | ||
324 | // Pick the first item from the values. |
|
325 | $value = reset($value); |
|
@@ 329-331 (lines=3) @@ | ||
326 | } |
|
327 | // Range operators need exactly two values. |
|
328 | else if (!empty($operator) && $this->isRangeOperator($operator)) { |
|
329 | if (empty($value) || count($value) !== 2) { |
|
330 | throw new Error(sprintf("Range operators must require exactly two values (field '%s').", $field)); |
|
331 | } |
|
332 | } |
|
333 | // Null operators can't have a value set. |
|
334 | else if (!empty($operator) && $this->isNullOperator($operator)) { |