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