HookRegistry::register()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 32
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
nc 1
nop 1
dl 0
loc 32
rs 8.8571
c 1
b 0
f 0
ccs 12
cts 12
cp 1
crap 1
1
<?php
2
3
namespace SES;
4
5
use Parser;
6
use Title;
7
use SpecialPage;
8
9
/**
10
 * @license GNU GPL v3+
11
 * @since 1.0
12
 *
13
 * @author mwjames
14
 */
15
class HookRegistry {
16
17
	/**
18
	 * @since  1.0
19
	 *
20
	 * @param array &$wgHooks
21
	 *
22
	 * @return boolean
23
	 */
24 1
	public function register( &$wgHooks ) {
25
26 1
		$signupFactory = new SignupFactory();
27 1
		$formPrinterHandler = $signupFactory->newFormPrinterHandler();
28
29
		/**
30
		 * @see https://www.mediawiki.org/wiki/Manual:Hooks/UserCreateForm
31
		 */
32
		$wgHooks['UserCreateForm'][] = function ( &$template ) use ( $formPrinterHandler ) {
0 ignored issues
show
Unused Code introduced by
The parameter $template is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
34
			//FIXME
35 1
			global $wgOut;
36
37 1
			$redirectFormFinder = new RedirectFormFinder( $formPrinterHandler );
38
39 1
			return $redirectFormFinder->redirectToUrl( $wgOut );
40
		};
41
42
		/**
43
		 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ParserFirstCallInit
44
		 */
45 1
		$wgHooks['ParserFirstCallInit'][] = function ( $parser ) {
46
47 1
			$parserFunctionFactory = new ParserFunctionFactory();
48
49 1
			list( $name, $definition, $flag ) = $parserFunctionFactory->newSignupFieldsParserFunctionDefinition();
50
51 1
			$parser->setFunctionHook( $name, $definition, $flag );
52
53 1
			return true;
54
		};
55 1
	}
56
57
}
58