2010-01-04 14:26:20 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2011-08-21 13:32:21 +01:00
|
|
|
* This file is part of the Symfony package.
|
2010-04-07 02:07:59 +01:00
|
|
|
*
|
2011-08-21 13:32:21 +01:00
|
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
2010-01-04 14:26:20 +00:00
|
|
|
*/
|
|
|
|
|
2011-01-15 13:29:43 +00:00
|
|
|
namespace Symfony\Component\EventDispatcher;
|
|
|
|
|
2010-01-04 14:26:20 +00:00
|
|
|
/**
|
2011-03-13 18:03:18 +00:00
|
|
|
* Event is the base class for classes containing event data.
|
2010-01-04 14:26:20 +00:00
|
|
|
*
|
2011-03-13 18:03:18 +00:00
|
|
|
* This class contains no event data. It is used by events that do not pass
|
|
|
|
* state information to an event handler when an event is raised.
|
|
|
|
*
|
|
|
|
* You can call the method stopPropagation() to abort the execution of
|
|
|
|
* further listeners in your event listener.
|
|
|
|
*
|
2014-12-07 17:02:39 +00:00
|
|
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
|
|
|
* @author Jonathan Wage <jonwage@gmail.com>
|
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
|
|
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
2010-01-04 14:26:20 +00:00
|
|
|
*/
|
2011-03-13 18:03:18 +00:00
|
|
|
class Event
|
2010-01-04 14:26:20 +00:00
|
|
|
{
|
2010-05-06 12:25:53 +01:00
|
|
|
/**
|
2014-12-20 17:15:52 +00:00
|
|
|
* @var bool Whether no further event listeners should be triggered
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-03-13 18:03:18 +00:00
|
|
|
private $propagationStopped = false;
|
2010-05-06 12:25:53 +01:00
|
|
|
|
|
|
|
/**
|
2011-03-13 18:03:18 +00:00
|
|
|
* Returns whether further event listeners should be triggered.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2014-12-21 16:36:15 +00:00
|
|
|
* @see Event::stopPropagation()
|
2014-12-21 17:00:50 +00:00
|
|
|
*
|
2016-06-28 06:50:50 +01:00
|
|
|
* @return bool Whether propagation was already stopped for this event
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-03-13 18:03:18 +00:00
|
|
|
public function isPropagationStopped()
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2011-03-13 18:03:18 +00:00
|
|
|
return $this->propagationStopped;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-03-13 18:03:18 +00:00
|
|
|
* Stops the propagation of the event to further event listeners.
|
2010-05-06 12:25:53 +01:00
|
|
|
*
|
2011-03-13 18:03:18 +00:00
|
|
|
* If multiple event listeners are connected to the same event, no
|
|
|
|
* further event listener will be triggered once any trigger calls
|
|
|
|
* stopPropagation().
|
2010-05-06 12:25:53 +01:00
|
|
|
*/
|
2011-03-13 18:03:18 +00:00
|
|
|
public function stopPropagation()
|
2010-05-06 12:25:53 +01:00
|
|
|
{
|
2011-03-13 18:03:18 +00:00
|
|
|
$this->propagationStopped = true;
|
2010-05-06 12:25:53 +01:00
|
|
|
}
|
2010-01-04 14:26:20 +00:00
|
|
|
}
|