Code Duplication    Length = 4-4 lines in 4 locations

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

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