p28
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user