Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
LuaLibrary
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 register
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
 addResourceLoaderModules
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Capiunto;
4
5use Scribunto_LuaLibraryBase;
6
7/**
8 * Registers our lua modules to Scribunto
9 *
10 * @license GPL-2.0-or-later
11 * @author Marius Hoch < hoo@online.de >
12 */
13
14class LuaLibrary extends Scribunto_LuaLibraryBase {
15
16    /**
17     * Register the library
18     *
19     * @return array
20     */
21    public function register() {
22        return $this->getEngine()->registerInterface(
23            __DIR__ . '/lua/Infobox.lua',
24            [
25                'addResourceLoaderModules' => [ $this, 'addResourceLoaderModules' ]
26            ],
27            []
28        );
29    }
30
31    /**
32     * Allows Lua to dynamically add the RL modules required for Infoboxes.
33     */
34    public function addResourceLoaderModules() {
35        $this->getParser()->getOutput()->addModuleStyles( [ 'capiunto.infobox.main' ] );
36    }
37
38}