Code Duplication    Length = 16-16 lines in 2 locations

apps/dav/lib/CalDAV/CalDavBackend.php 1 location

@@ 2077-2092 (lines=16) @@
2074
	 * @param string $uri
2075
	 * @return int
2076
	 */
2077
	protected function getCalendarObjectId($calendarId, $uri) {
2078
		$query = $this->db->getQueryBuilder();
2079
		$query->select('id')->from('calendarobjects')
2080
			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
2081
			->andWhere($query->expr()->eq('calendarid', $query->createNamedParameter($calendarId)));
2082
2083
		$result = $query->execute();
2084
		$objectIds = $result->fetch();
2085
		$result->closeCursor();
2086
2087
		if (!isset($objectIds['id'])) {
2088
			throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri);
2089
		}
2090
2091
		return (int)$objectIds['id'];
2092
	}
2093
2094
	private function convertPrincipal($principalUri, $toV2) {
2095
		if ($this->principalBackend->getPrincipalPrefix() === 'principals') {

apps/dav/lib/CardDAV/CardDavBackend.php 1 location

@@ 1065-1080 (lines=16) @@
1062
	 * @param string $uri
1063
	 * @return int
1064
	 */
1065
	protected function getCardId($addressBookId, $uri) {
1066
		$query = $this->db->getQueryBuilder();
1067
		$query->select('id')->from($this->dbCardsTable)
1068
			->where($query->expr()->eq('uri', $query->createNamedParameter($uri)))
1069
			->andWhere($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId)));
1070
1071
		$result = $query->execute();
1072
		$cardIds = $result->fetch();
1073
		$result->closeCursor();
1074
1075
		if (!isset($cardIds['id'])) {
1076
			throw new \InvalidArgumentException('Card does not exists: ' . $uri);
1077
		}
1078
1079
		return (int)$cardIds['id'];
1080
	}
1081
1082
	/**
1083
	 * For shared address books the sharee is set in the ACL of the address book