diff --git a/src/Model/Filter.php b/src/Model/Filter.php index 86a2640..dd6686c 100644 --- a/src/Model/Filter.php +++ b/src/Model/Filter.php @@ -4,6 +4,9 @@ namespace Opdavies\GmailFilterBuilder\Model; class Filter { + /** @var string */ + const SEPARATOR = '|'; + /** * @var array */ @@ -100,12 +103,13 @@ class Filter /** * Filter a message if it was sent from a mailing list. * - * @param $value The mailing list address + * @param string|array $value The mailing list address * * @return $this */ public function fromList($value) { + $value = collect($value)->implode(self::SEPARATOR); $this->has("list:{$value}"); return $this; diff --git a/tests/Unit/Model/FilterTest.php b/tests/Unit/Model/FilterTest.php index 8de48fc..e7063f0 100644 --- a/tests/Unit/Model/FilterTest.php +++ b/tests/Unit/Model/FilterTest.php @@ -143,6 +143,11 @@ class FilterTest extends TestCase ['hasTheWord' => 'list:foobar'], $this->filter->fromList('foobar')->toArray() ); + + $this->assertEquals( + ['hasTheWord' => 'list:list-one.com|list-two.com'], + $this->filter->fromList(['list-one.com', 'list-two.com'])->toArray() + ); } /**