Conditions | 2 |
Paths | 1 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2.003 |
Changes | 0 |
1 | <?php |
||
12 | public static function onExtensionFunction() { |
||
13 | 1 | $GLOBALS['wgHooks']['ParserFirstCallInit'][] = function ( Parser &$parser ) { |
|
14 | 1 | foreach ( [ 'generate_id', 'generateid' ] as $functionName ) { |
|
15 | 1 | $parser->setFunctionHook( |
|
16 | 1 | $functionName, |
|
17 | 1 | function ( Parser $parser, string $param = '' ) { |
|
18 | 1 | $generator = ( new IdGeneratorFactory() )->newIdGenerator( |
|
19 | 1 | MediaWikiServices::getInstance()->getDBLoadBalancer() |
|
20 | ); |
||
21 | |||
22 | return [ |
||
23 | 1 | $generator->getNewId( $param ) |
|
24 | ]; |
||
25 | 1 | } |
|
26 | ); |
||
27 | } |
||
28 | 1 | }; |
|
29 | } |
||
30 | |||
32 |