From cc118d4c293151780df7ceea5b820b1901b256b9 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sun, 25 Jun 2017 17:04:33 +0200 Subject: [PATCH] Move more event classes to appropriate namespaces --- .../Event/Searching.php} | 4 ++-- framework/core/src/Discussion/Search/DiscussionSearcher.php | 4 ++-- framework/core/src/User/Command/DeleteAvatarHandler.php | 4 ++-- framework/core/src/User/Command/UploadAvatarHandler.php | 4 ++-- .../AvatarWillBeDeleted.php => User/Event/AvatarDeleting.php} | 4 ++-- .../AvatarWillBeSaved.php => User/Event/AvatarSaving.php} | 4 ++-- .../ConfigureUserSearch.php => User/Event/Searching.php} | 4 ++-- framework/core/src/User/Search/UserSearcher.php | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) rename framework/core/src/{Event/ConfigureDiscussionSearch.php => Discussion/Event/Searching.php} (92%) rename framework/core/src/{Event/AvatarWillBeDeleted.php => User/Event/AvatarDeleting.php} (93%) rename framework/core/src/{Event/AvatarWillBeSaved.php => User/Event/AvatarSaving.php} (95%) rename framework/core/src/{Event/ConfigureUserSearch.php => User/Event/Searching.php} (93%) diff --git a/framework/core/src/Event/ConfigureDiscussionSearch.php b/framework/core/src/Discussion/Event/Searching.php similarity index 92% rename from framework/core/src/Event/ConfigureDiscussionSearch.php rename to framework/core/src/Discussion/Event/Searching.php index 2b126046e..5735bffdc 100644 --- a/framework/core/src/Event/ConfigureDiscussionSearch.php +++ b/framework/core/src/Discussion/Event/Searching.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; use Flarum\Discussion\Search\DiscussionSearch; use Flarum\Search\SearchCriteria; -class ConfigureDiscussionSearch +class Searching { /** * @var DiscussionSearch diff --git a/framework/core/src/Discussion/Search/DiscussionSearcher.php b/framework/core/src/Discussion/Search/DiscussionSearcher.php index 9a6e215ae..5628dcf2f 100644 --- a/framework/core/src/Discussion/Search/DiscussionSearcher.php +++ b/framework/core/src/Discussion/Search/DiscussionSearcher.php @@ -13,7 +13,7 @@ namespace Flarum\Discussion\Search; use Flarum\Discussion\Discussion; use Flarum\Discussion\DiscussionRepository; -use Flarum\Event\ConfigureDiscussionSearch; +use Flarum\Discussion\Event\Searching; use Flarum\Post\PostRepository; use Flarum\Search\ApplySearchParametersTrait; use Flarum\Search\GambitManager; @@ -81,7 +81,7 @@ class DiscussionSearcher $this->applyLimit($search, $limit + 1); // TODO: inject dispatcher - event(new ConfigureDiscussionSearch($search, $criteria)); + event(new Searching($search, $criteria)); // Execute the search query and retrieve the results. We get one more // results than the user asked for, so that we can say if there are more diff --git a/framework/core/src/User/Command/DeleteAvatarHandler.php b/framework/core/src/User/Command/DeleteAvatarHandler.php index f75bea567..e920f7192 100644 --- a/framework/core/src/User/Command/DeleteAvatarHandler.php +++ b/framework/core/src/User/Command/DeleteAvatarHandler.php @@ -11,7 +11,7 @@ namespace Flarum\User\Command; -use Flarum\Event\AvatarWillBeDeleted; +use Flarum\User\Event\AvatarDeleting; use Flarum\Foundation\DispatchEventsTrait; use Flarum\User\AssertPermissionTrait; use Flarum\User\UserRepository; @@ -64,7 +64,7 @@ class DeleteAvatarHandler $user->changeAvatarPath(null); $this->events->fire( - new AvatarWillBeDeleted($user, $actor) + new AvatarDeleting($user, $actor) ); $user->save(); diff --git a/framework/core/src/User/Command/UploadAvatarHandler.php b/framework/core/src/User/Command/UploadAvatarHandler.php index c674d44b8..2aa28044a 100644 --- a/framework/core/src/User/Command/UploadAvatarHandler.php +++ b/framework/core/src/User/Command/UploadAvatarHandler.php @@ -12,7 +12,7 @@ namespace Flarum\User\Command; use Exception; -use Flarum\Event\AvatarWillBeSaved; +use Flarum\User\Event\AvatarSaving; use Flarum\Foundation\Application; use Flarum\Foundation\DispatchEventsTrait; use Flarum\User\AssertPermissionTrait; @@ -110,7 +110,7 @@ class UploadAvatarHandler file_put_contents($tmpFile, $encodedImage); $this->events->fire( - new AvatarWillBeSaved($user, $actor, $tmpFile) + new AvatarSaving($user, $actor, $tmpFile) ); $mount = new MountManager([ diff --git a/framework/core/src/Event/AvatarWillBeDeleted.php b/framework/core/src/User/Event/AvatarDeleting.php similarity index 93% rename from framework/core/src/Event/AvatarWillBeDeleted.php rename to framework/core/src/User/Event/AvatarDeleting.php index df862684a..c991acb8d 100644 --- a/framework/core/src/Event/AvatarWillBeDeleted.php +++ b/framework/core/src/User/Event/AvatarDeleting.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\User\Event; use Flarum\User\User; -class AvatarWillBeDeleted +class AvatarDeleting { /** * The user whose avatar will be deleted. diff --git a/framework/core/src/Event/AvatarWillBeSaved.php b/framework/core/src/User/Event/AvatarSaving.php similarity index 95% rename from framework/core/src/Event/AvatarWillBeSaved.php rename to framework/core/src/User/Event/AvatarSaving.php index 3737bb350..d3b82f741 100644 --- a/framework/core/src/Event/AvatarWillBeSaved.php +++ b/framework/core/src/User/Event/AvatarSaving.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\User\Event; use Flarum\User\User; -class AvatarWillBeSaved +class AvatarSaving { /** * The user whose avatar will be saved. diff --git a/framework/core/src/Event/ConfigureUserSearch.php b/framework/core/src/User/Event/Searching.php similarity index 93% rename from framework/core/src/Event/ConfigureUserSearch.php rename to framework/core/src/User/Event/Searching.php index 1b9a235e4..5f6b0695f 100644 --- a/framework/core/src/Event/ConfigureUserSearch.php +++ b/framework/core/src/User/Event/Searching.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\User\Event; use Flarum\Search\SearchCriteria; use Flarum\User\Search\UserSearch; -class ConfigureUserSearch +class Searching { /** * @var \Flarum\User\Search\UserSearch diff --git a/framework/core/src/User/Search/UserSearcher.php b/framework/core/src/User/Search/UserSearcher.php index 518b4c85e..55ce2b5ff 100644 --- a/framework/core/src/User/Search/UserSearcher.php +++ b/framework/core/src/User/Search/UserSearcher.php @@ -11,7 +11,7 @@ namespace Flarum\User\Search; -use Flarum\Event\ConfigureUserSearch; +use Flarum\User\Event\Searching; use Flarum\Search\ApplySearchParametersTrait; use Flarum\Search\GambitManager; use Flarum\Search\SearchCriteria; @@ -69,7 +69,7 @@ class UserSearcher $this->applyOffset($search, $offset); $this->applyLimit($search, $limit + 1); - event(new ConfigureUserSearch($search, $criteria)); + event(new Searching($search, $criteria)); // Execute the search query and retrieve the results. We get one more // results than the user asked for, so that we can say if there are more