Code Duplication    Length = 11-11 lines in 3 locations

includes/api/ApiMergeHistory.php 2 locations

@@ 42-52 (lines=11) @@
39
		$this->requireOnlyOneParameter( $params, 'to', 'toid' );
40
41
		// Get page objects (nonexistant pages get caught in MergeHistory::isValidMerge())
42
		if ( isset( $params['from'] ) ) {
43
			$fromTitle = Title::newFromText( $params['from'] );
44
			if ( !$fromTitle || $fromTitle->isExternal() ) {
45
				$this->dieUsageMsg( [ 'invalidtitle', $params['from'] ] );
46
			}
47
		} elseif ( isset( $params['fromid'] ) ) {
48
			$fromTitle = Title::newFromID( $params['fromid'] );
49
			if ( !$fromTitle ) {
50
				$this->dieUsageMsg( [ 'nosuchpageid', $params['fromid'] ] );
51
			}
52
		}
53
54
		if ( isset( $params['to'] ) ) {
55
			$toTitle = Title::newFromText( $params['to'] );
@@ 54-64 (lines=11) @@
51
			}
52
		}
53
54
		if ( isset( $params['to'] ) ) {
55
			$toTitle = Title::newFromText( $params['to'] );
56
			if ( !$toTitle || $toTitle->isExternal() ) {
57
				$this->dieUsageMsg( [ 'invalidtitle', $params['to'] ] );
58
			}
59
		} elseif ( isset( $params['toid'] ) ) {
60
			$toTitle = Title::newFromID( $params['toid'] );
61
			if ( !$toTitle ) {
62
				$this->dieUsageMsg( [ 'nosuchpageid', $params['toid'] ] );
63
			}
64
		}
65
66
		$reason = $params['reason'];
67
		$timestamp = $params['timestamp'];

includes/api/ApiMove.php 1 location

@@ 41-51 (lines=11) @@
38
39
		$this->requireOnlyOneParameter( $params, 'from', 'fromid' );
40
41
		if ( isset( $params['from'] ) ) {
42
			$fromTitle = Title::newFromText( $params['from'] );
43
			if ( !$fromTitle || $fromTitle->isExternal() ) {
44
				$this->dieUsageMsg( [ 'invalidtitle', $params['from'] ] );
45
			}
46
		} elseif ( isset( $params['fromid'] ) ) {
47
			$fromTitle = Title::newFromID( $params['fromid'] );
48
			if ( !$fromTitle ) {
49
				$this->dieUsageMsg( [ 'nosuchpageid', $params['fromid'] ] );
50
			}
51
		}
52
53
		if ( !$fromTitle->exists() ) {
54
			$this->dieUsageMsg( 'notanarticle' );