Refactor "substr" calls to improve code readability

Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
pull/39215/head
Hamid Dehnavi 2023-07-07 04:45:34 +07:00 committed by Faraz Samapoor
parent f934d23cf2
commit df0a396b4c
1 changed files with 2 additions and 2 deletions

@ -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();