1 | <?php |
||
17 | final class Scene implements SceneInterface |
||
18 | { |
||
19 | /** |
||
20 | * The name of the scene. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | private $name; |
||
25 | |||
26 | /** |
||
27 | * The list with events that can be executed. |
||
28 | * |
||
29 | * @var EventInterface[] |
||
30 | */ |
||
31 | private $events; |
||
32 | |||
33 | /** |
||
34 | * Initializes a new instance of this class. |
||
35 | */ |
||
36 | public function __construct() |
||
40 | |||
41 | /** |
||
42 | * Executes the event with the given name. |
||
43 | * |
||
44 | * @param string $eventName The name of the event to execute. |
||
45 | * @return int Returns the amount of events that are executed. |
||
46 | */ |
||
47 | public function execute($eventName) |
||
60 | |||
61 | /** |
||
62 | * Adds the given event to this scene. |
||
63 | * |
||
64 | * @param EventInterface $event |
||
65 | */ |
||
66 | public function addEvent(EventInterface $event) |
||
72 | |||
73 | /** |
||
74 | * Clears all the events within the scene. |
||
75 | */ |
||
76 | public function clearEvents() |
||
80 | |||
81 | /** |
||
82 | * Gets a list with all events that are registered. |
||
83 | * |
||
84 | * @return EventInterface[] |
||
85 | */ |
||
86 | public function getEvents() |
||
90 | |||
91 | /** |
||
92 | * Gets the name of the scene. |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | public function getName() |
||
100 | |||
101 | /** |
||
102 | * Removes the given event from the scene. |
||
103 | * |
||
104 | * @param EventInterface $event The event to remove. |
||
105 | */ |
||
106 | public function removeEvent(EventInterface $event) |
||
113 | |||
114 | /** |
||
115 | * Sets the name of the scene. |
||
116 | * |
||
117 | * @param string $name The name to set. |
||
118 | */ |
||
119 | public function setName($name) |
||
123 | } |
||
124 |