diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index c93c92d0379..5651ce13315 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -14,20 +14,18 @@ use OCP\IConfig; use OCP\IRequest; -class SettingsController extends Controller -{ +class SettingsController extends Controller { public const ACCEPTED_KEYS = [ 'workspace_enabled', 'is_full_width_editor' ]; public function __construct( - string $appName, - IRequest $request, + string $appName, + IRequest $request, private IConfig $config, private ?string $userId, - ) - { + ) { parent::__construct($appName, $request); } @@ -37,8 +35,7 @@ public function __construct( * @psalm-return DataResponse<200|400, array{workspace_enabled?: mixed, is_full_width_editor?: mixed, message?: 'Invalid config key'}, array> */ #[NoAdminRequired] - public function updateConfig(string $key, int|string $value): DataResponse - { + public function updateConfig(string $key, int|string $value): DataResponse { if (!in_array($key, self::ACCEPTED_KEYS, true)) { return new DataResponse(['message' => 'Invalid config key'], Http::STATUS_BAD_REQUEST); } diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 74fb1fe9551..da3af31a768 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -11,49 +11,41 @@ use OCP\IAppConfig; use OCP\IConfig; -class ConfigService -{ +class ConfigService { public function __construct( private IAppConfig $appConfig, - private IConfig $config, - ) - { + private IConfig $config, + ) { } - public function getDefaultFileExtension(): string - { + public function getDefaultFileExtension(): string { return $this->appConfig->getValueString(Application::APP_NAME, 'default_file_extension', 'md'); } - public function isRichEditingEnabled(): bool - { + public function isRichEditingEnabled(): bool { return ($this->appConfig->getValueString(Application::APP_NAME, 'rich_editing_enabled', '1') === '1'); } - public function isRichWorkspaceAvailable(): bool - { + public function isRichWorkspaceAvailable(): bool { if ($this->config->getSystemValueBool('enable_non-accessible_features', true) === false) { return false; } return $this->appConfig->getValueString(Application::APP_NAME, 'workspace_available', '1') === '1'; } - public function isRichWorkspaceEnabledForUser(?string $userId): bool - { + public function isRichWorkspaceEnabledForUser(?string $userId): bool { if ($userId === null) { return true; } return $this->config->getUserValue($userId, Application::APP_NAME, 'workspace_enabled', '1') === '1'; } - public function isNotifyPushSyncEnabled(): bool - { + public function isNotifyPushSyncEnabled(): bool { return $this->appConfig->getValueBool(Application::APP_NAME, 'notify_push'); } - public function isFullWidthEditor(?string $userId): bool - { + public function isFullWidthEditor(?string $userId): bool { return $this->config->getUserValue($userId, Application::APP_NAME, 'is_full_width_editor', '0') === '1'; } } diff --git a/lib/Service/InitialStateProvider.php b/lib/Service/InitialStateProvider.php index 102e4bf6568..f8138f03574 100644 --- a/lib/Service/InitialStateProvider.php +++ b/lib/Service/InitialStateProvider.php @@ -11,8 +11,7 @@ use OCP\TaskProcessing\IManager; use OCP\Translation\ITranslationManager; -class InitialStateProvider -{ +class InitialStateProvider { private const ASSISTANT_TASK_TYPES = [ 'core:text2text', 'core:text2text:formalization', @@ -24,17 +23,15 @@ class InitialStateProvider ]; public function __construct( - private IInitialState $initialState, - private ConfigService $configService, + private IInitialState $initialState, + private ConfigService $configService, private ITranslationManager $translationManager, - private IManager $taskProcessingManager, - private ?string $userId, - ) - { + private IManager $taskProcessingManager, + private ?string $userId, + ) { } - public function provideState(): void - { + public function provideState(): void { $this->initialState->provideInitialState( 'workspace_available', $this->configService->isRichWorkspaceAvailable() @@ -87,18 +84,15 @@ public function provideState(): void ); } - public function provideFileId(int $fileId): void - { + public function provideFileId(int $fileId): void { $this->initialState->provideInitialState('file_id', $fileId); } - public function provideFile(array $fileData): void - { + public function provideFile(array $fileData): void { $this->initialState->provideInitialState('file', $fileData); } - public function provideDirectEditToken(string $token): void - { + public function provideDirectEditToken(string $token): void { $this->initialState->provideInitialState('directEditingToken', $token); } }