Code Duplication    Length = 21-21 lines in 2 locations

lib/Db/CirclesRequestBuilder.php 2 locations

@@ 261-281 (lines=21) @@
258
	 * @param IQueryBuilder $qb
259
	 * @param string $userId
260
	 */
261
	protected function leftJoinUserIdAsViewer(IQueryBuilder & $qb, $userId) {
262
263
		if ($qb->getType() !== QueryBuilder::SELECT) {
264
			return;
265
		}
266
267
		$expr = $qb->expr();
268
		$pf = $this->default_select_alias . '.';
269
270
		/** @noinspection PhpMethodParametersCountMismatchInspection */
271
		$qb->selectAlias('u.user_id', 'viewer_userid')
272
		   ->selectAlias('u.status', 'viewer_status')
273
		   ->selectAlias('u.level', 'viewer_level')
274
		   ->leftJoin(
275
			   $this->default_select_alias, CoreRequestBuilder::TABLE_MEMBERS, 'u',
276
			   $expr->andX(
277
				   $expr->eq($pf . 'id', 'u.circle_id'),
278
				   $expr->eq('u.user_id', $qb->createNamedParameter($userId))
279
			   )
280
		   );
281
	}
282
283
	/**
284
	 * Left Join members table to get the owner of the circle.
@@ 288-308 (lines=21) @@
285
	 *
286
	 * @param IQueryBuilder $qb
287
	 */
288
	protected function leftJoinOwner(IQueryBuilder & $qb) {
289
290
		if ($qb->getType() !== QueryBuilder::SELECT) {
291
			return;
292
		}
293
294
		$expr = $qb->expr();
295
		$pf = $this->default_select_alias . '.';
296
297
		/** @noinspection PhpMethodParametersCountMismatchInspection */
298
		$qb->selectAlias('o.user_id', 'owner_userid')
299
		   ->selectAlias('o.status', 'owner_status')
300
		   ->selectAlias('o.level', 'owner_level')
301
		   ->leftJoin(
302
			   $this->default_select_alias, CoreRequestBuilder::TABLE_MEMBERS, 'o',
303
			   $expr->andX(
304
				   $expr->eq($pf . 'id', 'o.circle_id'),
305
				   $expr->eq('o.level', $qb->createNamedParameter(Member::LEVEL_OWNER))
306
			   )
307
		   );
308
	}
309
310
311
	/**