PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/swift/lib/classes/Swift/Events/EventObject.php

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