Skip to content

Commit 170ec2c

Browse files
Allow 'ContainsOp' to operate on arrays. Allow value for filter default field to contain spaces.
1 parent dbb4b8a commit 170ec2c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/OperatorFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function splitOnOperator($expression, $defaultField = false)
8383
{
8484
// If there is a default field, then any expression that is missing
8585
// an operator will be interpreted as "default field contains value".
86-
if (preg_match('#^[a-zA-Z0-9_.:-]+$#', $expression) && ($defaultField !== false)) {
86+
if (preg_match('#^[a-zA-Z0-9 _.:-]+$#', $expression) && ($defaultField !== false)) {
8787
return [$defaultField, '*=', $expression];
8888
}
8989
if (!preg_match('#([^!~*=]*)(!?~?\*?=)(.*)#', $expression, $matches)) {

src/Operators/ContainsOp.php

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ public function __construct($key, $comparitor)
2727
public function test(Data $row)
2828
{
2929
$value = $row->get($this->key);
30+
if (is_array($value)) {
31+
return in_array($this->comparitor, $value);
32+
}
3033
return strpos($value, $this->comparitor) !== false;
3134
}
3235

0 commit comments

Comments
 (0)