protected static function ServiceContainer::dispatchStaticEvent in Service Container 7.2
Same name and namespace in other branches
- 7 lib/ServiceContainer.php \ServiceContainer::dispatchStaticEvent()
Dispatches an event to static classes.
This is needed to inform other static classes when the container is ready.
Parameters
string $event: The member function to call.
array $arguments: The arguments to pass.
1 call to ServiceContainer::dispatchStaticEvent()
- ServiceContainer::init in lib/
ServiceContainer.php - Initializes the container.
File
- lib/
ServiceContainer.php, line 60 - Contains ServiceContainer
Class
- ServiceContainer
- Static Service Container wrapper extension - initializes the container.
Code
protected static function dispatchStaticEvent($event, $arguments) {
$event_listeners = static::$container
->getParameter('service_container.static_event_listeners');
foreach ($event_listeners as $class) {
$function = $class . '::' . $event;
if (is_callable($function)) {
call_user_func_array($function, $arguments);
}
}
}