Code Duplication    Length = 15-19 lines in 2 locations

includes/user/User.php 2 locations

@@ 1362-1376 (lines=15) @@
1359
	/**
1360
	 * Load the groups from the database if they aren't already loaded.
1361
	 */
1362
	private function loadGroups() {
1363
		if ( is_null( $this->mGroups ) ) {
1364
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
1365
				? wfGetDB( DB_MASTER )
1366
				: wfGetDB( DB_SLAVE );
1367
			$res = $db->select( 'user_groups',
1368
				[ 'ug_group' ],
1369
				[ 'ug_user' => $this->mId ],
1370
				__METHOD__ );
1371
			$this->mGroups = [];
1372
			foreach ( $res as $row ) {
1373
				$this->mGroups[] = $row->ug_group;
1374
			}
1375
		}
1376
	}
1377
1378
	/**
1379
	 * Add the user to the group if he/she meets given criteria.
@@ 3338-3356 (lines=19) @@
3335
	 *
3336
	 * @return array Names of the groups the user has belonged to.
3337
	 */
3338
	public function getFormerGroups() {
3339
		$this->load();
3340
3341
		if ( is_null( $this->mFormerGroups ) ) {
3342
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
3343
				? wfGetDB( DB_MASTER )
3344
				: wfGetDB( DB_SLAVE );
3345
			$res = $db->select( 'user_former_groups',
3346
				[ 'ufg_group' ],
3347
				[ 'ufg_user' => $this->mId ],
3348
				__METHOD__ );
3349
			$this->mFormerGroups = [];
3350
			foreach ( $res as $row ) {
3351
				$this->mFormerGroups[] = $row->ufg_group;
3352
			}
3353
		}
3354
3355
		return $this->mFormerGroups;
3356
	}
3357
3358
	/**
3359
	 * Get the user's edit count.