| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Tidy; |
| 4 | |
| 5 | /** |
| 6 | * Base class for HTML cleanup utilities |
| 7 | */ |
| 8 | abstract class TidyDriverBase { |
| 9 | /** @var array */ |
| 10 | protected $config; |
| 11 | |
| 12 | public function __construct( $config ) { |
| 13 | $this->config = $config; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Clean up HTML |
| 18 | * |
| 19 | * @param string $text HTML document fragment to clean up |
| 20 | * @param ?callable $textProcessor A callback to run on the contents of |
| 21 | * text nodes (not elements or attribute values). This can be used to |
| 22 | * apply text modifications like french spacing or smart quotes, without |
| 23 | * affecting element or attribute markup. |
| 24 | * @return string The corrected HTML output |
| 25 | */ |
| 26 | abstract public function tidy( $text, ?callable $textProcessor = null ); |
| 27 | } |