Code Duplication    Length = 11-13 lines in 2 locations

includes/auth/AuthManager.php 2 locations

@@ 1142-1152 (lines=11) @@
1139
1140
			// Permissions check
1141
			$status = $this->checkAccountCreatePermissions( $creator );
1142
			if ( !$status->isGood() ) {
1143
				$this->logger->debug( __METHOD__ . ': {creator} cannot create users: {reason}', [
1144
					'user' => $user->getName(),
1145
					'creator' => $creator->getName(),
1146
					'reason' => $status->getWikiText( null, null, 'en' )
1147
				] );
1148
				$ret = AuthenticationResponse::newFail( $status->getMessage() );
1149
				$this->callMethodOnProviders( 7, 'postAccountCreation', [ $user, $creator, $ret ] );
1150
				$session->remove( 'AuthManager::accountCreationState' );
1151
				return $ret;
1152
			}
1153
1154
			// Load from master for existence check
1155
			$user->load( User::READ_LOCKING );
@@ 1195-1207 (lines=13) @@
1192
			foreach ( $state['reqs'] as $req ) {
1193
				if ( $req instanceof UserDataAuthenticationRequest ) {
1194
					$status = $req->populateUser( $user );
1195
					if ( !$status->isGood() ) {
1196
						// This should never happen...
1197
						$status = Status::wrap( $status );
1198
						$this->logger->debug( __METHOD__ . ': UserData is invalid: {reason}', [
1199
							'user' => $user->getName(),
1200
							'creator' => $creator->getName(),
1201
							'reason' => $status->getWikiText( null, null, 'en' ),
1202
						] );
1203
						$ret = AuthenticationResponse::newFail( $status->getMessage() );
1204
						$this->callMethodOnProviders( 7, 'postAccountCreation', [ $user, $creator, $ret ] );
1205
						$session->remove( 'AuthManager::accountCreationState' );
1206
						return $ret;
1207
					}
1208
				}
1209
			}
1210