Some code cleanup

This commit is contained in:
James Cole
2024-03-16 06:28:21 +01:00
parent 060c9648f1
commit 441a8a8408
3 changed files with 181 additions and 180 deletions

View File

@@ -109,12 +109,12 @@ class SearchRuleEngine implements RuleEngineInterface
continue;
}
$contextSearch = $ruleTrigger->trigger_type;
if(str_starts_with($ruleTrigger->trigger_type, '-')) {
if (str_starts_with($ruleTrigger->trigger_type, '-')) {
$contextSearch = substr($ruleTrigger->trigger_type, 1);
}
// if the trigger needs no context, value is different:
$needsContext = (bool)(config(sprintf('search.operators.%s.needs_context', $contextSearch)) ?? true);
$needsContext = (bool)(config(sprintf('search.operators.%s.needs_context', $contextSearch)) ?? true);
if (false === $needsContext) {
app('log')->debug(sprintf('SearchRuleEngine:: add a rule trigger (no context): %s:true', $ruleTrigger->trigger_type));
$searchArray[$ruleTrigger->trigger_type][] = 'true';