fanwikis-Description2/includes/ServiceWiring.php
alex4401 b73fe26c29 Extract description algorithm into a new class
Separating the extract algorithm from integration code. This results in a slightly cleaner code structure (at least in my opinion) and enables adding alternate algorithms without devolving into spaghetti.

The DescriptionProvider (name of the new base interface) is exposed as a service through dependency injection to avoid factories. The implementation can be swapped at service instantiation time.

Depends-On: I73c61ce045dcf31ac1ca5888f1548de8fd8b56ff
Change-Id: I97fd065c9554837747021ba9fff26005e33270f4
2024-01-12 08:24:19 +00:00

14 lines
334 B
PHP

<?php
use MediaWiki\Extension\Description2\DescriptionProvider;
use MediaWiki\Extension\Description2\SimpleDescriptionProvider;
use MediaWiki\MediaWikiServices;
return [
'Description2.DescriptionProvider' => static function (
MediaWikiServices $services
): DescriptionProvider {
return new SimpleDescriptionProvider();
},
];