changed git call from https to git readonly
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / EventStack.inc
1 <?php\r
2 /**\r
3  * An Event Stack for inter-program communication, particularly for parsing\r
4  *\r
5  * phpDocumentor :: automatic documentation generator\r
6  * \r
7  * PHP versions 4 and 5\r
8  *\r
9  * Copyright (c) 2000-2007 Joshua Eichorn\r
10  * \r
11  * LICENSE:\r
12  * \r
13  * This library is free software; you can redistribute it\r
14  * and/or modify it under the terms of the GNU Lesser General\r
15  * Public License as published by the Free Software Foundation;\r
16  * either version 2.1 of the License, or (at your option) any\r
17  * later version.\r
18  * \r
19  * This library is distributed in the hope that it will be useful,\r
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
22  * Lesser General Public License for more details.\r
23  * \r
24  * You should have received a copy of the GNU Lesser General Public\r
25  * License along with this library; if not, write to the Free Software\r
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
27  *\r
28  * @category  ToolsAndUtilities\r
29  * @package   phpDocumentor\r
30  * @author    Joshua Eichorn <jeichorn@phpdoc.org>\r
31  * @copyright 2000-2007 Joshua Eichorn\r
32  * @license   http://www.opensource.org/licenses/lgpl-license.php LGPL\r
33  * @version   CVS: $Id: EventStack.inc,v 1.4 2007/10/10 02:27:28 ashnazg Exp $\r
34  * @filesource\r
35  * @link      http://www.phpdoc.org\r
36  * @link      http://pear.php.net/PhpDocumentor\r
37  * @since     0.1\r
38  * @todo      CS cleanup - change package to PhpDocumentor\r
39  */\r
40 /**\r
41  * An event Stack\r
42  * \r
43  * @category ToolsAndUtilities\r
44  * @package  phpDocumentor\r
45  * @author   Joshua Eichorn <jeichorn@phpdoc.org>\r
46  * @license  http://www.opensource.org/licenses/lgpl-license.php LGPL\r
47  * @version  Release: 1.4.1\r
48  * @link     http://www.phpdoc.org\r
49  * @link     http://pear.php.net/PhpDocumentor\r
50  * @todo     CS cleanup - change package to PhpDocumentor\r
51  */\r
52 class EventStack\r
53 {\r
54     /**\r
55      * The stack\r
56      * @var array\r
57      */\r
58     var $stack = array(PARSER_EVENT_NOEVENTS);\r
59 \r
60     /**\r
61      * The number of events in the stack\r
62      * @var integer\r
63      */\r
64     var $num = 0;\r
65 \r
66     /**\r
67      * Push an event onto the stack\r
68      *\r
69      * @param int $event All events must be constants\r
70      *\r
71      * @return void\r
72      */\r
73     function pushEvent($event)\r
74     {\r
75         $this->num = array_push($this->stack, $event) - 1;\r
76     }\r
77 \r
78     /**\r
79      * Pop an event from the stack\r
80      *\r
81      * @return int An event\r
82      */\r
83     function popEvent()\r
84     {\r
85         $this->num--;\r
86         return array_pop($this->stack);\r
87     }\r
88 \r
89     /**\r
90      * Get the current event\r
91      *\r
92      * @return int An event\r
93      */\r
94     function getEvent()\r
95     {\r
96         return $this->stack[$this->num];\r
97     }\r
98 }\r