mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-03-13 05:26:57 +00:00
Change to and from to use strings or arrays
This commit is contained in:
parent
02dddbdaf6
commit
9097da2972
|
@ -20,21 +20,21 @@ class Filter
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function from()
|
||||
public function from($values)
|
||||
{
|
||||
$this->properties['from'] = collect(func_get_args())
|
||||
->map(function ($address) {
|
||||
return trim($address);
|
||||
$this->properties['from'] = collect($values)
|
||||
->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function to()
|
||||
public function to($values)
|
||||
{
|
||||
$this->properties['to'] = collect(func_get_args())
|
||||
->map(function ($address) {
|
||||
return trim($address);
|
||||
$this->properties['to'] = collect($values)
|
||||
->map(function ($value) {
|
||||
return trim($value);
|
||||
})->all();
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -9,7 +9,7 @@ class BuilderTest extends TestCase
|
|||
public function testBuild()
|
||||
{
|
||||
$filterA = (new Filter())
|
||||
->from('foo@example.com', 'test@example.com')
|
||||
->from(['foo@example.com', 'test@example.com'])
|
||||
->label('Some label')
|
||||
->archive();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class FilterTest extends TestCase
|
|||
// Ensure that we can set multiple from addresses.
|
||||
$this->assertEquals(
|
||||
['from' => ['foo@example.com', 'bar@example.com']],
|
||||
$this->filter->from('foo@example.com', 'bar@example.com')
|
||||
$this->filter->from(['foo@example.com', 'bar@example.com'])
|
||||
->getProperties()
|
||||
);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class FilterTest extends TestCase
|
|||
|
||||
$this->assertEquals(
|
||||
['to' => ['bar@example.com', 'baz@example.com']],
|
||||
$this->filter->to('bar@example.com', 'baz@example.com')
|
||||
$this->filter->to(['bar@example.com', 'baz@example.com'])
|
||||
->getProperties()
|
||||
);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ class FilterTest extends TestCase
|
|||
'shouldStar' => 'true',
|
||||
'shouldAlwaysMarkAsImportant' => 'true',
|
||||
],
|
||||
$this->filter->from('foo@example.com ', 'bar@example.com')
|
||||
$this->filter->from(['foo@example.com ', 'bar@example.com'])
|
||||
->has('Something')
|
||||
->excludeChats()
|
||||
->labelAndArchive('Foo')
|
||||
|
|
Loading…
Reference in a new issue