Skip to content

Commit 65f1512

Browse files
committed
Returning elements of stack
1 parent cc55bb6 commit 65f1512

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/TgUtils/Stack.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,11 @@ public function peek() {
3939
}
4040
return NULL;
4141
}
42+
43+
/** Returns the stack elements with top element first */
44+
public function elements($reverse = FALSE) {
45+
return $reverse ? array_reverse($this->stack) : $this->stack;
46+
}
47+
4248
}
4349

0 commit comments

Comments
 (0)