Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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