Code Duplication    Length = 24-24 lines in 2 locations

apps/sharebymail/lib/ShareByMailProvider.php 1 location

@@ 759-782 (lines=24) @@
756
	/**
757
	 * @inheritdoc
758
	 */
759
	public function getShareById($id, $recipientId = null) {
760
		$qb = $this->dbConnection->getQueryBuilder();
761
762
		$qb->select('*')
763
			->from('share')
764
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
765
			->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_EMAIL)));
766
767
		$cursor = $qb->execute();
768
		$data = $cursor->fetch();
769
		$cursor->closeCursor();
770
771
		if ($data === false) {
772
			throw new ShareNotFound();
773
		}
774
775
		try {
776
			$share = $this->createShareObject($data);
777
		} catch (InvalidShare $e) {
778
			throw new ShareNotFound();
779
		}
780
781
		return $share;
782
	}
783
784
	/**
785
	 * Get shares for a given path

apps/federatedfilesharing/lib/FederatedShareProvider.php 1 location

@@ 718-741 (lines=24) @@
715
	/**
716
	 * @inheritdoc
717
	 */
718
	public function getShareById($id, $recipientId = null) {
719
		$qb = $this->dbConnection->getQueryBuilder();
720
721
		$qb->select('*')
722
			->from('share')
723
			->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
724
			->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)));
725
726
		$cursor = $qb->execute();
727
		$data = $cursor->fetch();
728
		$cursor->closeCursor();
729
730
		if ($data === false) {
731
			throw new ShareNotFound('Can not find share with ID: ' . $id);
732
		}
733
734
		try {
735
			$share = $this->createShareObject($data);
736
		} catch (InvalidShare $e) {
737
			throw new ShareNotFound();
738
		}
739
740
		return $share;
741
	}
742
743
	/**
744
	 * Get shares for a given path