This commit is contained in:
team 1
2026-05-04 08:38:53 +02:00
parent c5e212f8f2
commit c00cb3a9b9
16 changed files with 482 additions and 88 deletions

View File

@@ -132,6 +132,48 @@ final class GovernanceConfig
return $this->requiredStringList('language.protected_stopword_terms');
}
/** @return string[] */
public function getLanguageRequiredCleanupProfiles(): array
{
return $this->requiredStringList('language.required_cleanup_profiles');
}
/** @return array<string, array{stopwords:string[], phrases:string[], meta_terms:string[]}> */
public function getLanguageRequiredProfileTerms(): array
{
$value = $this->requiredValue('language.required_profile_terms');
if (!is_array($value)) {
throw $this->invalid('language.required_profile_terms', 'must be a map of cleanup profile term lists');
}
$out = [];
foreach ($value as $profileName => $profileTerms) {
if (!is_string($profileName) || trim($profileName) === '' || !is_array($profileTerms)) {
throw $this->invalid('language.required_profile_terms', 'must be keyed by non-empty cleanup profile names');
}
$normalizedProfileName = trim($profileName);
$out[$normalizedProfileName] = [
'stopwords' => $this->normalizeStringList($profileTerms['stopwords'] ?? []),
'phrases' => $this->normalizeStringList($profileTerms['phrases'] ?? []),
'meta_terms' => $this->normalizeStringList($profileTerms['meta_terms'] ?? []),
];
if ($out[$normalizedProfileName]['stopwords'] === []
&& $out[$normalizedProfileName]['phrases'] === []
&& $out[$normalizedProfileName]['meta_terms'] === []
) {
throw $this->invalid('language.required_profile_terms.' . $normalizedProfileName, 'must contain at least one required term');
}
}
if ($out === []) {
throw $this->invalid('language.required_profile_terms', 'must contain at least one cleanup profile');
}
return $out;
}
/** @return string[] */
public function getCorePatternAuditSourceRoots(): array
{