mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Description2
synced 2024-11-30 17:34:11 +00:00
b73fe26c29
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
14 lines
297 B
PHP
14 lines
297 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Description2;
|
|
|
|
interface DescriptionProvider {
|
|
/**
|
|
* Extracts description from the HTML representation of a page.
|
|
*
|
|
* @param string $text HTML to extract the description from.
|
|
* @return ?string
|
|
*/
|
|
public function derive( string $text ): ?string;
|
|
}
|