Hide filters

This commit is contained in:
Oliver Davies 2017-12-30 13:42:23 +00:00
parent b2eefdb7ab
commit 761eba6203
2 changed files with 11 additions and 11 deletions

View file

@ -14,12 +14,17 @@ class Builder
$this->filters = $filters;
}
public function __toString()
{
return $this->build();
}
/**
* Build XML for a set of filters.
*
* @return string
*/
public function build()
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'>";
$suffix = '</feed>';
@ -32,15 +37,15 @@ class Builder
}
/**
* Build XML for an entry.
* Build XML for an filter.
*
* @param array $items
* @param Filter $filter
*
* @return string
*/
private function buildEntry(array $items)
private function buildEntry(Filter $filter)
{
$entry = collect($items)->map(function ($value, $key) {
$entry = collect($filter->getProperties())->map(function ($value, $key) {
return $this->buildProperty($value, $key);
})->implode('');

View file

@ -18,12 +18,7 @@ class BuilderTest extends TestCase
->star()
->important();
$builder = new Builder([
$filterA->getProperties(),
$filterB->getProperties(),
]);
$result = $builder->build();
$result = new Builder([$filterA, $filterB]);
$expected = "<?xml version='1.0' encoding='UTF-8'?>";
$expected .= "<feed xmlns='http://www.w3.org/2005/Atom' xmlns:apps='http://schemas.google.com/apps/2006'>";