Code Duplication    Length = 15-19 lines in 2 locations

includes/user/User.php 2 locations

@@ 1376-1390 (lines=15) @@
1373
	/**
1374
	 * Load the groups from the database if they aren't already loaded.
1375
	 */
1376
	private function loadGroups() {
1377
		if ( is_null( $this->mGroups ) ) {
1378
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
1379
				? wfGetDB( DB_MASTER )
1380
				: wfGetDB( DB_SLAVE );
1381
			$res = $db->select( 'user_groups',
1382
				[ 'ug_group' ],
1383
				[ 'ug_user' => $this->mId ],
1384
				__METHOD__ );
1385
			$this->mGroups = [];
1386
			foreach ( $res as $row ) {
1387
				$this->mGroups[] = $row->ug_group;
1388
			}
1389
		}
1390
	}
1391
1392
	/**
1393
	 * Add the user to the group if he/she meets given criteria.
@@ 3255-3273 (lines=19) @@
3252
	 *
3253
	 * @return array Names of the groups the user has belonged to.
3254
	 */
3255
	public function getFormerGroups() {
3256
		$this->load();
3257
3258
		if ( is_null( $this->mFormerGroups ) ) {
3259
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
3260
				? wfGetDB( DB_MASTER )
3261
				: wfGetDB( DB_SLAVE );
3262
			$res = $db->select( 'user_former_groups',
3263
				[ 'ufg_group' ],
3264
				[ 'ufg_user' => $this->mId ],
3265
				__METHOD__ );
3266
			$this->mFormerGroups = [];
3267
			foreach ( $res as $row ) {
3268
				$this->mFormerGroups[] = $row->ufg_group;
3269
			}
3270
		}
3271
3272
		return $this->mFormerGroups;
3273
	}
3274
3275
	/**
3276
	 * Get the user's edit count.