diff options
author | Hamid Dehnavi <hamid.dev.pro@gmail.com> | 2023-07-07 04:45:34 +0330 |
---|---|---|
committer | Faraz Samapoor <f.samapoor@gmail.com> | 2023-09-27 20:36:23 +0330 |
commit | df0a396b4cfcd0834eb056a0c4190d65c8496ae7 (patch) | |
tree | ae840927212a03d3645b3b5d7e7f96df586e61d5 | |
parent | f934d23cf2a1b5446f38c8569fef5b1346130daf (diff) | |
download | nextcloud-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.php | 4 |
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(); |