Merge event listener registration

This commit is contained in:
Toby Zerner 2018-06-19 21:59:45 +09:30 committed by Franz Liedke
parent 79b00cb94f
commit 520e1550d1
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -43,13 +43,13 @@ class Formatter implements ExtenderInterface
// Also set up an event listener to flush the formatter cache whenever
// this extension is enabled or disabled.
$flush = function ($event) use ($container, $extension) {
if ($event->extension === $extension) {
$container->make(ActualFormatter::class)->flush();
$events->listen(
[Enabled::class, Disabled::class],
function ($event) use ($container, $extension) {
if ($event->extension === $extension) {
$container->make(ActualFormatter::class)->flush();
}
}
};
$events->listen(Enabled::class, $flush);
$events->listen(Disabled::class, $flush);
);
}
}