diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-09-11 20:02:50 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-09-11 20:02:50 +0200 |
commit | b9e14d5972d403a669a23e11b4b1359995d65ccc (patch) | |
tree | 8189f8b6e5289db2e52df9905be3aa71a26ff454 /lib/private/EventDispatcher | |
parent | 15d39c48e652a76fd63b6986ecbabe62c00631cb (diff) | |
download | nextcloud-server-b9e14d5972d403a669a23e11b4b1359995d65ccc.tar.gz nextcloud-server-b9e14d5972d403a669a23e11b4b1359995d65ccc.zip |
Add Symfony inspired typed event dispatcher method
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/EventDispatcher')
-rw-r--r-- | lib/private/EventDispatcher/EventDispatcher.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index 8db2f3101be..7b3a1c378a1 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -31,6 +31,7 @@ use OCP\IContainer; use OCP\ILogger; use OCP\IServerContainer; use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher; +use function get_class; class EventDispatcher implements IEventDispatcher { @@ -75,6 +76,10 @@ class EventDispatcher implements IEventDispatcher { $this->dispatcher->dispatch($eventName, $event); } + public function dispatchTyped(Event $event): void { + $this->dispatch(get_class($event), $event); + } + /** * @return SymfonyDispatcher */ |