SemanticGlossary   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initExtension() 0 15 2
A getVersion() 0 9 2
1
<?php
2
3
use SG\HookRegistry;
4
use SMW\ApplicationFactory;
5
6
/**
7
 * Class SemanticGlossary
8
 *
9
 * @ingroup Skins
10
 */
11
class SemanticGlossary {
12
13
	/**
14
	 * @since 2.0
15
	 */
16
	public static function initExtension() {
17
18
		if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
19
			require_once __DIR__ . '/vendor/autoload.php';
20
		}
21
22
		$GLOBALS[ 'wgexLingoBackend' ] = 'SG\LingoBackendAdapter';
23
24
		$GLOBALS[ 'wgExtensionFunctions' ][] = function () {
25
26
			$hookRegistry = new HookRegistry();
27
28
			$hookRegistry->register();
29
		};
30
	}
31
32
	/**
33
	 * @since 2.0
34
	 *
35
	 * @return string|null
36
	 */
37
	public static function getVersion() {
38
		$extensionData = ExtensionRegistry::getInstance()->getAllThings();
39
40
		if ( isset( $extensionData['Semantic Glossary'] ) ) {
41
			return $extensionData['Semantic Glossary']['version'];
42
		}
43
44
		return null;
45
	}
46
}
47