Code Duplication    Length = 12-16 lines in 2 locations

includes/Revision.php 2 locations

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