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

@@ 1386-1390 (lines=5) @@
1383
		}
1384
		$innerQuery->andWhere($or);
1385
1386
		if ($pattern !== '') {
1387
			$innerQuery->andWhere($innerQuery->expr()->iLike('op.value',
1388
				$outerQuery->createNamedParameter('%' .
1389
					$this->db->escapeLikeParameter($pattern) . '%')));
1390
		}
1391
1392
		$outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
1393
			->from('calendarobjects', 'c');