Code Duplication    Length = 8-14 lines in 3 locations

lib/Db/CircleProviderRequestBuilder.php 3 locations

@@ 351-358 (lines=8) @@
348
349
350
		// Circle member
351
		if ($qb->getConnection()
352
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
353
		) {
354
			$req = $expr->eq('s.share_with', $qb->createFunction('CAST(fo.circle_id AS TEXT)'));
355
		} else {
356
			$req = $expr->eq(
357
				's.share_with', $expr->castColumn('src_m.circle_id', IQueryBuilder::PARAM_STR)
358
			);
359
		}
360
361
		$qb->selectAlias('src_m.level', 'initiator_circle_level');
@@ 373-381 (lines=9) @@
370
371
372
		// group member
373
		if ($qb->getConnection()
374
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
375
		) {
376
			$req = $expr->eq('s.share_with', $qb->createFunction('CAST(src_g.circle_id AS TEXT)'));
377
		} else {
378
			$req = $expr->eq(
379
				's.share_with', $expr->castColumn('src_g.circle_id', IQueryBuilder::PARAM_STR)
380
			);
381
		}
382
383
		$qb->selectAlias('src_g.level', 'initiator_group_level');
384
		$qb->leftJoin(
@@ 411-424 (lines=14) @@
408
		$qb->from(CoreRequestBuilder::TABLE_MEMBERS, 'm');
409
410
		// TODO - Remove this in 12.0.1
411
		if ($qb->getConnection()
412
			   ->getDatabasePlatform() instanceof PostgreSqlPlatform
413
		) {
414
			$qb->andWhere(
415
				$expr->eq('s.share_with', $qb->createFunction('CAST(m.circle_id AS TEXT)'))
416
			);
417
		} else {
418
419
			$qb->andWhere(
420
				$expr->eq(
421
					's.share_with', $expr->castColumn('m.circle_id', IQueryBuilder::PARAM_STR)
422
				)
423
			);
424
		}
425
	}
426
427