RedirectFormFinder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
ccs 10
cts 10
cp 1
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A redirectToUrl() 0 14 2
1
<?php
2
3
namespace SES;
4
5
use OutputPage;
6
use SpecialPage;
7
8
/**
9
 * @license GNU GPL v3+
10
 * @since 1.0
11
 *
12
 * @author mwjames
13
 */
14
class RedirectFormFinder {
15
16
	/**
17
	 * @var FormPrinterHandler
18
	 */
19
	private $formPrinterHandler;
20
21
	/**
22
	 * @since 1.1
23
	 *
24
	 * @param FormPrinterHandler $formPrinterHandler
25
	 */
26 3
	public function __construct( FormPrinterHandler $formPrinterHandler ) {
27 3
		$this->formPrinterHandler = $formPrinterHandler;
28 3
	}
29
30
	/**
31
	 * @since 1.0
32
	 *
33
	 * @param OutputPage $output
34
	 *
35
	 * @return boolean
36
	 */
37 2
	public function redirectToUrl( $output ) {
38
39 2
		if ( !$this->formPrinterHandler->canUseForm() ) {
40 1
			return true;
41
		}
42
43 1
		$url = htmlspecialchars( SpecialPage::getTitleFor( 'SemanticSignup' )->getFullURL() );
44
45 1
		wfRunHooks( 'SemanticSignupBeforeRedirect', array( &$url ) );
46
47 1
		$output->redirect( $url );
48
49 1
		return false;
50
	}
51
}
52