aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments
diff options
context:
space:
mode:
authorFaraz Samapoor <f.samapoor@gmail.com>2023-06-02 14:28:29 +0330
committerSimon L <szaimen@e.mail.de>2023-06-12 09:45:12 +0200
commit7e33e5973065d6a206514d071ff96c24a6300361 (patch)
tree2ee4091e383d8b6827483793d30523a02ce06fe7 /apps/comments
parentc93be182dc0172eed377ba70ce54cd7c83689764 (diff)
downloadnextcloud-server-7e33e5973065d6a206514d071ff96c24a6300361.tar.gz
nextcloud-server-7e33e5973065d6a206514d071ff96c24a6300361.zip
Refactors "strpos" calls in /apps/comments to improve code readability.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Diffstat (limited to 'apps/comments')
-rw-r--r--apps/comments/lib/Activity/Provider.php2
-rw-r--r--apps/comments/lib/Notification/Notifier.php4
2 files changed, 3 insertions, 3 deletions
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php
index f9a5971c7f3..8e65732f4a7 100644
--- a/apps/comments/lib/Activity/Provider.php
+++ b/apps/comments/lib/Activity/Provider.php
@@ -182,7 +182,7 @@ class Provider implements IProvider {
}
$message = str_replace('@"' . $mention['id'] . '"', '{mention' . $mentionCount . '}', $message);
- if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) {
+ if (!str_contains($mention['id'], ' ') && !str_starts_with($mention['id'], 'guest/')) {
$message = str_replace('@' . $mention['id'], '{mention' . $mentionCount . '}', $message);
}
diff --git a/apps/comments/lib/Notification/Notifier.php b/apps/comments/lib/Notification/Notifier.php
index 59f1ad5da5f..aa3f9ba6824 100644
--- a/apps/comments/lib/Notification/Notifier.php
+++ b/apps/comments/lib/Notification/Notifier.php
@@ -118,7 +118,7 @@ class Notifier implements INotifier {
$node = $nodes[0];
$path = rtrim($node->getPath(), '/');
- if (strpos($path, '/' . $notification->getUser() . '/files/') === 0) {
+ if (str_starts_with($path, '/' . $notification->getUser() . '/files/')) {
// Remove /user/files/...
$fullPath = $path;
[,,, $path] = explode('/', $fullPath, 4);
@@ -182,7 +182,7 @@ class Notifier implements INotifier {
// index of the mentions of that type.
$mentionParameterId = 'mention-' . $mention['type'] . $mentionTypeCount[$mention['type']];
$message = str_replace('@"' . $mention['id'] . '"', '{' . $mentionParameterId . '}', $message);
- if (strpos($mention['id'], ' ') === false && strpos($mention['id'], 'guest/') !== 0) {
+ if (!str_contains($mention['id'], ' ') && !str_starts_with($mention['id'], 'guest/')) {
$message = str_replace('@' . $mention['id'], '{' . $mentionParameterId . '}', $message);
}