From 39a7ba3663d348802e40966fe920f87b5094ed1e Mon Sep 17 00:00:00 2001 From: Anton Fedurtsya Date: Wed, 15 Nov 2023 18:15:04 +0200 Subject: [PATCH] OXDEV-7557 Use attributes in Controllers It will make the automatic cleanup possible for earlier "not used" classes, that have been used in the docblocks. Signed-off-by: Anton Fedurtsya --- .../Controller/ModuleSettingController.php | 132 ++++++------- .../Controller/ShopSettingController.php | 96 ++++------ .../Controller/ThemeSettingController.php | 180 ++++++++---------- 3 files changed, 173 insertions(+), 235 deletions(-) diff --git a/src/Setting/Controller/ModuleSettingController.php b/src/Setting/Controller/ModuleSettingController.php index e3f4ac5..04d11c4 100644 --- a/src/Setting/Controller/ModuleSettingController.php +++ b/src/Setting/Controller/ModuleSettingController.php @@ -18,129 +18,109 @@ final class ModuleSettingController { public function __construct( - private ModuleSettingServiceInterface $settingService + private ModuleSettingServiceInterface $moduleSettingService ) { } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingInteger(ID $name, string $moduleId): IntegerSetting { - return $this->settingService->getIntegerSetting($name, $moduleId); + return $this->moduleSettingService->getIntegerSetting($name, $moduleId); } - /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingFloat(ID $name, string $moduleId): FloatSetting { - return $this->settingService->getFloatSetting($name, $moduleId); + return $this->moduleSettingService->getFloatSetting($name, $moduleId); } - /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingBoolean(ID $name, string $moduleId): BooleanSetting { - return $this->settingService->getBooleanSetting($name, $moduleId); + return $this->moduleSettingService->getBooleanSetting($name, $moduleId); } - /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingString(ID $name, string $moduleId): StringSetting { - return $this->settingService->getStringSetting($name, $moduleId); + return $this->moduleSettingService->getStringSetting($name, $moduleId); } - /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingCollection(ID $name, string $moduleId): StringSetting { - return $this->settingService->getCollectionSetting($name, $moduleId); + return $this->moduleSettingService->getCollectionSetting($name, $moduleId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeModuleSettingInteger(ID $name, int $value, string $moduleId): IntegerSetting { - return $this->settingService->changeIntegerSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeIntegerSetting($name, $value, $moduleId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeModuleSettingFloat(ID $name, float $value, string $moduleId): FloatSetting { - return $this->settingService->changeFloatSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeFloatSetting($name, $value, $moduleId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeModuleSettingBoolean(ID $name, bool $value, string $moduleId): BooleanSetting { - return $this->settingService->changeBooleanSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeBooleanSetting($name, $value, $moduleId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeModuleSettingString(ID $name, string $value, string $moduleId): StringSetting { - return $this->settingService->changeStringSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeStringSetting($name, $value, $moduleId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeModuleSettingCollection(ID $name, string $value, string $moduleId): StringSetting { - return $this->settingService->changeCollectionSetting($name, $value, $moduleId); + return $this->moduleSettingService->changeCollectionSetting($name, $value, $moduleId); } /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") * @return SettingType[] */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getModuleSettingsList(string $moduleId): array { - return $this->settingService->getSettingsList($moduleId); + return $this->moduleSettingService->getSettingsList($moduleId); } } diff --git a/src/Setting/Controller/ShopSettingController.php b/src/Setting/Controller/ShopSettingController.php index 755a9a6..94dfecc 100644 --- a/src/Setting/Controller/ShopSettingController.php +++ b/src/Setting/Controller/ShopSettingController.php @@ -17,96 +17,82 @@ final class ShopSettingController { public function __construct( - private ShopSettingServiceInterface $settingService + private ShopSettingServiceInterface $shopSettingService ) { } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingInteger(ID $name): IntegerSetting { - return $this->settingService->getIntegerSetting($name); + return $this->shopSettingService->getIntegerSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingFloat(ID $name): FloatSetting { - return $this->settingService->getFloatSetting($name); + return $this->shopSettingService->getFloatSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingBoolean(ID $name): BooleanSetting { - return $this->settingService->getBooleanSetting($name); + return $this->shopSettingService->getBooleanSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingString(ID $name): StringSetting { - return $this->settingService->getStringSetting($name); + return $this->shopSettingService->getStringSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingSelect(ID $name): StringSetting { - return $this->settingService->getSelectSetting($name); + return $this->shopSettingService->getSelectSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingCollection(ID $name): StringSetting { - return $this->settingService->getCollectionSetting($name); + return $this->shopSettingService->getCollectionSetting($name); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingAssocCollection(ID $name): StringSetting { - return $this->settingService->getAssocCollectionSetting($name); + return $this->shopSettingService->getAssocCollectionSetting($name); } /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") * @return SettingType[] */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getShopSettingsList(): array { - return $this->settingService->getSettingsList(); + return $this->shopSettingService->getSettingsList(); } } diff --git a/src/Setting/Controller/ThemeSettingController.php b/src/Setting/Controller/ThemeSettingController.php index 911aed1..b03ffac 100644 --- a/src/Setting/Controller/ThemeSettingController.php +++ b/src/Setting/Controller/ThemeSettingController.php @@ -18,173 +18,145 @@ final class ThemeSettingController { public function __construct( - private ThemeSettingServiceInterface $settingService + private ThemeSettingServiceInterface $themeSettingService ) { } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingInteger(ID $name, string $themeId): IntegerSetting { - return $this->settingService->getIntegerSetting($name, $themeId); + return $this->themeSettingService->getIntegerSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingFloat(ID $name, string $themeId): FloatSetting { - return $this->settingService->getFloatSetting($name, $themeId); + return $this->themeSettingService->getFloatSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingBoolean(ID $name, string $themeId): BooleanSetting { - return $this->settingService->getBooleanSetting($name, $themeId); + return $this->themeSettingService->getBooleanSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingString(ID $name, string $themeId): StringSetting { - return $this->settingService->getStringSetting($name, $themeId); + return $this->themeSettingService->getStringSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingSelect(ID $name, string $themeId): StringSetting { - return $this->settingService->getSelectSetting($name, $themeId); + return $this->themeSettingService->getSelectSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingCollection(ID $name, string $themeId): StringSetting { - return $this->settingService->getCollectionSetting($name, $themeId); + return $this->themeSettingService->getCollectionSetting($name, $themeId); } - /** - * @Query() - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingAssocCollection(ID $name, string $themeId): StringSetting { - return $this->settingService->getAssocCollectionSetting($name, $themeId); + return $this->themeSettingService->getAssocCollectionSetting($name, $themeId); } /** - * @Query - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") * @return SettingType[] */ + #[Query] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function getThemeSettingsList(string $themeId): array { - return $this->settingService->getSettingsList($themeId); + return $this->themeSettingService->getSettingsList($themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingInteger(ID $name, int $value, string $themeId): IntegerSetting { - return $this->settingService->changeIntegerSetting($name, $value, $themeId); + return $this->themeSettingService->changeIntegerSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingFloat(ID $name, float $value, string $themeId): FloatSetting { - return $this->settingService->changeFloatSetting($name, $value, $themeId); + return $this->themeSettingService->changeFloatSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingBoolean(ID $name, bool $value, string $themeId): BooleanSetting { - return $this->settingService->changeBooleanSetting($name, $value, $themeId); + return $this->themeSettingService->changeBooleanSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingString(ID $name, string $value, string $themeId): StringSetting { - return $this->settingService->changeStringSetting($name, $value, $themeId); + return $this->themeSettingService->changeStringSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingSelect(ID $name, string $value, string $themeId): StringSetting { - return $this->settingService->changeSelectSetting($name, $value, $themeId); + return $this->themeSettingService->changeSelectSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingCollection(ID $name, string $value, string $themeId): StringSetting { - return $this->settingService->changeCollectionSetting($name, $value, $themeId); + return $this->themeSettingService->changeCollectionSetting($name, $value, $themeId); } - /** - * @Mutation - * @Logged() - * @HideIfUnauthorized() - * @Right("CHANGE_CONFIGURATION") - */ + #[Mutation] + #[Logged] + #[HideIfUnauthorized] + #[Right('CHANGE_CONFIGURATION')] public function changeThemeSettingAssocCollection(ID $name, string $value, string $themeId): StringSetting { - return $this->settingService->changeAssocCollectionSetting($name, $value, $themeId); + return $this->themeSettingService->changeAssocCollectionSetting($name, $value, $themeId); } }