Code Duplication    Length = 12-12 lines in 2 locations

projects/packages/changelogger/src/Config.php 2 locations

@@ 277-288 (lines=12) @@
274
	 * @return Formatter
275
	 * @throws \RuntimeException If the configured formatter is unknown.
276
	 */
277
	public static function formatterPlugin() {
278
		self::load();
279
		if ( ! isset( self::$cache['formatter'] ) ) {
280
			$obj = self::getPlugin( self::$config['formatter'], 'Formatter', FormatterPlugin::class );
281
			if ( ! $obj instanceof FormatterPlugin ) {
282
				$info = json_encode( self::$config['formatter'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
283
				throw new \RuntimeException( "Unknown formatter plugin $info" );
284
			}
285
			self::$cache['formatter'] = $obj;
286
		}
287
		return self::$cache['formatter'];
288
	}
289
290
	/**
291
	 * Get verisoning plugin.
@@ 296-307 (lines=12) @@
293
	 * @return Versioning
294
	 * @throws \RuntimeException If the configured versioning plugin is unknown.
295
	 */
296
	public static function versioningPlugin() {
297
		self::load();
298
		if ( ! isset( self::$cache['versioning'] ) ) {
299
			$obj = self::getPlugin( self::$config['versioning'], 'Versioning', VersioningPlugin::class );
300
			if ( ! $obj instanceof VersioningPlugin ) {
301
				$info = json_encode( self::$config['versioning'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
302
				throw new \RuntimeException( "Unknown versioning plugin $info" );
303
			}
304
			self::$cache['versioning'] = $obj;
305
		}
306
		return self::$cache['versioning'];
307
	}
308
309
}
310