Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 226-237 (lines=12) @@
223
	 * @return Formatter
224
	 * @throws \RuntimeException If the configured formatter is unknown.
225
	 */
226
	public static function formatterPlugin() {
227
		self::load();
228
		if ( ! isset( self::$cache['formatter'] ) ) {
229
			$obj = self::getPlugin( self::$config['formatter'], 'Formatter' );
230
			if ( ! $obj instanceof FormatterPlugin ) {
231
				$info = json_encode( self::$config['formatter'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
232
				throw new \RuntimeException( "Unknown formatter plugin $info" );
233
			}
234
			self::$cache['formatter'] = $obj;
235
		}
236
		return self::$cache['formatter'];
237
	}
238
239
	/**
240
	 * Get verisoning plugin.
@@ 245-256 (lines=12) @@
242
	 * @return Versioning
243
	 * @throws \RuntimeException If the configured versioning plugin is unknown.
244
	 */
245
	public static function versioningPlugin() {
246
		self::load();
247
		if ( ! isset( self::$cache['versioning'] ) ) {
248
			$obj = self::getPlugin( self::$config['versioning'], 'Versioning' );
249
			if ( ! $obj instanceof VersioningPlugin ) {
250
				$info = json_encode( self::$config['versioning'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
251
				throw new \RuntimeException( "Unknown versioning plugin $info" );
252
			}
253
			self::$cache['versioning'] = $obj;
254
		}
255
		return self::$cache['versioning'];
256
	}
257
258
}
259