aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHamid Dehnavi <hamid.dev.pro@gmail.com>2023-07-07 04:45:34 +0330
committerFaraz Samapoor <f.samapoor@gmail.com>2023-09-27 20:36:23 +0330
commitdf0a396b4cfcd0834eb056a0c4190d65c8496ae7 (patch)
treeae840927212a03d3645b3b5d7e7f96df586e61d5
parentf934d23cf2a1b5446f38c8569fef5b1346130daf (diff)
downloadnextcloud-server-df0a396b4cfcd0834eb056a0c4190d65c8496ae7.tar.gz
nextcloud-server-df0a396b4cfcd0834eb056a0c4190d65c8496ae7.zip
Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
-rw-r--r--apps/files/lib/Service/OwnershipTransferService.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/files/lib/Service/OwnershipTransferService.php b/apps/files/lib/Service/OwnershipTransferService.php
index 06c12391df7..808015ae322 100644
--- a/apps/files/lib/Service/OwnershipTransferService.php
+++ b/apps/files/lib/Service/OwnershipTransferService.php
@@ -447,7 +447,7 @@ class OwnershipTransferService {
$progress = new ProgressBar($output, count($sourceShares));
$prefix = "$destinationUid/files";
$finalShareTarget = '';
- if (substr($finalTarget, 0, strlen($prefix)) === $prefix) {
+ if (str_starts_with($finalTarget, $prefix)) {
$finalShareTarget = substr($finalTarget, strlen($prefix));
}
foreach ($sourceShares as $share) {
@@ -457,7 +457,7 @@ class OwnershipTransferService {
if (trim($path, '/') !== '') {
$pathToCheck = '/' . trim($path) . '/';
}
- if (substr($share->getTarget(), 0, strlen($pathToCheck)) !== $pathToCheck) {
+ if (!str_starts_with($share->getTarget(), $pathToCheck)) {
continue;
}
$shareTarget = $share->getTarget();