3 * a class for handling the publishing of data
\r
5 * phpDocumentor :: automatic documentation generator
\r
7 * PHP versions 4 and 5
\r
9 * Copyright (c) 2000-2007 Kellin, Joshua Eichorn
\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
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
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
28 * @category ToolsAndUtilities
\r
29 * @package phpDocumentor
\r
30 * @author Kellin <passionplay@hotmail.com>
\r
31 * @author Joshua Eichorn <jeichorn@phpdoc.org>
\r
32 * @copyright 2000-2007 Kellin, Joshua Eichorn
\r
33 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
\r
34 * @version CVS: $Id: Publisher.inc,v 1.4 2007/10/11 03:30:34 ashnazg Exp $
\r
35 * @link http://www.phpdoc.org
\r
36 * @link http://pear.php.net/PhpDocumentor
\r
38 * @todo CS cleanup - change package to PhpDocumentor
\r
41 * a class for handling the publishing of data
\r
43 * @category ToolsAndUtilities
\r
44 * @package phpDocumentor
\r
45 * @author Kellin <passionplay@hotmail.com>
\r
46 * @author Joshua Eichorn <jeichorn@phpdoc.org>
\r
47 * @copyright 2000-2007 Kellin, Joshua Eichorn
\r
48 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
\r
49 * @version Release: 1.4.1
\r
50 * @link http://www.phpdoc.org
\r
51 * @link http://pear.php.net/PhpDocumentor
\r
52 * @todo CS cleanup - change package to PhpDocumentor
\r
60 * Array of references objects that have Subscribed to this publisher
\r
62 var $subscriber = array();
\r
64 var $tokens = array();
\r
66 var $pushEvent = array();
\r
67 var $popEvent = array();
\r
72 * Adds a subscriber to the {@link $subscriber} array().
\r
73 * if $event is '*', the publisher will use $object as the default event handler
\r
75 * @param integer $event see {@link Parser.inc} PARSER_EVENT_* constants
\r
76 * @param class &$object any class that has a HandleEvent() method like
\r
77 * {@link phpDocumentor_IntermediateParser::HandleEvent()}
\r
78 * or {@link Classes::HandleEvent()}
\r
81 * @todo CS Cleanup - there's no way I can get the &$object desc under 85 chars
\r
83 function subscribe($event, &$object)
\r
85 $this->subscriber[$event] =& $object;
\r
91 * @param integer $event see {@link Parser.inc} PARSER_EVENT_* constants
\r
92 * @param mixed $data anything the subscribed event handler is expecting
\r
96 function publishEvent($event,$data)
\r
99 // see if there is a specific event handler
\r
100 if (!empty($this->subscriber[$event])) {
\r
101 $this->subscriber[$event]->HandleEvent($event, $data);
\r
102 } else if (isset($this->subscriber['*'])
\r
103 && is_object($this->subscriber['*'])) {
\r
104 // check to see if a generic handler exists
\r
106 $this->subscriber['*']->HandleEvent($event, $data);
\r