Settings   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 18.18%

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
ccs 4
cts 22
cp 0.1818
wmc 6
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultSettings() 0 8 1
A getSettings() 0 12 2
A get() 0 4 2
A set() 0 4 1
1
<?php
2
3
namespace SES;
4
5
/**
6
 * File defining the settings for the SemanticSignup extension.
7
 * More info can be found at http://www.mediawiki.org/wiki/Extension:SemanticSignup#Settings
8
 *
9
 * NOTICE:
10
 * Changing one of these settings can be done by assigning to $egSemanticSignupSettings.
11
 *
12
 * @since 0.3
13
 *
14
 * @license GNU GPL v3+
15
 * @author Jeroen De Dauw <[email protected]>
16
 */
17
class Settings {
18
19
	protected static function getDefaultSettings() {
20
		return array(
21
			'requireName' => false,
22
			'formName' => '',
23
			'botName' => '',
24
			'useCaptcha' => true,
25
		);
26
	}
27
28 1
	public static function getSettings() {
29 1
		static $settings = false;
30
31 1
		if ( $settings === false ) {
32
			$settings = array_merge(
33
				self::getDefaultSettings(),
34
				$GLOBALS['egSemanticSignupSettings']
35
			);
36
		}
37
38 1
		return $settings;
39
	}
40
41
	public static function get( $settingName ) {
42
		$settings = self::getSettings();
43
		return array_key_exists( $settingName, $settings ) ? $settings[$settingName] : null;
44
	}
45
46
	public static function set( $key, $value ) {
47
		$settings = self::getSettings();
48
		$settings[ $key ] = $value;
49
	}
50
51
}
52