Code Duplication    Length = 9-9 lines in 8 locations

includes/parser/CoreParserFunctions.php 8 locations

@@ 1160-1168 (lines=9) @@
1157
	 * @return int|null|string
1158
	 * @since 1.23
1159
	 */
1160
	public static function revisionid( $parser, $title = null ) {
1161
		$t = Title::newFromText( $title );
1162
		if ( is_null( $t ) ) {
1163
			return '';
1164
		}
1165
		// fetch revision from cache/database and return the value
1166
		$rev = self::getCachedRevisionObject( $parser, $t );
1167
		return $rev ? $rev->getId() : '';
1168
	}
1169
1170
	/**
1171
	 * Get the day from the last revision of a specified page.
@@ 1177-1185 (lines=9) @@
1174
	 * @return string
1175
	 * @since 1.23
1176
	 */
1177
	public static function revisionday( $parser, $title = null ) {
1178
		$t = Title::newFromText( $title );
1179
		if ( is_null( $t ) ) {
1180
			return '';
1181
		}
1182
		// fetch revision from cache/database and return the value
1183
		$rev = self::getCachedRevisionObject( $parser, $t );
1184
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'j' ) : '';
1185
	}
1186
1187
	/**
1188
	 * Get the day with leading zeros from the last revision of a specified page.
@@ 1194-1202 (lines=9) @@
1191
	 * @return string
1192
	 * @since 1.23
1193
	 */
1194
	public static function revisionday2( $parser, $title = null ) {
1195
		$t = Title::newFromText( $title );
1196
		if ( is_null( $t ) ) {
1197
			return '';
1198
		}
1199
		// fetch revision from cache/database and return the value
1200
		$rev = self::getCachedRevisionObject( $parser, $t );
1201
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'd' ) : '';
1202
	}
1203
1204
	/**
1205
	 * Get the month with leading zeros from the last revision of a specified page.
@@ 1211-1219 (lines=9) @@
1208
	 * @return string
1209
	 * @since 1.23
1210
	 */
1211
	public static function revisionmonth( $parser, $title = null ) {
1212
		$t = Title::newFromText( $title );
1213
		if ( is_null( $t ) ) {
1214
			return '';
1215
		}
1216
		// fetch revision from cache/database and return the value
1217
		$rev = self::getCachedRevisionObject( $parser, $t );
1218
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'm' ) : '';
1219
	}
1220
1221
	/**
1222
	 * Get the month from the last revision of a specified page.
@@ 1228-1236 (lines=9) @@
1225
	 * @return string
1226
	 * @since 1.23
1227
	 */
1228
	public static function revisionmonth1( $parser, $title = null ) {
1229
		$t = Title::newFromText( $title );
1230
		if ( is_null( $t ) ) {
1231
			return '';
1232
		}
1233
		// fetch revision from cache/database and return the value
1234
		$rev = self::getCachedRevisionObject( $parser, $t );
1235
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'n' ) : '';
1236
	}
1237
1238
	/**
1239
	 * Get the year from the last revision of a specified page.
@@ 1245-1253 (lines=9) @@
1242
	 * @return string
1243
	 * @since 1.23
1244
	 */
1245
	public static function revisionyear( $parser, $title = null ) {
1246
		$t = Title::newFromText( $title );
1247
		if ( is_null( $t ) ) {
1248
			return '';
1249
		}
1250
		// fetch revision from cache/database and return the value
1251
		$rev = self::getCachedRevisionObject( $parser, $t );
1252
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'Y' ) : '';
1253
	}
1254
1255
	/**
1256
	 * Get the timestamp from the last revision of a specified page.
@@ 1262-1270 (lines=9) @@
1259
	 * @return string
1260
	 * @since 1.23
1261
	 */
1262
	public static function revisiontimestamp( $parser, $title = null ) {
1263
		$t = Title::newFromText( $title );
1264
		if ( is_null( $t ) ) {
1265
			return '';
1266
		}
1267
		// fetch revision from cache/database and return the value
1268
		$rev = self::getCachedRevisionObject( $parser, $t );
1269
		return $rev ? MWTimestamp::getLocalInstance( $rev->getTimestamp() )->format( 'YmdHis' ) : '';
1270
	}
1271
1272
	/**
1273
	 * Get the user from the last revision of a specified page.
@@ 1279-1287 (lines=9) @@
1276
	 * @return string
1277
	 * @since 1.23
1278
	 */
1279
	public static function revisionuser( $parser, $title = null ) {
1280
		$t = Title::newFromText( $title );
1281
		if ( is_null( $t ) ) {
1282
			return '';
1283
		}
1284
		// fetch revision from cache/database and return the value
1285
		$rev = self::getCachedRevisionObject( $parser, $t );
1286
		return $rev ? $rev->getUserText() : '';
1287
	}
1288
1289
	/**
1290
	 * Returns the sources of any cascading protection acting on a specified page.