mirror of
https://github.com/opdavies/gmail-filter-builder.git
synced 2025-02-02 08:57:31 +00:00
More new lines
This commit is contained in:
parent
37835fa7c8
commit
b61178b9b0
|
@ -26,7 +26,7 @@ class Builder
|
|||
*/
|
||||
private function build()
|
||||
{
|
||||
$prefix = "<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>";
|
||||
$prefix = "<?xml version='1.0' encoding='UTF-8'?>" . PHP_EOL . "<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>";
|
||||
$suffix = '</feed>';
|
||||
|
||||
$xml = collect($this->filters)->map(function ($items) {
|
||||
|
@ -47,9 +47,9 @@ class Builder
|
|||
{
|
||||
$entry = collect($filter->getProperties())->map(function ($value, $key) {
|
||||
return $this->buildProperty($value, $key);
|
||||
})->implode('');
|
||||
})->implode(PHP_EOL);
|
||||
|
||||
return "<entry>{$entry}</entry>";
|
||||
return collect(['<entry>', $entry, '</entry>'])->implode(PHP_EOL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,9 +21,18 @@ class BuilderTest extends TestCase
|
|||
$result = new Builder([$filterA, $filterB]);
|
||||
|
||||
$expected = <<<EOF
|
||||
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
|
||||
<entry><apps:property name='from' value='(foo@example.com|test@example.com)'/><apps:property name='label' value='Some label'/><apps:property name='shouldArchive' value='true'/></entry>
|
||||
<entry><apps:property name='hasTheWord' value='from:bar@example.com'/><apps:property name='shouldStar' value='true'/><apps:property name='shouldAlwaysMarkAsImportant' value='true'/></entry>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>
|
||||
<entry>
|
||||
<apps:property name='from' value='(foo@example.com|test@example.com)'/>
|
||||
<apps:property name='label' value='Some label'/>
|
||||
<apps:property name='shouldArchive' value='true'/>
|
||||
</entry>
|
||||
<entry>
|
||||
<apps:property name='hasTheWord' value='from:bar@example.com'/>
|
||||
<apps:property name='shouldStar' value='true'/>
|
||||
<apps:property name='shouldAlwaysMarkAsImportant' value='true'/>
|
||||
</entry>
|
||||
</feed>
|
||||
EOF;
|
||||
|
||||
|
|
Loading…
Reference in a new issue