HookRegistry   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 43
rs 10
c 1
b 0
f 0
ccs 12
cts 12
cp 1
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B register() 0 32 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