Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
4 / 6
66.67% covered (warning)
66.67%
2 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Math
66.67% covered (warning)
66.67%
4 / 6
66.67% covered (warning)
66.67%
2 / 3
8.81
0.00% covered (danger)
0.00%
0 / 1
 __construct
n/a
0 / 0
n/a
0 / 0
1
 getMathConfig
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 getCheckerFactory
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
 getVisitorFactory
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace MediaWiki\Extension\Math;
4
5use MediaWiki\Extension\Math\InputCheck\InputCheckFactory;
6use MediaWiki\Extension\Math\WikiTexVC\MMLnodes\VisitorFactory;
7use MediaWiki\MediaWikiServices;
8use Psr\Container\ContainerInterface;
9
10/**
11 * Top level factory for the Math extension.
12 *
13 * @license GPL-2.0-or-later
14 */
15final class Math {
16
17    /**
18     * @codeCoverageIgnore
19     */
20    private function __construct() {
21        // should not be instantiated
22    }
23
24    public static function getMathConfig( ?ContainerInterface $services = null ): MathConfig {
25        return ( $services ?: MediaWikiServices::getInstance() )
26            ->get( 'Math.Config' );
27    }
28
29    public static function getCheckerFactory( ?ContainerInterface $services = null ): InputCheckFactory {
30        return ( $services ?: MediaWikiServices::getInstance() )
31            ->get( 'Math.CheckerFactory' );
32    }
33
34    public static function getVisitorFactory( ?ContainerInterface $services = null ): VisitorFactory {
35        return ( $services ?: MediaWikiServices::getInstance() )
36            ->get( 'Math.MathMLTreeVisitor' );
37    }
38}