Bootstrap   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 16
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 1
1
<?php
2
/**
3
 * An extension providing the Bootstrap library to other extensions
4
 *
5
 * @see      https://www.mediawiki.org/wiki/Extension:Bootstrap
6
 * @see      https://getbootstrap.com/
7
 *
8
 * @author   Stephan Gambke
9
 *
10
 * @defgroup Bootstrap Bootstrap
11
 */
12
13
/**
14
 * The main file of the Bootstrap extension
15
 *
16
 * @copyright 2013 - 2019, Stephan Gambke
17
 * @license   GPL-3.0-or-later
18
 *
19
 * This file is part of the MediaWiki extension Bootstrap.
20
 * The Bootstrap extension is free software: you can redistribute it and/or
21
 * modify it under the terms of the GNU General Public License as published by
22
 * the Free Software Foundation, either version 3 of the License, or
23
 * (at your option) any later version.
24
 *
25
 * The Bootstrap extension is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
32
 *
33
 * @file
34
 * @ingroup       Bootstrap
35
 */
36
37
namespace Bootstrap;
38
39
use Bootstrap\Hooks\SetupAfterCache;
40
41
/**
42
 * Class Bootstrap
43
 *
44
 * @since 1.0
45
 * @ingroup Bootstrap
46
 */
47
class Bootstrap {
48
49
	/**
50
	 * @throws \Exception
51
	 */
52
	public static function init() {
53
		$GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][] = function () {
54
			$configuration = [];
55
			$configuration[ 'IP' ] = $GLOBALS[ 'IP' ];
56
			$configuration[ 'remoteBasePath' ] =
57
				$GLOBALS[ 'wgExtensionAssetsPath' ] . '/Bootstrap/resources/bootstrap';
58
			$configuration[ 'localBasePath' ] =
59
				$GLOBALS[ 'wgExtensionDirectory' ] . '/Bootstrap/resources/bootstrap';
60
61
			$setupAfterCache = new SetupAfterCache( $configuration );
62
			$setupAfterCache->process();
63
		};
64
	}
65
}
66