aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-01-11 11:26:24 +0100
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-01-11 14:03:55 +0100
commite884ffd4c8046c3fd991ce56eee76b369aabc338 (patch)
treeefd6a4de8e2bc96cdcaa4af886f7c81544bbf619
parent6fc224dfce04122dc131aa9a900c2592cc2d8b4d (diff)
downloadnextcloud-server-e884ffd4c8046c3fd991ce56eee76b369aabc338.tar.gz
nextcloud-server-e884ffd4c8046c3fd991ce56eee76b369aabc338.zip
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>
-rw-r--r--core/Command/SetupChecks.php12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/Command/SetupChecks.php b/core/Command/SetupChecks.php
index ca39948de4e..e6e54fbcf22 100644
--- a/core/Command/SetupChecks.php
+++ b/core/Command/SetupChecks.php
@@ -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);
}