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