mediawiki-extensions-Templa.../includes/Hooks/HookRunner.php
Umherirrender 687207f0bf Create HookRunner class and the hook handler interfaces
Bug: T338435
Change-Id: I34726d15dad5045f5c1b00ec7796b7b5f1516d12
2023-06-08 13:59:15 +02:00

51 lines
1.2 KiB
PHP

<?php
namespace MediaWiki\Extension\TemplateStyles\Hooks;
use MediaWiki\HookContainer\HookContainer;
use Wikimedia\CSS\Grammar\MatcherFactory;
use Wikimedia\CSS\Sanitizer\StylePropertySanitizer;
use Wikimedia\CSS\Sanitizer\StylesheetSanitizer;
/**
* This is a hook runner class, see docs/Hooks.md in core.
* @internal
*/
class HookRunner implements
TemplateStylesPropertySanitizerHook,
TemplateStylesStylesheetSanitizerHook
{
private HookContainer $hookContainer;
public function __construct( HookContainer $hookContainer ) {
$this->hookContainer = $hookContainer;
}
/**
* @inheritDoc
*/
public function onTemplateStylesPropertySanitizer(
StylePropertySanitizer &$propertySanitizer,
MatcherFactory $matcherFactory
) {
return $this->hookContainer->run(
'TemplateStylesPropertySanitizer',
[ &$propertySanitizer, $matcherFactory ]
);
}
/**
* @inheritDoc
*/
public function onTemplateStylesStylesheetSanitizer(
StylesheetSanitizer &$sanitizer,
StylePropertySanitizer $propertySanitizer,
MatcherFactory $matcherFactory
) {
return $this->hookContainer->run(
'TemplateStylesStylesheetSanitizer',
[ &$sanitizer, $propertySanitizer, $matcherFactory ]
);
}
}