Code Duplication    Length = 4-4 lines in 4 locations

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

@@ 281-284 (lines=4) @@
278
			return new \OC\OCS\Result(null, 404, 'could not delete share');
279
		}
280
281
		if (!$this->canAccessShare($share)) {
282
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
283
			return new \OC\OCS\Result(null, 404, $this->l->t('Could not delete share'));
284
		}
285
286
		$this->shareManager->deleteShare($share);
287
@@ 484-487 (lines=4) @@
481
482
			$share->setSharedWith($shareWith);
483
			$share->setPermissions($permissions);
484
		} else {
485
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
486
			return new \OC\OCS\Result(null, 400, $this->l->t('Unknown share type'));
487
		}
488
489
		$share->setShareType($shareType);
490
		$share->setSharedBy($this->currentUser->getUID());
@@ 695-698 (lines=4) @@
692
693
		$share->getNode()->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
694
695
		if (!$this->canAccessShare($share)) {
696
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
697
			return new \OC\OCS\Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
698
		}
699
700
		$permissions = $this->request->getParam('permissions', null);
701
		$password = $this->request->getParam('password', null);
@@ 894-897 (lines=4) @@
891
		$node->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
892
893
		// this checks that we are either the owner or recipient
894
		if (!$this->canAccessShare($share)) {
895
			$node->unlock(ILockingProvider::LOCK_SHARED);
896
			return new \OC\OCS\Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
897
		}
898
899
		// only recipient can accept/reject share
900
		if ($share->getShareOwner() === $this->currentUser->getUID() ||