Code Duplication    Length = 9-10 lines in 2 locations

apps/federatedfilesharing/lib/Controller/RequestHandlerController.php 1 location

@@ 393-402 (lines=10) @@
390
	 * @throws Share\Exceptions\ShareNotFound
391
	 * @throws InvalidShareException
392
	 */
393
	protected function getValidShare($id) {
394
		$share = $this->federatedShareProvider->getShareById($id);
395
		$token = $this->request->getParam('token', null);
396
		if ($share->getShareType() !== FederatedShareProvider::SHARE_TYPE_REMOTE
397
			|| $share->getToken() !== $token
398
		) {
399
			throw new InvalidShareException();
400
		}
401
		return $share;
402
	}
403
404
	/**
405
	 * Make sure that incoming shares are enabled

apps/federatedfilesharing/lib/Controller/OcmController.php 1 location

@@ 420-428 (lines=9) @@
417
	 * @throws InvalidShareException
418
	 * @throws Share\Exceptions\ShareNotFound
419
	 */
420
	protected function getValidShare($id, $sharedSecret) {
421
		$share = $this->federatedShareProvider->getShareById($id);
422
		if ($share->getShareType() !== FederatedShareProvider::SHARE_TYPE_REMOTE
423
			|| $share->getToken() !== $sharedSecret
424
		) {
425
			// TODO: Split wrong token and wrong share type cases. Add a message
426
			throw new InvalidShareException();
427
		}
428
		return $share;
429
	}
430
431
	/**