Skip to content

Commit 2db359a

Browse files
committed
Xml::appendText(): $text variadic; return $this
1 parent 5681a9a commit 2db359a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/Xml.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@ public function append(string $name = null, ...$content): self
9797
/**
9898
* Appends a text line.
9999
*/
100-
public function appendText(string $text): self
100+
public function appendText(string ...$text): self
101101
{
102-
return $this->append(null, $text);
102+
$this->append(null, ...$text);
103+
return $this;
103104
}
104105

105106
/**

tests/XmlTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,13 @@ function() {
7676
[
7777
Tml::cs()
7878
->append('e')->getParent()
79-
->comment('comment')->getParent()
79+
->comment('comment')
8080
->append('f', 'content 1')->appendText('content 2'),
8181
"<e/>\n<!-- comment -->\n<f>\n\tcontent 1\n\tcontent 2\n</f>"
8282
],
8383
[Tml::cs()->append('e', '')->appendText('content'), "<e>\n\tcontent\n</e>"],
8484
[Tml::cs('e')->appendText('one')->appendText('two'), "<e>\n\tone\n\ttwo\n</e>"],
85+
[Tml::cs('e')->appendText('one', 'two'), "<e>\n\tone\n\ttwo\n</e>"],
8586
[
8687
function() {
8788
$xml = TML::cs('section')->append('div');

0 commit comments

Comments
 (0)