Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ScribuntoHooks
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 onScribuntoExternalLibraries
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace MediaWiki\Extension\ParserFunctions;
4
5/**
6 * Hooks from Scribunto extension,
7 * which is optional to use with this extension.
8 * TODO: Implement interface MediaWiki\Extension\Scribunto\Hooks\ScribuntoExternalLibrariesHook
9 *  when extension requirement is MediaWiki 1.41+
10 */
11class ScribuntoHooks {
12
13    /**
14     * Registers ParserFunctions' lua function with Scribunto
15     *
16     * @see https://www.mediawiki.org/wiki/Extension:Scribunto/ScribuntoExternalLibraries
17     *
18     * @param string $engine
19     * @param string[] &$extraLibraries
20     */
21    public function onScribuntoExternalLibraries( string $engine, array &$extraLibraries ) {
22        if ( $engine === 'lua' ) {
23            $extraLibraries['mw.ext.ParserFunctions'] = LuaLibrary::class;
24        }
25    }
26}