mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-01-22 12:07:32 +00:00
Allow for passing multiple lists
This commit is contained in:
parent
035f4fb6c7
commit
0b225663e0
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue