| Conditions | 2 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2.0145 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 1 | public static function onExtensionFunction() { |
|
| 18 | self::$factory = new IdGeneratorFactory(); |
||
| 19 | |||
| 20 | 1 | $GLOBALS['wgHooks']['ParserFirstCallInit'][] = function ( Parser &$parser ) { |
|
| 21 | 1 | foreach ( [ 'next_number', 'nextnumber' ] as $functionName ) { |
|
| 22 | 1 | $parser->setFunctionHook( |
|
| 23 | 1 | $functionName, |
|
| 24 | 1 | function ( Parser $parser, string $param = '' ) { |
|
| 25 | 1 | $generator = self::$factory->getIdGenerator( |
|
| 26 | 1 | MediaWikiServices::getInstance()->getDBLoadBalancer() |
|
| 27 | ); |
||
| 28 | |||
| 29 | return [ |
||
| 30 | 1 | $generator->getNewId( $param ), |
|
| 31 | 'noparse' => true |
||
| 32 | ]; |
||
| 33 | 1 | } |
|
| 34 | ); |
||
| 35 | } |
||
| 36 | 1 | }; |
|
| 37 | } |
||
| 38 | |||
| 40 |