PERF: avoid reinstantiation of event subscribers

This commit is contained in:
Toby Zerner 2015-07-27 11:54:28 +09:30
parent 7ac3e9fa92
commit 714ab8fca5
7 changed files with 22 additions and 22 deletions

View File

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

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

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

View File

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

View File

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

View File

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

View File

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