Skip to content

Commit

Permalink
OXDEV-7557 Use attributes in Controllers
Browse files Browse the repository at this point in the history
It will make the automatic cleanup possible for earlier "not used" classes, that have been used in the docblocks.

Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Nov 15, 2023
1 parent 7780923 commit 39a7ba3
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 235 deletions.
132 changes: 56 additions & 76 deletions src/Setting/Controller/ModuleSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
96 changes: 41 additions & 55 deletions src/Setting/Controller/ShopSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Loading

0 comments on commit 39a7ba3

Please sign in to comment.