1: <?php
2:
3: /*
4: * This file is part of SwiftMailer.
5: * (c) 2004-2009 Chris Corbyn
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: /**
12: * A base Event which all Event classes inherit from.
13: *
14: * @package Swift
15: * @subpackage Events
16: * @author Chris Corbyn
17: */
18: class Swift_Events_EventObject implements Swift_Events_Event
19: {
20: /** The source of this Event */
21: private $_source;
22:
23: /** The state of this Event (should it bubble up the stack?) */
24: private $_bubbleCancelled = false;
25:
26: /**
27: * Create a new EventObject originating at $source.
28: * @param object $source
29: */
30: public function __construct($source)
31: {
32: $this->_source = $source;
33: }
34:
35: /**
36: * Get the source object of this event.
37: * @return object
38: */
39: public function getSource()
40: {
41: return $this->_source;
42: }
43:
44: /**
45: * Prevent this Event from bubbling any further up the stack.
46: * @param boolean $cancel, optional
47: */
48: public function cancelBubble($cancel = true)
49: {
50: $this->_bubbleCancelled = $cancel;
51: }
52:
53: /**
54: * Returns true if this Event will not bubble any further up the stack.
55: * @return boolean
56: */
57: public function bubbleCancelled()
58: {
59: return $this->_bubbleCancelled;
60: }
61: }
62: