Code Duplication    Length = 8-14 lines in 3 locations

lib/Db/CircleProviderRequestBuilder.php 3 locations

@@ 220-227 (lines=8) @@
217
		$expr = $qb->expr();
218
219
		// TODO - Remove this in 12.0.1
220
		if ($qb->getConnection()
221
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
222
		) {
223
			$tmpOrX = $expr->eq('s.share_with', $qb->createFunction('CAST(c.id AS TEXT)'));
224
		} else {
225
			$tmpOrX =
226
				$expr->eq('s.share_with', $expr->castColumn('c.id', IQueryBuilder::PARAM_STR));
227
		}
228
229
		$qb->from(CoreRequestBuilder::TABLE_CIRCLES, 'c');
230
@@ 318-326 (lines=9) @@
315
	protected function leftJoinShareInitiator(IQueryBuilder &$qb) {
316
		$expr = $qb->expr();
317
318
		if ($qb->getConnection()
319
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
320
		) {
321
			$req = $expr->eq('s.share_with', $qb->createFunction('CAST(fo.circle_id AS TEXT)'));
322
		} else {
323
			$req = $expr->eq(
324
				's.share_with', $expr->castColumn('fo.circle_id', IQueryBuilder::PARAM_STR)
325
			);
326
		}
327
328
		$qb->leftJoin(
329
			's', 'circles_members', 'fo', $expr->andX(
@@ 349-362 (lines=14) @@
346
		$qb->from(CoreRequestBuilder::TABLE_MEMBERS, 'm');
347
348
		// TODO - Remove this in 12.0.1
349
		if ($qb->getConnection()
350
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
351
		) {
352
			$qb->andWhere(
353
				$expr->eq('s.share_with', $qb->createFunction('CAST(m.circle_id AS TEXT)'))
354
			);
355
		} else {
356
357
			$qb->andWhere(
358
				$expr->eq(
359
					's.share_with', $expr->castColumn('m.circle_id', IQueryBuilder::PARAM_STR)
360
				)
361
			);
362
		}
363
	}
364
365