PERF: avoid reinstantiation of event subscribers

This commit is contained in:
Toby Zerner 2015-07-27 11:54:35 +09:30
parent 97ef05de20
commit 14b8ed7236
5 changed files with 11 additions and 11 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)