l10n->t('Allowed admin IP ranges'); } public function run(): SetupResult { $allowedAdminRanges = $this->config->getSystemValue(RemoteAddress::SETTING_NAME, false); if ( $allowedAdminRanges === false || (is_array($allowedAdminRanges) && empty($allowedAdminRanges)) ) { return SetupResult::success($this->l10n->t('Admin IP filtering isn’t applied.')); } if (!is_array($allowedAdminRanges)) { return SetupResult::error( $this->l10n->t( 'Configuration key "%1$s" expects an array (%2$s found). Admin IP range validation will not be applied.', [RemoteAddress::SETTING_NAME, gettype($allowedAdminRanges)], ) ); } $invalidRanges = array_filter($allowedAdminRanges, static fn (mixed $range): bool => !is_string($range) || !Range::isValid($range)); if (!empty($invalidRanges)) { return SetupResult::warning( $this->l10n->t( 'Configuration key "%1$s" contains invalid IP range(s): "%2$s"', [RemoteAddress::SETTING_NAME, implode('", "', $invalidRanges)], ), ); } return SetupResult::success($this->l10n->t('Admin IP filtering is correctly configured.')); } }