Skip to content

Commit c7b4711

Browse files
author
Halleck45
committed
way to replace token in collection
1 parent 52a2e79 commit c7b4711

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Hal/Component/Token/TokenCollection.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,16 @@ public function count() {
131131
public function asArray() {
132132
return $this->tokens;
133133
}
134+
135+
/**
136+
* Replace token with another
137+
*
138+
* @param $index
139+
* @param Token $token
140+
* @return $this
141+
*/
142+
public function replace($index, Token $token) {
143+
$this->tokens[$index] = $token;
144+
return $this;
145+
}
134146
}

0 commit comments

Comments
 (0)