commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / vendor / symfony / event-dispatcher / Symfony / Component / EventDispatcher / Event.php
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 * @var EventDispatcher Dispatcher that dispatched this event
37 */
38 private $dispatcher;
39
40 /**
41 * @var string This event's name
42 */
43 private $name;
44
45 /**
46 * Returns whether further event listeners should be triggered.
47 *
48 * @see Event::stopPropagation()
49 *
50 * @return bool Whether propagation was already stopped for this event.
51 */
52 public function isPropagationStopped()
53 {
54 return $this->propagationStopped;
55 }
56
57 /**
58 * Stops the propagation of the event to further event listeners.
59 *
60 * If multiple event listeners are connected to the same event, no
61 * further event listener will be triggered once any trigger calls
62 * stopPropagation().
63 */
64 public function stopPropagation()
65 {
66 $this->propagationStopped = true;
67 }
68
69 /**
70 * Stores the EventDispatcher that dispatches this Event.
71 *
72 * @param EventDispatcherInterface $dispatcher
73 */
74 public function setDispatcher(EventDispatcherInterface $dispatcher)
75 {
76 $this->dispatcher = $dispatcher;
77 }
78
79 /**
80 * Returns the EventDispatcher that dispatches this Event.
81 *
82 * @return EventDispatcherInterface
83 */
84 public function getDispatcher()
85 {
86 return $this->dispatcher;
87 }
88
89 /**
90 * Gets the event's name.
91 *
92 * @return string
93 */
94 public function getName()
95 {
96 return $this->name;
97 }
98
99 /**
100 * Sets the event's name property.
101 *
102 * @param string $name The event name.
103 */
104 public function setName($name)
105 {
106 $this->name = $name;
107 }
108 }