Code Duplication    Length = 4-4 lines in 4 locations

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

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