From 761eba6203bd6e62037cacd1c6de142955becb8c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 30 Dec 2017 13:42:23 +0000 Subject: [PATCH] Hide filters --- src/Builder.php | 15 ++++++++++----- tests/Unit/BuilderTest.php | 7 +------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Builder.php b/src/Builder.php index 94a0802..b2ff8f3 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -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 = ""; $suffix = ''; @@ -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(''); diff --git a/tests/Unit/BuilderTest.php b/tests/Unit/BuilderTest.php index be05063..40cac6c 100644 --- a/tests/Unit/BuilderTest.php +++ b/tests/Unit/BuilderTest.php @@ -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 = ""; $expected .= "";