Code Duplication    Length = 4-4 lines in 4 locations

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

@@ 277-280 (lines=4) @@
274
			return new \OC\OCS\Result(null, 404, 'could not delete share');
275
		}
276
277
		if (!$this->canAccessShare($share)) {
278
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
279
			return new \OC\OCS\Result(null, 404, $this->l->t('Could not delete share'));
280
		}
281
282
		$this->shareManager->deleteShare($share);
283
@@ 478-481 (lines=4) @@
475
476
			$share->setSharedWith($shareWith);
477
			$share->setPermissions($permissions);
478
		} else {
479
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
480
			return new \OC\OCS\Result(null, 400, $this->l->t('Unknown share type'));
481
		}
482
483
		$share->setShareType($shareType);
484
		$share->setSharedBy($this->currentUser->getUID());
@@ 685-688 (lines=4) @@
682
683
		$share->getNode()->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
684
685
		if (!$this->canAccessShare($share)) {
686
			$share->getNode()->unlock(ILockingProvider::LOCK_SHARED);
687
			return new \OC\OCS\Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
688
		}
689
690
		$permissions = $this->request->getParam('permissions', null);
691
		$password = $this->request->getParam('password', null);
@@ 880-883 (lines=4) @@
877
		$node->lock(\OCP\Lock\ILockingProvider::LOCK_SHARED);
878
879
		// this checks that we are either the owner or recipient
880
		if (!$this->canAccessShare($share)) {
881
			$node->unlock(ILockingProvider::LOCK_SHARED);
882
			return new \OC\OCS\Result(null, 404, $this->l->t('Wrong share ID, share doesn\'t exist'));
883
		}
884
885
		// only recipient can accept/reject share
886
		if ($share->getShareOwner() === $this->currentUser->getUID() ||