1: <?php
2: /**
3: * From Binary XML Content Format Specification Version 1.3, 25 July 2001
4: * found at http://www.wapforum.org
5: *
6: * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (LGPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10: *
11: * @author Anthony Mills <amills@pyramid6.com>
12: * @package Xml_Wbxml
13: */
14: class Horde_Xml_Wbxml_LifoQueue
15: {
16: protected $_queue = array();
17:
18: public function push($obj)
19: {
20: $this->_queue[] = $obj;
21: }
22:
23: public function pop()
24: {
25: if (count($this->_queue)) {
26: return array_pop($this->_queue);
27: } else {
28: return null;
29: }
30: }
31:
32: public function top()
33: {
34: if ($count = count($this->_queue)) {
35: return $this->_queue[$count - 1];
36: } else {
37: return null;
38: }
39: }
40: }
41: