From 80ddb0a4a936611c84eaf657d36e893ced5d6dd7 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Mon, 8 Jun 2009 10:48:35 -0400 Subject: [PATCH] add Horde_Support_Stack --- framework/Support/lib/Horde/Support/Stack.php | 48 +++++++++++++++++++++++++++ framework/Support/package.xml | 3 ++ 2 files changed, 51 insertions(+) create mode 100644 framework/Support/lib/Horde/Support/Stack.php diff --git a/framework/Support/lib/Horde/Support/Stack.php b/framework/Support/lib/Horde/Support/Stack.php new file mode 100644 index 000000000..30499f748 --- /dev/null +++ b/framework/Support/lib/Horde/Support/Stack.php @@ -0,0 +1,48 @@ +_a = $stack; + } + + public function push($value) + { + $this->_stack[] = $value; + } + + public function pop() + { + return array_pop($this->_stack); + } + + public function peek($offset = 1) + { + if (isset($this->_stack[count($this->_stack) - $offset])) { + return $this->_stack[count($this->_stack) - $offset]; + } else { + return null; + } + } + +} diff --git a/framework/Support/package.xml b/framework/Support/package.xml index 470adccd3..d88274013 100644 --- a/framework/Support/package.xml +++ b/framework/Support/package.xml @@ -29,6 +29,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> * Initial Horde_Support_Array object * Initial Horde_Support_ConsistentHash object * Initial Horde_Support_Inflector object + * Initial Horde_Support_Stack object * Initial Horde_Support_Stub object * Initial Horde_Support_Timer object * Initial Horde_Support_Uuid object @@ -49,6 +50,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -75,6 +77,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + -- 2.11.0