Code Duplication    Length = 15-19 lines in 2 locations

includes/user/User.php 2 locations

@@ 1373-1387 (lines=15) @@
1370
	/**
1371
	 * Load the groups from the database if they aren't already loaded.
1372
	 */
1373
	private function loadGroups() {
1374
		if ( is_null( $this->mGroups ) ) {
1375
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
1376
				? wfGetDB( DB_MASTER )
1377
				: wfGetDB( DB_SLAVE );
1378
			$res = $db->select( 'user_groups',
1379
				[ 'ug_group' ],
1380
				[ 'ug_user' => $this->mId ],
1381
				__METHOD__ );
1382
			$this->mGroups = [];
1383
			foreach ( $res as $row ) {
1384
				$this->mGroups[] = $row->ug_group;
1385
			}
1386
		}
1387
	}
1388
1389
	/**
1390
	 * Add the user to the group if he/she meets given criteria.
@@ 3206-3224 (lines=19) @@
3203
	 *
3204
	 * @return array Names of the groups the user has belonged to.
3205
	 */
3206
	public function getFormerGroups() {
3207
		$this->load();
3208
3209
		if ( is_null( $this->mFormerGroups ) ) {
3210
			$db = ( $this->queryFlagsUsed & self::READ_LATEST )
3211
				? wfGetDB( DB_MASTER )
3212
				: wfGetDB( DB_SLAVE );
3213
			$res = $db->select( 'user_former_groups',
3214
				[ 'ufg_group' ],
3215
				[ 'ufg_user' => $this->mId ],
3216
				__METHOD__ );
3217
			$this->mFormerGroups = [];
3218
			foreach ( $res as $row ) {
3219
				$this->mFormerGroups[] = $row->ufg_group;
3220
			}
3221
		}
3222
3223
		return $this->mFormerGroups;
3224
	}
3225
3226
	/**
3227
	 * Get the user's edit count.