Debian Codegraph @

extensions/Math/src/Hooks/HookRunner.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Math\Hooks;
4
5 use MediaWiki\Extension\Math\MathRenderer;
6 use MediaWiki\HookContainer\HookContainer;
7 use MediaWiki\Parser\Parser;
8 use stdClass;
9
10 /**
11 * This is a hook runner class, see docs/Hooks.md in core.
12 * @internal
13 */
14 class HookRunner implements
15 MathFormulaPostRenderHook,
16 MathRenderingResultRetrievedHook
17 {
18 private HookContainer $hookContainer;
19
20 public function __construct( HookContainer $hookContainer ) {
21 $this->hookContainer = $hookContainer;
22 }
23
24 /**
25 * @inheritDoc
26 */
27 public function onMathFormulaPostRender( Parser $parser, MathRenderer $renderer, string &$renderedMath ) {
28 return $this->hookContainer->run(
29 'MathFormulaPostRender',
30 [ $parser, $renderer, &$renderedMath ]
31 );
32 }
33
34 /**
35 * @inheritDoc
36 */
37 public function onMathRenderingResultRetrieved( MathRenderer &$renderer, stdClass &$jsonResult ) {
38 return $this->hookContainer->run(
39 'MathRenderingResultRetrieved',
40 [ &$renderer, &$jsonResult ]
41 );
42 }
43 }