Code Duplication    Length = 3-5 lines in 2 locations

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

@@ 903-905 (lines=3) @@
900
		$query2->andWhere($or);
901
902
		// No need for like when the pattern is empty
903
		if ('' !== $pattern) {
904
			$query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%')));
905
		}
906
907
		$query->select('c.carddata', 'c.uri')->from($this->dbCardsTable, 'c')
908
			->where($query->expr()->in('c.id', $query->createFunction($query2->getSQL())));

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

@@ 1413-1417 (lines=5) @@
1410
		}
1411
		$innerQuery->andWhere($or);
1412
1413
		if ($pattern !== '') {
1414
			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1415
				$outerQuery->createNamedParameter('%' .
1416
					$this->db->escapeLikeParameter($pattern) . '%')));
1417
		}
1418
1419
		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1420
			->from('calendarobjects', 'c');