diff --git a/src/Builder.php b/src/Builder.php index 007323a..fa1f0cb 100644 --- a/src/Builder.php +++ b/src/Builder.php @@ -63,7 +63,7 @@ class Builder private function buildProperty($value, $key) { if (collect(['from', 'to'])->contains($key)) { - $value = collect($value)->implode('|'); + $value = $this->implode($value); } return vsprintf("", [ @@ -71,4 +71,12 @@ class Builder htmlentities($value), ]); } + + /** + * Implode values with the appropriate prefix, suffix and separator. + */ + private function implode($value, $separator = '|') + { + return sprintf('(%s)', collect($value)->implode($separator)); + } } diff --git a/tests/Unit/BuilderTest.php b/tests/Unit/BuilderTest.php index a5f6029..a8c4b40 100644 --- a/tests/Unit/BuilderTest.php +++ b/tests/Unit/BuilderTest.php @@ -22,7 +22,7 @@ class BuilderTest extends TestCase $expected = << - + EOF;