From 50684fa3b04ad5fb0f754cb396ea6f6f26928388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 22 Sep 2025 17:55:26 +0200 Subject: [PATCH] chore: Cleanup settings manager constructor and properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/private/Settings/Manager.php | 78 ++++++++++---------------------- 1 file changed, 25 insertions(+), 53 deletions(-) diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 78dc64c3c3f..77623e135f4 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -23,53 +23,30 @@ use OCP\Settings\ISubAdminSettings; use Psr\Log\LoggerInterface; class Manager implements IManager { - /** @var LoggerInterface */ - private $log; - - /** @var IL10N */ - private $l; - - /** @var IFactory */ - private $l10nFactory; - - /** @var IURLGenerator */ - private $url; - - /** @var IServerContainer */ - private $container; - - /** @var AuthorizedGroupMapper $mapper */ - private $mapper; - - /** @var IGroupManager $groupManager */ - private $groupManager; - - /** @var ISubAdmin $subAdmin */ - private $subAdmin; - - public function __construct( - LoggerInterface $log, - IFactory $l10nFactory, - IURLGenerator $url, - IServerContainer $container, - AuthorizedGroupMapper $mapper, - IGroupManager $groupManager, - ISubAdmin $subAdmin, - ) { - $this->log = $log; - $this->l10nFactory = $l10nFactory; - $this->url = $url; - $this->container = $container; - $this->mapper = $mapper; - $this->groupManager = $groupManager; - $this->subAdmin = $subAdmin; - } + private ?IL10N $l = null; /** @var array>> */ - protected $sectionClasses = []; + protected array $sectionClasses = []; /** @var array> */ - protected $sections = []; + protected array $sections = []; + + /** @var array, self::SETTINGS_*> */ + protected array $settingClasses = []; + + /** @var array>> */ + protected array $settings = []; + + public function __construct( + private LoggerInterface $log, + private IFactory $l10nFactory, + private IURLGenerator $url, + private IServerContainer $container, + private AuthorizedGroupMapper $mapper, + private IGroupManager $groupManager, + private ISubAdmin $subAdmin, + ) { + } /** * @inheritdoc @@ -138,12 +115,6 @@ class Manager implements IManager { ], true); } - /** @var array, self::SETTINGS_*> */ - protected $settingClasses = []; - - /** @var array>> */ - protected $settings = []; - /** * @inheritdoc */ @@ -188,14 +159,15 @@ class Manager implements IManager { if ($filter !== null && !$filter($setting)) { continue; } - if ($setting->getSection() === null) { + $settingSection = $setting->getSection(); + if ($settingSection === null) { continue; } - if (!isset($this->settings[$settingsType][$setting->getSection()])) { - $this->settings[$settingsType][$setting->getSection()] = []; + if (!isset($this->settings[$settingsType][$settingSection])) { + $this->settings[$settingsType][$settingSection] = []; } - $this->settings[$settingsType][$setting->getSection()][] = $setting; + $this->settings[$settingsType][$settingSection][] = $setting; unset($this->settingClasses[$class]); }