Code Duplication    Length = 4-4 lines in 4 locations

apps/files_sharing/lib/Controller/Share20OcsController.php 4 locations

@@ 285-288 (lines=4) @@
282
			return new Result(null, 404, 'could not delete share');
283
		}
284
285
		if (!$this->canAccessShare($share)) {
286
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
287
			return new Result(null, 404, $this->l->t('Could not delete share'));
288
		}
289
290
		$this->shareManager->deleteShare($share);
291
@@ 489-492 (lines=4) @@
486
487
			$share->setSharedWith($shareWith);
488
			$share->setPermissions($permissions);
489
		} else {
490
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
491
			return new Result(null, 400, $this->l->t('Unknown share type'));
492
		}
493
494
		$share->setShareType($shareType);
495
		$share->setSharedBy($this->currentUser->getUID());
@@ 702-705 (lines=4) @@
699
700
		$share->getNode()->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
701
702
		if (!$this->canAccessShare($share)) {
703
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
704
			return new Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
705
		}
706
707
		$permissions = $this->request->getParam('permissions', null);
708
		$password = $this->request->getParam('password', null);
@@ 998-1001 (lines=4) @@
995
		$node->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
996
997
		// this checks that we are either the owner or recipient
998
		if (!$this->canAccessShare($share)) {
999
			$node->unlock(ILockingProvider::LOCK_SHARED);
1000
			return new Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
1001
		}
1002
1003
		// only recipient can accept/reject share
1004
		if ($share->getShareOwner() === $this->currentUser->getUID() ||