mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 12:43:52 +08:00
PERF: avoid reinstantiation of event subscribers
This commit is contained in:
parent
97ef05de20
commit
14b8ed7236
|
@ -10,8 +10,8 @@ class AddApiAttributes
|
|||
{
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(ApiAttributes::class, __CLASS__.'@addAttributes');
|
||||
$events->listen(BuildApiAction::class, __CLASS__.'@includeStartPost');
|
||||
$events->listen(ApiAttributes::class, [$this, 'addAttributes']);
|
||||
$events->listen(BuildApiAction::class, [$this, 'includeStartPost']);
|
||||
}
|
||||
|
||||
public function addAttributes(ApiAttributes $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)
|
||||
|
|
|
@ -22,10 +22,10 @@ class NotifyDiscussionStickied
|
|||
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(RegisterPostTypes::class, __CLASS__.'@registerPostType');
|
||||
$events->listen(RegisterNotificationTypes::class, __CLASS__.'@registerNotificationType');
|
||||
$events->listen(DiscussionWasStickied::class, __CLASS__.'@whenDiscussionWasStickied');
|
||||
$events->listen(DiscussionWasUnstickied::class, __CLASS__.'@whenDiscussionWasUnstickied');
|
||||
$events->listen(RegisterPostTypes::class, [$this, 'registerPostType']);
|
||||
$events->listen(RegisterNotificationTypes::class, [$this, 'registerNotificationType']);
|
||||
$events->listen(DiscussionWasStickied::class, [$this, 'whenDiscussionWasStickied']);
|
||||
$events->listen(DiscussionWasUnstickied::class, [$this, 'whenDiscussionWasUnstickied']);
|
||||
}
|
||||
|
||||
public function registerPostType(RegisterPostTypes $event)
|
||||
|
|
|
@ -8,7 +8,7 @@ class PersistData
|
|||
{
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen(DiscussionWillBeSaved::class, __CLASS__.'@whenDiscussionWillBeSaved');
|
||||
$events->listen(DiscussionWillBeSaved::class, [$this, 'whenDiscussionWillBeSaved']);
|
||||
}
|
||||
|
||||
public function whenDiscussionWillBeSaved(DiscussionWillBeSaved $event)
|
||||
|
|
|
@ -9,8 +9,8 @@ class PinStickiedDiscussionsToTop
|
|||
{
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(RegisterDiscussionGambits::class, __CLASS__.'@registerStickyGambit');
|
||||
$events->listen(DiscussionSearchWillBePerformed::class, __CLASS__.'@reorderSearch');
|
||||
$events->listen(RegisterDiscussionGambits::class, [$this, 'registerStickyGambit']);
|
||||
$events->listen(DiscussionSearchWillBePerformed::class, [$this, 'reorderSearch']);
|
||||
}
|
||||
|
||||
public function registerStickyGambit(RegisterDiscussionGambits $event)
|
||||
|
|
Loading…
Reference in New Issue
Block a user