equal
deleted
inserted
replaced
|
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 /** |
|
13 * A base Event which all Event classes inherit from. |
|
14 * |
|
15 * @package Swift |
|
16 * @subpackage Events |
|
17 * @author Chris Corbyn |
|
18 */ |
|
19 class Swift_Events_EventObject implements Swift_Events_Event |
|
20 { |
|
21 |
|
22 /** The source of this Event */ |
|
23 private $_source; |
|
24 |
|
25 /** The state of this Event (should it bubble up the stack?) */ |
|
26 private $_bubbleCancelled = false; |
|
27 |
|
28 /** |
|
29 * Create a new EventObject originating at $source. |
|
30 * @param object $source |
|
31 */ |
|
32 public function __construct($source) |
|
33 { |
|
34 $this->_source = $source; |
|
35 } |
|
36 |
|
37 /** |
|
38 * Get the source object of this event. |
|
39 * @return object |
|
40 */ |
|
41 public function getSource() |
|
42 { |
|
43 return $this->_source; |
|
44 } |
|
45 |
|
46 /** |
|
47 * Prevent this Event from bubbling any further up the stack. |
|
48 * @param boolean $cancel, optional |
|
49 */ |
|
50 public function cancelBubble($cancel = true) |
|
51 { |
|
52 $this->_bubbleCancelled = $cancel; |
|
53 } |
|
54 |
|
55 /** |
|
56 * Returns true if this Event will not bubble any further up the stack. |
|
57 * @return boolean |
|
58 */ |
|
59 public function bubbleCancelled() |
|
60 { |
|
61 return $this->_bubbleCancelled; |
|
62 } |
|
63 |
|
64 } |