Skip to content

Commit 0455f37

Browse files
committed
feat: add new method for str buffer
1 parent 4a86d51 commit 0455f37

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Str/StrBuffer.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ public function reset(): void
111111
}
112112

113113
/**
114-
* clear data
114+
* Get and clear data
115+
*
116+
* @return string
115117
*/
116-
public function clear(): string
118+
public function getAndClear(): string
117119
{
118120
$strings = $this->parts;
119121
// clear
@@ -122,6 +124,14 @@ public function clear(): string
122124
return implode($strings);
123125
}
124126

127+
/**
128+
* clear data
129+
*/
130+
public function clear(): string
131+
{
132+
return $this->getAndClear();
133+
}
134+
125135
/**
126136
* @return string[]
127137
*/

0 commit comments

Comments
 (0)