SemanticImageCaption   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 3
A initExtension() 0 13 2
A onExtensionFunction() 0 3 1
1
<?php
2
3
use SMW\ImageCaption\Hooks;
4
5
/**
6
 * Complementary extension to Semantic MediaWiki to support auto-caption of
7
 * images.
8
 *
9
 * @see https://github.com/SemanticMediaWiki/SemanticImageCaption
10
 *
11
 * @defgroup SemanticImageCaption Semantic ImageCaption
12
 */
13
SemanticImageCaption::load();
14
15
/**
16
 * @codeCoverageIgnore
17
 */
18
class SemanticImageCaption {
19
20
	/**
21
	 * @since 1.0
22
	 *
23
	 * @note It is expected that this function is loaded before LocalSettings.php
24
	 * to ensure that settings and global functions are available by the time
25
	 * the extension is activated.
26
	 */
27
	public static function load() {
28
29
		if ( !defined( 'MEDIAWIKI' ) ) {
30
			return;
31
		}
32
33
		if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
34
			include_once __DIR__ . '/vendor/autoload.php';
35
		}
36
	}
37
38
	/**
39
	 * @since 1.0
40
	 * @see https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#callback
41
	 */
42
	public static function initExtension( $credits = [] ) {
43
44
		$version = 'UNKNOWN' ;
45
46
		// See https://phabricator.wikimedia.org/T151136
47
		if ( isset( $credits['version'] ) ) {
48
			$version = $credits['version'];
49
		}
50
51
		define( 'SMW_IMAGECAPTION_VERSION', $version );
52
53
		$GLOBALS['wgMessagesDirs']['SemanticImageCaption'] = __DIR__ . '/i18n';
54
	}
55
56
	/**
57
	 * @since 1.0
58
	 */
59
	public static function onExtensionFunction() {
60
61
	}
62
63
}
64