aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Utils/PathHelper.php
diff options
context:
space:
mode:
authorFaraz Samapoor <fsamapoor@gmail.com>2023-05-15 15:17:19 +0330
committerFaraz Samapoor <fsamapoor@gmail.com>2023-05-15 15:17:19 +0330
commite7cc7653b885c49b1b3f0a78f91ea05a53e102d8 (patch)
tree42da61d5c6e988d7c9eff7e081327a73f661dc89 /lib/private/Files/Utils/PathHelper.php
parent8bdb50fd507bfe68161ab98eba903872083ea4f3 (diff)
downloadnextcloud-server-e7cc7653b885c49b1b3f0a78f91ea05a53e102d8.tar.gz
nextcloud-server-e7cc7653b885c49b1b3f0a78f91ea05a53e102d8.zip
Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
Diffstat (limited to 'lib/private/Files/Utils/PathHelper.php')
-rw-r--r--lib/private/Files/Utils/PathHelper.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/Files/Utils/PathHelper.php b/lib/private/Files/Utils/PathHelper.php
index 07985e884ce..0fb7ba663cc 100644
--- a/lib/private/Files/Utils/PathHelper.php
+++ b/lib/private/Files/Utils/PathHelper.php
@@ -37,7 +37,7 @@ class PathHelper {
}
if ($path === $root) {
return '/';
- } elseif (strpos($path, $root . '/') !== 0) {
+ } elseif (!str_starts_with($path, $root . '/')) {
return null;
} else {
$path = substr($path, strlen($root));
@@ -60,7 +60,7 @@ class PathHelper {
$path = '/' . $path;
}
//remove duplicate slashes
- while (strpos($path, '//') !== false) {
+ while (str_contains($path, '//')) {
$path = str_replace('//', '/', $path);
}
//remove trailing slash