Code Duplication    Length = 18-18 lines in 2 locations

includes/auth/LegacyHookPreAuthenticationProvider.php 2 locations

@@ 77-94 (lines=18) @@
74
	public function testForAccountCreation( $user, $creator, array $reqs ) {
75
		$abortError = '';
76
		$abortStatus = null;
77
		if ( !\Hooks::run( 'AbortNewAccount', [ $user, &$abortError, &$abortStatus ] ) ) {
78
			// Hook point to add extra creation throttles and blocks
79
			$this->logger->debug( __METHOD__ . ': a hook blocked creation' );
80
			if ( $abortStatus === null ) {
81
				// Report back the old string as a raw message status.
82
				// This will report the error back as 'createaccount-hook-aborted'
83
				// with the given string as the message.
84
				// To return a different error code, return a StatusValue object.
85
				$msg = wfMessage( 'createaccount-hook-aborted' )->rawParams( $abortError );
86
				return StatusValue::newFatal( $msg );
87
			} else {
88
				// For MediaWiki 1.23+ and updated hooks, return the Status object
89
				// returned from the hook.
90
				$ret = StatusValue::newGood();
91
				$ret->merge( $abortStatus );
92
				return $ret;
93
			}
94
		}
95
96
		return StatusValue::newGood();
97
	}
@@ 112-129 (lines=18) @@
109
		} else {
110
			$abortError = '';
111
			$abortStatus = null;
112
			if ( !\Hooks::run( 'AbortNewAccount', [ $user, &$abortError, &$abortStatus ] ) ) {
113
				// Hook point to add extra creation throttles and blocks
114
				$this->logger->debug( __METHOD__ . ': a hook blocked creation' );
115
				if ( $abortStatus === null ) {
116
					// Report back the old string as a raw message status.
117
					// This will report the error back as 'createaccount-hook-aborted'
118
					// with the given string as the message.
119
					// To return a different error code, return a StatusValue object.
120
					$msg = wfMessage( 'createaccount-hook-aborted' )->rawParams( $abortError );
121
					return StatusValue::newFatal( $msg );
122
				} else {
123
					// For MediaWiki 1.23+ and updated hooks, return the Status object
124
					// returned from the hook.
125
					$ret = StatusValue::newGood();
126
					$ret->merge( $abortStatus );
127
					return $ret;
128
				}
129
			}
130
		}
131
132
		return StatusValue::newGood();