TYPO3 API  SVNRelease
EventObject.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/Events/Event.php';
00012 
00013 /**
00014  * A base Event which all Event classes inherit from.
00015  *
00016  * @package Swift
00017  * @subpackage Events
00018  * @author Chris Corbyn
00019  */
00020 class Swift_Events_EventObject implements Swift_Events_Event
00021 {
00022 
00023   /** The source of this Event */
00024   private $_source;
00025 
00026   /** The state of this Event (should it bubble up the stack?) */
00027   private $_bubbleCancelled = false;
00028 
00029   /**
00030    * Create a new EventObject originating at $source.
00031    * @param object $source
00032    */
00033   public function __construct($source)
00034   {
00035     $this->_source = $source;
00036   }
00037 
00038   /**
00039    * Get the source object of this event.
00040    * @return object
00041    */
00042   public function getSource()
00043   {
00044     return $this->_source;
00045   }
00046 
00047   /**
00048    * Prevent this Event from bubbling any further up the stack.
00049    * @param boolean $cancel, optional
00050    */
00051   public function cancelBubble($cancel = true)
00052   {
00053     $this->_bubbleCancelled = $cancel;
00054   }
00055 
00056   /**
00057    * Returns true if this Event will not bubble any further up the stack.
00058    * @return boolean
00059    */
00060   public function bubbleCancelled()
00061   {
00062     return $this->_bubbleCancelled;
00063   }
00064 
00065 }