|
0
|
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 |
* @link www.doctrine-project.org |
|
|
24 |
* @since 2.0 |
|
|
25 |
* @version $Revision: 3938 $ |
|
|
26 |
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> |
|
|
27 |
* @author Jonathan Wage <jonwage@gmail.com> |
|
|
28 |
* @author Roman Borschel <roman@code-factory.org> |
|
|
29 |
* @author Bernhard Schussek <bschussek@gmail.com> |
|
|
30 |
* |
|
|
31 |
* @api |
|
|
32 |
*/ |
|
|
33 |
class Event |
|
|
34 |
{ |
|
|
35 |
/** |
|
|
36 |
* @var Boolean Whether no further event listeners should be triggered |
|
|
37 |
*/ |
|
|
38 |
private $propagationStopped = false; |
|
|
39 |
|
|
|
40 |
/** |
|
|
41 |
* Returns whether further event listeners should be triggered. |
|
|
42 |
* |
|
|
43 |
* @see Event::stopPropagation |
|
|
44 |
* @return Boolean Whether propagation was already stopped for this event. |
|
|
45 |
* |
|
|
46 |
* @api |
|
|
47 |
*/ |
|
|
48 |
public function isPropagationStopped() |
|
|
49 |
{ |
|
|
50 |
return $this->propagationStopped; |
|
|
51 |
} |
|
|
52 |
|
|
|
53 |
/** |
|
|
54 |
* Stops the propagation of the event to further event listeners. |
|
|
55 |
* |
|
|
56 |
* If multiple event listeners are connected to the same event, no |
|
|
57 |
* further event listener will be triggered once any trigger calls |
|
|
58 |
* stopPropagation(). |
|
|
59 |
* |
|
|
60 |
* @api |
|
|
61 |
*/ |
|
|
62 |
public function stopPropagation() |
|
|
63 |
{ |
|
|
64 |
$this->propagationStopped = true; |
|
|
65 |
} |
|
|
66 |
} |