Code Duplication    Length = 8-14 lines in 4 locations

lib/Db/CircleProviderRequestBuilder.php 4 locations

@@ 221-228 (lines=8) @@
218
		$expr = $qb->expr();
219
220
		// TODO - Remove this in 12.0.1
221
		if ($qb->getConnection()
222
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
223
		) {
224
			$tmpOrX = $expr->eq('s.share_with', $qb->createFunction('CAST(c.id AS TEXT)'));
225
		} else {
226
			$tmpOrX =
227
				$expr->eq('s.share_with', $expr->castColumn('c.id', IQueryBuilder::PARAM_STR));
228
		}
229
230
		$qb->from(CoreRequestBuilder::TABLE_CIRCLES, 'c');
231
@@ 309-317 (lines=9) @@
306
307
308
		// Circle member
309
		if ($qb->getConnection()
310
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
311
		) {
312
			$req = $expr->eq('s.share_with', $qb->createFunction('CAST(fo.circle_id AS TEXT)'));
313
		} else {
314
			$req = $expr->eq(
315
				's.share_with', $expr->castColumn('src_m.circle_id', IQueryBuilder::PARAM_STR)
316
			);
317
		}
318
319
		$qb->selectAlias('src_m.level', 'initiator_circle_level');
320
		$qb->leftJoin(
@@ 329-337 (lines=9) @@
326
327
328
		// group member
329
		if ($qb->getConnection()
330
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
331
		) {
332
			$req = $expr->eq('s.share_with', $qb->createFunction('CAST(src_g.circle_id AS TEXT)'));
333
		} else {
334
			$req = $expr->eq(
335
				's.share_with', $expr->castColumn('src_g.circle_id', IQueryBuilder::PARAM_STR)
336
			);
337
		}
338
339
		$qb->selectAlias('src_g.level', 'initiator_group_level');
340
		$qb->leftJoin(
@@ 366-379 (lines=14) @@
363
		$qb->from(CoreRequestBuilder::TABLE_MEMBERS, 'm');
364
365
		// TODO - Remove this in 12.0.1
366
		if ($qb->getConnection()
367
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
368
		) {
369
			$qb->andWhere(
370
				$expr->eq('s.share_with', $qb->createFunction('CAST(m.circle_id AS TEXT)'))
371
			);
372
		} else {
373
374
			$qb->andWhere(
375
				$expr->eq(
376
					's.share_with', $expr->castColumn('m.circle_id', IQueryBuilder::PARAM_STR)
377
				)
378
			);
379
		}
380
	}
381
382