File tree Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Expand file tree Collapse file tree 1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ class EventDispatcher {
17
17
public static $ events ;
18
18
public static $ current_event ;
19
19
public static $ happened_events ;
20
+
21
+ private $ error_message = '' ;
20
22
21
23
22
24
private function __construct ()
@@ -110,20 +112,22 @@ public function doDispatch($name, $arguments = "")
110
112
// run Listener and store the value returned by registered functions
111
113
if ( function_exists ($ action ['function ' ]) )
112
114
{
113
-
115
+
114
116
$ return_arguments = call_user_func_array ($ action ['function ' ], array (&$ arguments ));
115
-
117
+
116
118
if ( $ return_arguments )
117
119
{
118
120
$ arguments = $ return_arguments ;
119
121
}
120
-
122
+
121
123
// Store called Listeners
122
124
self ::$ happened_events [$ name ][$ priority ] = $ action ['function ' ];
123
125
}
124
126
else {
125
-
126
- //die('Function ' . $action['function'] . ' not found');
127
+
128
+ $ this ->error_message = 'Event Dispatcher: Function " ' . $ action ['function ' ] . '" not found. ( ' . $ name . ') ' ;
129
+
130
+ $ this ->hasError ();
127
131
}
128
132
}
129
133
}
@@ -223,7 +227,13 @@ public static function debug()
223
227
print_r (self ::$ happened_events );
224
228
echo "</pre> " ;
225
229
}
226
- }
230
+ }
231
+
232
+ private function hasError () {
233
+
234
+ die ($ this ->error_message );
235
+ }
236
+
227
237
}
228
238
229
239
/**
You can’t perform that action at this time.
0 commit comments