mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 17:57:04 +08:00
PERF: avoid reinstantiation of event subscribers
This commit is contained in:
parent
7ac3e9fa92
commit
714ab8fca5
|
@ -11,8 +11,8 @@ class AddApiRelationships
|
|||
{
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(ApiRelationship::class, __CLASS__.'@addRelationships');
|
||||
$events->listen(BuildApiAction::class, __CLASS__.'@includeRelationships');
|
||||
$events->listen(ApiRelationship::class, [$this, 'addRelationships']);
|
||||
$events->listen(BuildApiAction::class, [$this, 'includeRelationships']);
|
||||
}
|
||||
|
||||
public function addRelationships(ApiRelationship $event)
|
||||
|
|
|
@ -8,8 +8,8 @@ class AddClientAssets
|
|||
{
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(RegisterLocales::class, __CLASS__.'@addLocale');
|
||||
$events->listen(BuildClientView::class, __CLASS__.'@addAssets');
|
||||
$events->listen(RegisterLocales::class, [$this, 'addLocale']);
|
||||
$events->listen(BuildClientView::class, [$this, 'addAssets']);
|
||||
}
|
||||
|
||||
public function addLocale(RegisterLocales $event)
|
||||
|
|
|
@ -8,7 +8,7 @@ class AddModelRelationships
|
|||
{
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen(ModelRelationship::class, __CLASS__.'@addRelationships');
|
||||
$events->listen(ModelRelationship::class, [$this, 'addRelationships']);
|
||||
}
|
||||
|
||||
public function addRelationships(ModelRelationship $event)
|
||||
|
|
|
@ -8,8 +8,8 @@ class AddPostMentionsFormatter
|
|||
{
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen(FormatterConfigurator::class, __CLASS__.'@configure');
|
||||
$events->listen(FormatterRenderer::class, __CLASS__.'@render');
|
||||
$events->listen(FormatterConfigurator::class, [$this, 'configure']);
|
||||
$events->listen(FormatterRenderer::class, [$this, 'render']);
|
||||
}
|
||||
|
||||
public function configure(FormatterConfigurator $event)
|
||||
|
|
|
@ -16,9 +16,9 @@ class AddUserMentionsFormatter
|
|||
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen(FormatterConfigurator::class, __CLASS__.'@configure');
|
||||
$events->listen(FormatterParser::class, __CLASS__.'@parse');
|
||||
$events->listen(FormatterRenderer::class, __CLASS__.'@render');
|
||||
$events->listen(FormatterConfigurator::class, [$this, 'configure']);
|
||||
$events->listen(FormatterParser::class, [$this, 'parse']);
|
||||
$events->listen(FormatterRenderer::class, [$this, 'render']);
|
||||
}
|
||||
|
||||
public function configure(FormatterConfigurator $event)
|
||||
|
|
|
@ -23,13 +23,13 @@ class UpdatePostMentionsMetadata
|
|||
|
||||
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(PostWasRevised::class, __CLASS__.'@whenPostWasRevised');
|
||||
$events->listen(PostWasHidden::class, __CLASS__.'@whenPostWasHidden');
|
||||
$events->listen(PostWasRestored::class, __CLASS__.'@whenPostWasRestored');
|
||||
$events->listen(PostWasDeleted::class, __CLASS__.'@whenPostWasDeleted');
|
||||
$events->listen(PostWasPosted::class, [$this, 'whenPostWasPosted']);
|
||||
$events->listen(PostWasRevised::class, [$this, 'whenPostWasRevised']);
|
||||
$events->listen(PostWasHidden::class, [$this, 'whenPostWasHidden']);
|
||||
$events->listen(PostWasRestored::class, [$this, 'whenPostWasRestored']);
|
||||
$events->listen(PostWasDeleted::class, [$this, 'whenPostWasDeleted']);
|
||||
}
|
||||
|
||||
public function registerNotificationType(RegisterNotificationTypes $event)
|
||||
|
|
|
@ -24,13 +24,13 @@ class UpdateUserMentionsMetadata
|
|||
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(RegisterNotificationTypes::class, __CLASS__.'@registerNotificationType');
|
||||
$events->listen(RegisterNotificationTypes::class, );
|
||||
|
||||
$events->listen(PostWasPosted::class, __CLASS__.'@whenPostWasPosted');
|
||||
$events->listen(PostWasRevised::class, __CLASS__.'@whenPostWasRevised');
|
||||
$events->listen(PostWasHidden::class, __CLASS__.'@whenPostWasHidden');
|
||||
$events->listen(PostWasRestored::class, __CLASS__.'@whenPostWasRestored');
|
||||
$events->listen(PostWasDeleted::class, __CLASS__.'@whenPostWasDeleted');
|
||||
$events->listen(PostWasPosted::class, );
|
||||
$events->listen(PostWasRevised::class, );
|
||||
$events->listen(PostWasHidden::class, );
|
||||
$events->listen(PostWasRestored::class, );
|
||||
$events->listen(PostWasDeleted::class, );
|
||||
}
|
||||
|
||||
public function registerNotificationType(RegisterNotificationTypes $event)
|
||||
|
|
Loading…
Reference in New Issue
Block a user