Code Duplication    Length = 12-12 lines in 2 locations

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

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