mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
Use match statement in richToParsed implementation
Co-authored-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
6fc224dfce
commit
e884ffd4c8
1 changed files with 5 additions and 7 deletions
|
|
@ -59,13 +59,11 @@ class SetupChecks extends Base {
|
|||
throw new \InvalidArgumentException("Invalid rich object, {$requiredField} field is missing");
|
||||
}
|
||||
}
|
||||
if ($parameter['type'] === 'user') {
|
||||
$replacements[] = '@' . $parameter['name'];
|
||||
} elseif ($parameter['type'] === 'file') {
|
||||
$replacements[] = $parameter['path'] ?? $parameter['name'];
|
||||
} else {
|
||||
$replacements[] = $parameter['name'];
|
||||
}
|
||||
$replacements[] = match($parameter['type']) {
|
||||
'user' => '@' . $parameter['name'],
|
||||
'file' => $parameter['path'] ?? $parameter['name'],
|
||||
default => $parameter['name'],
|
||||
};
|
||||
}
|
||||
return str_replace($placeholders, $replacements, $message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue