1
|
<?php
|
2
|
|
3
|
/*
|
4
|
* This file is part of the Symfony package.
|
5
|
*
|
6
|
* (c) Fabien Potencier <fabien@symfony.com>
|
7
|
*
|
8
|
* For the full copyright and license information, please view the LICENSE
|
9
|
* file that was distributed with this source code.
|
10
|
*/
|
11
|
|
12
|
namespace Symfony\Component\EventDispatcher;
|
13
|
|
14
|
/**
|
15
|
* Event is the base class for classes containing event data.
|
16
|
*
|
17
|
* This class contains no event data. It is used by events that do not pass
|
18
|
* state information to an event handler when an event is raised.
|
19
|
*
|
20
|
* You can call the method stopPropagation() to abort the execution of
|
21
|
* further listeners in your event listener.
|
22
|
*
|
23
|
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
24
|
* @author Jonathan Wage <jonwage@gmail.com>
|
25
|
* @author Roman Borschel <roman@code-factory.org>
|
26
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
27
|
*/
|
28
|
class Event
|
29
|
{
|
30
|
/**
|
31
|
* @var bool Whether no further event listeners should be triggered
|
32
|
*/
|
33
|
private $propagationStopped = false;
|
34
|
|
35
|
/**
|
36
|
* Returns whether further event listeners should be triggered.
|
37
|
*
|
38
|
* @see Event::stopPropagation()
|
39
|
*
|
40
|
* @return bool Whether propagation was already stopped for this event
|
41
|
*/
|
42
|
public function isPropagationStopped()
|
43
|
{
|
44
|
return $this->propagationStopped;
|
45
|
}
|
46
|
|
47
|
/**
|
48
|
* Stops the propagation of the event to further event listeners.
|
49
|
*
|
50
|
* If multiple event listeners are connected to the same event, no
|
51
|
* further event listener will be triggered once any trigger calls
|
52
|
* stopPropagation().
|
53
|
*/
|
54
|
public function stopPropagation()
|
55
|
{
|
56
|
$this->propagationStopped = true;
|
57
|
}
|
58
|
}
|