From 5a6d28f8a70a3f4eb7a132b02af9ebef344d74fd Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 24 Jun 2017 13:16:02 +0200 Subject: [PATCH] Move events to Flarum\Settings\Event namespace --- framework/core/src/Admin/AdminServiceProvider.php | 4 ++-- .../core/src/Admin/Controller/FrontendController.php | 4 ++-- .../core/src/Api/Controller/SetSettingsController.php | 8 ++++---- framework/core/src/Forum/ForumServiceProvider.php | 4 ++-- .../Event/Deserializing.php} | 4 ++-- .../{Event/SettingWasSet.php => Settings/Event/Saved.php} | 4 ++-- .../Event/Serializing.php} | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) rename framework/core/src/{Event/PrepareUnserializedSettings.php => Settings/Event/Deserializing.php} (92%) rename framework/core/src/{Event/SettingWasSet.php => Settings/Event/Saved.php} (93%) rename framework/core/src/{Event/PrepareSerializedSetting.php => Settings/Event/Serializing.php} (92%) diff --git a/framework/core/src/Admin/AdminServiceProvider.php b/framework/core/src/Admin/AdminServiceProvider.php index 2cbd60a78..87e784816 100644 --- a/framework/core/src/Admin/AdminServiceProvider.php +++ b/framework/core/src/Admin/AdminServiceProvider.php @@ -13,7 +13,7 @@ namespace Flarum\Admin; use Flarum\Event\ExtensionWasDisabled; use Flarum\Event\ExtensionWasEnabled; -use Flarum\Event\SettingWasSet; +use Flarum\Settings\Event\Saved; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\RouteCollection; @@ -63,7 +63,7 @@ class AdminServiceProvider extends AbstractServiceProvider protected function flushWebAppAssetsWhenThemeChanged() { - $this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) { + $this->app->make('events')->listen(Saved::class, function (Saved $event) { if (preg_match('/^theme_|^custom_less$/i', $event->key)) { $this->getWebAppAssets()->flushCss(); } diff --git a/framework/core/src/Admin/Controller/FrontendController.php b/framework/core/src/Admin/Controller/FrontendController.php index eb691f88f..d1b18d2ba 100644 --- a/framework/core/src/Admin/Controller/FrontendController.php +++ b/framework/core/src/Admin/Controller/FrontendController.php @@ -13,7 +13,7 @@ namespace Flarum\Admin\Controller; use Flarum\Admin\Frontend; use Flarum\Core\Permission; -use Flarum\Event\PrepareUnserializedSettings; +use Flarum\Settings\Event\Deserializing; use Flarum\Extension\ExtensionManager; use Flarum\Frontend\AbstractFrontendController; use Flarum\Settings\SettingsRepositoryInterface; @@ -56,7 +56,7 @@ class FrontendController extends AbstractFrontendController $settings = $this->settings->all(); $this->events->fire( - new PrepareUnserializedSettings($settings) + new Deserializing($settings) ); $view->setVariable('settings', $settings); diff --git a/framework/core/src/Api/Controller/SetSettingsController.php b/framework/core/src/Api/Controller/SetSettingsController.php index d714ab165..09f23c6eb 100644 --- a/framework/core/src/Api/Controller/SetSettingsController.php +++ b/framework/core/src/Api/Controller/SetSettingsController.php @@ -12,8 +12,8 @@ namespace Flarum\Api\Controller; use Flarum\Core\Access\AssertPermissionTrait; -use Flarum\Event\PrepareSerializedSetting; -use Flarum\Event\SettingWasSet; +use Flarum\Settings\Event\Serializing; +use Flarum\Settings\Event\Saved; use Flarum\Http\Controller\ControllerInterface; use Flarum\Settings\SettingsRepositoryInterface; use Illuminate\Contracts\Events\Dispatcher; @@ -53,11 +53,11 @@ class SetSettingsController implements ControllerInterface $settings = $request->getParsedBody(); foreach ($settings as $k => $v) { - $this->dispatcher->fire(new PrepareSerializedSetting($k, $v)); + $this->dispatcher->fire(new Serializing($k, $v)); $this->settings->set($k, $v); - $this->dispatcher->fire(new SettingWasSet($k, $v)); + $this->dispatcher->fire(new Saved($k, $v)); } return new EmptyResponse(204); diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index 86ef67d31..4504443b4 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -14,7 +14,7 @@ namespace Flarum\Forum; use Flarum\Event\ConfigureForumRoutes; use Flarum\Event\ExtensionWasDisabled; use Flarum\Event\ExtensionWasEnabled; -use Flarum\Event\SettingWasSet; +use Flarum\Settings\Event\Saved; use Flarum\Foundation\AbstractServiceProvider; use Flarum\Http\Handler\RouteHandlerFactory; use Flarum\Http\RouteCollection; @@ -82,7 +82,7 @@ class ForumServiceProvider extends AbstractServiceProvider protected function flushWebAppAssetsWhenThemeChanged() { - $this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) { + $this->app->make('events')->listen(Saved::class, function (Saved $event) { if (preg_match('/^theme_|^custom_less$/i', $event->key)) { $this->getWebAppAssets()->flushCss(); } diff --git a/framework/core/src/Event/PrepareUnserializedSettings.php b/framework/core/src/Settings/Event/Deserializing.php similarity index 92% rename from framework/core/src/Event/PrepareUnserializedSettings.php rename to framework/core/src/Settings/Event/Deserializing.php index f75e27f66..d07bae483 100644 --- a/framework/core/src/Event/PrepareUnserializedSettings.php +++ b/framework/core/src/Settings/Event/Deserializing.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Settings\Event; /** * Prepare settings for display in the client. @@ -17,7 +17,7 @@ namespace Flarum\Event; * This event is fired when settings have been retrieved from the database and * are being unserialized for display in the client. */ -class PrepareUnserializedSettings +class Deserializing { /** * The settings array to be unserialized. diff --git a/framework/core/src/Event/SettingWasSet.php b/framework/core/src/Settings/Event/Saved.php similarity index 93% rename from framework/core/src/Event/SettingWasSet.php rename to framework/core/src/Settings/Event/Saved.php index 7210e2599..216a68411 100644 --- a/framework/core/src/Event/SettingWasSet.php +++ b/framework/core/src/Settings/Event/Saved.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Settings\Event; -class SettingWasSet +class Saved { /** * The setting key that was set. diff --git a/framework/core/src/Event/PrepareSerializedSetting.php b/framework/core/src/Settings/Event/Serializing.php similarity index 92% rename from framework/core/src/Event/PrepareSerializedSetting.php rename to framework/core/src/Settings/Event/Serializing.php index 620ccb404..40643ced1 100644 --- a/framework/core/src/Event/PrepareSerializedSetting.php +++ b/framework/core/src/Settings/Event/Serializing.php @@ -9,9 +9,9 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Settings\Event; -class PrepareSerializedSetting +class Serializing { /** * The settings key being saved.