mirror of
https://github.com/flarum/core.git
synced 2025-07-29 20:50:28 +02:00
PERF: avoid reinstantiation of event subscribers
This commit is contained in:
@@ -11,8 +11,8 @@ class AddApiRelationships
|
|||||||
{
|
{
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(ApiRelationship::class, __CLASS__.'@addRelationships');
|
$events->listen(ApiRelationship::class, [$this, 'addRelationships']);
|
||||||
$events->listen(BuildApiAction::class, __CLASS__.'@includeRelationships');
|
$events->listen(BuildApiAction::class, [$this, 'includeRelationships']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRelationships(ApiRelationship $event)
|
public function addRelationships(ApiRelationship $event)
|
||||||
|
@@ -8,8 +8,8 @@ class AddClientAssets
|
|||||||
{
|
{
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(RegisterLocales::class, __CLASS__.'@addLocale');
|
$events->listen(RegisterLocales::class, [$this, 'addLocale']);
|
||||||
$events->listen(BuildClientView::class, __CLASS__.'@addAssets');
|
$events->listen(BuildClientView::class, [$this, 'addAssets']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLocale(RegisterLocales $event)
|
public function addLocale(RegisterLocales $event)
|
||||||
|
@@ -8,7 +8,7 @@ class AddModelRelationships
|
|||||||
{
|
{
|
||||||
public function subscribe($events)
|
public function subscribe($events)
|
||||||
{
|
{
|
||||||
$events->listen(ModelRelationship::class, __CLASS__.'@addRelationships');
|
$events->listen(ModelRelationship::class, [$this, 'addRelationships']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addRelationships(ModelRelationship $event)
|
public function addRelationships(ModelRelationship $event)
|
||||||
|
@@ -8,8 +8,8 @@ class AddPostMentionsFormatter
|
|||||||
{
|
{
|
||||||
public function subscribe($events)
|
public function subscribe($events)
|
||||||
{
|
{
|
||||||
$events->listen(FormatterConfigurator::class, __CLASS__.'@configure');
|
$events->listen(FormatterConfigurator::class, [$this, 'configure']);
|
||||||
$events->listen(FormatterRenderer::class, __CLASS__.'@render');
|
$events->listen(FormatterRenderer::class, [$this, 'render']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure(FormatterConfigurator $event)
|
public function configure(FormatterConfigurator $event)
|
||||||
|
@@ -16,9 +16,9 @@ class AddUserMentionsFormatter
|
|||||||
|
|
||||||
public function subscribe($events)
|
public function subscribe($events)
|
||||||
{
|
{
|
||||||
$events->listen(FormatterConfigurator::class, __CLASS__.'@configure');
|
$events->listen(FormatterConfigurator::class, [$this, 'configure']);
|
||||||
$events->listen(FormatterParser::class, __CLASS__.'@parse');
|
$events->listen(FormatterParser::class, [$this, 'parse']);
|
||||||
$events->listen(FormatterRenderer::class, __CLASS__.'@render');
|
$events->listen(FormatterRenderer::class, [$this, 'render']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configure(FormatterConfigurator $event)
|
public function configure(FormatterConfigurator $event)
|
||||||
|
@@ -23,13 +23,13 @@ class UpdatePostMentionsMetadata
|
|||||||
|
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(RegisterNotificationTypes::class, __CLASS__.'@registerNotificationType');
|
$events->listen(RegisterNotificationTypes::class, [$this, 'registerNotificationType']);
|
||||||
|
|
||||||
$events->listen(PostWasPosted::class, __CLASS__.'@whenPostWasPosted');
|
$events->listen(PostWasPosted::class, [$this, 'whenPostWasPosted']);
|
||||||
$events->listen(PostWasRevised::class, __CLASS__.'@whenPostWasRevised');
|
$events->listen(PostWasRevised::class, [$this, 'whenPostWasRevised']);
|
||||||
$events->listen(PostWasHidden::class, __CLASS__.'@whenPostWasHidden');
|
$events->listen(PostWasHidden::class, [$this, 'whenPostWasHidden']);
|
||||||
$events->listen(PostWasRestored::class, __CLASS__.'@whenPostWasRestored');
|
$events->listen(PostWasRestored::class, [$this, 'whenPostWasRestored']);
|
||||||
$events->listen(PostWasDeleted::class, __CLASS__.'@whenPostWasDeleted');
|
$events->listen(PostWasDeleted::class, [$this, 'whenPostWasDeleted']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerNotificationType(RegisterNotificationTypes $event)
|
public function registerNotificationType(RegisterNotificationTypes $event)
|
||||||
|
@@ -24,13 +24,13 @@ class UpdateUserMentionsMetadata
|
|||||||
|
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(RegisterNotificationTypes::class, __CLASS__.'@registerNotificationType');
|
$events->listen(RegisterNotificationTypes::class, );
|
||||||
|
|
||||||
$events->listen(PostWasPosted::class, __CLASS__.'@whenPostWasPosted');
|
$events->listen(PostWasPosted::class, );
|
||||||
$events->listen(PostWasRevised::class, __CLASS__.'@whenPostWasRevised');
|
$events->listen(PostWasRevised::class, );
|
||||||
$events->listen(PostWasHidden::class, __CLASS__.'@whenPostWasHidden');
|
$events->listen(PostWasHidden::class, );
|
||||||
$events->listen(PostWasRestored::class, __CLASS__.'@whenPostWasRestored');
|
$events->listen(PostWasRestored::class, );
|
||||||
$events->listen(PostWasDeleted::class, __CLASS__.'@whenPostWasDeleted');
|
$events->listen(PostWasDeleted::class, );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerNotificationType(RegisterNotificationTypes $event)
|
public function registerNotificationType(RegisterNotificationTypes $event)
|
||||||
|
Reference in New Issue
Block a user