Code Duplication    Length = 12-16 lines in 2 locations

includes/Revision.php 2 locations

@@ 125-140 (lines=16) @@
122
	 * @param int $flags Bitfield (optional)
123
	 * @return Revision|null
124
	 */
125
	public static function newFromTitle( LinkTarget $linkTarget, $id = 0, $flags = 0 ) {
126
		$conds = [
127
			'page_namespace' => $linkTarget->getNamespace(),
128
			'page_title' => $linkTarget->getDBkey()
129
		];
130
		if ( $id ) {
131
			// Use the specified ID
132
			$conds['rev_id'] = $id;
133
			return self::newFromConds( $conds, $flags );
134
		} else {
135
			// Use a join to get the latest revision
136
			$conds[] = 'rev_id=page_latest';
137
			$db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
138
			return self::loadFromConds( $db, $conds, $flags );
139
		}
140
	}
141
142
	/**
143
	 * Load either the current, or a specified, revision
@@ 156-167 (lines=12) @@
153
	 * @param int $flags Bitfield (optional)
154
	 * @return Revision|null
155
	 */
156
	public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
157
		$conds = [ 'page_id' => $pageId ];
158
		if ( $revId ) {
159
			$conds['rev_id'] = $revId;
160
			return self::newFromConds( $conds, $flags );
161
		} else {
162
			// Use a join to get the latest revision
163
			$conds[] = 'rev_id = page_latest';
164
			$db = wfGetDB( ( $flags & self::READ_LATEST ) ? DB_MASTER : DB_REPLICA );
165
			return self::loadFromConds( $db, $conds, $flags );
166
		}
167
	}
168
169
	/**
170
	 * Make a fake revision object from an archive table row. This is queried