Passed
Branch master (ea33f2)
by Stephan
02:47
created
Category
src/Definition/ModuleDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,6 +38,6 @@
 block discarded – undo
38 38
 	 *
39 39
 	 * @return array
40 40
 	 */
41
-	public function get( $key );
41
+	public function get($key);
42 42
 
43 43
 }
Please login to merge, or discard this patch.
src/Definition/V3ModuleDefinition.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -32,58 +32,58 @@  discard block
 block discarded – undo
32 32
 class V3ModuleDefinition implements ModuleDefinition {
33 33
 
34 34
 	static private $moduleDescriptions = array(
35
-		'variables'            => array( 'styles' => 'variables' ),
36
-		'mixins'               => array( 'styles' => 'mixins' ),
37
-		'normalize'            => array( 'styles' => 'normalize' ),
38
-		'print'                => array( 'styles' => 'print' ),
39
-		'scaffolding'          => array( 'styles' => 'scaffolding' ),
40
-		'type'                 => array( 'styles' => 'type' ),
41
-		'code'                 => array( 'styles' => 'code' ),
42
-		'grid'                 => array( 'styles' => 'grid' ),
43
-		'tables'               => array( 'styles' => 'tables' ),
44
-		'forms'                => array( 'styles' => 'forms' ),
45
-		'buttons'              => array( 'styles' => 'buttons' ),
46
-		'component-animations' => array( 'styles' => 'component-animations' ),
47
-		'glyphicons'           => array( 'styles' => 'glyphicons' ),
48
-		'dropdowns'            => array( 'styles' => 'dropdowns' ),
49
-		'button-groups'        => array( 'styles' => 'button-groups' ),
50
-		'input-groups'         => array( 'styles' => 'input-groups' ),
51
-		'navs'                 => array( 'styles' => 'navs' ),
52
-		'navbar'               => array( 'styles' => 'navbar' ),
53
-		'breadcrumbs'          => array( 'styles' => 'breadcrumbs' ),
54
-		'pagination'           => array( 'styles' => 'pagination' ),
55
-		'pager'                => array( 'styles' => 'pager' ),
56
-		'labels'               => array( 'styles' => 'labels' ),
57
-		'badges'               => array( 'styles' => 'badges' ),
58
-		'jumbotron'            => array( 'styles' => 'jumbotron' ),
59
-		'thumbnails'           => array( 'styles' => 'thumbnails' ),
60
-		'alerts'               => array( 'styles' => 'alerts' ),
61
-		'progress-bars'        => array( 'styles' => 'progress-bars' ),
62
-		'media'                => array( 'styles' => 'media' ),
63
-		'list-group'           => array( 'styles' => 'list-group' ),
64
-		'panels'               => array( 'styles' => 'panels' ),
65
-		'wells'                => array( 'styles' => 'wells' ),
66
-		'close'                => array( 'styles' => 'close' ),
35
+		'variables'            => array('styles' => 'variables'),
36
+		'mixins'               => array('styles' => 'mixins'),
37
+		'normalize'            => array('styles' => 'normalize'),
38
+		'print'                => array('styles' => 'print'),
39
+		'scaffolding'          => array('styles' => 'scaffolding'),
40
+		'type'                 => array('styles' => 'type'),
41
+		'code'                 => array('styles' => 'code'),
42
+		'grid'                 => array('styles' => 'grid'),
43
+		'tables'               => array('styles' => 'tables'),
44
+		'forms'                => array('styles' => 'forms'),
45
+		'buttons'              => array('styles' => 'buttons'),
46
+		'component-animations' => array('styles' => 'component-animations'),
47
+		'glyphicons'           => array('styles' => 'glyphicons'),
48
+		'dropdowns'            => array('styles' => 'dropdowns'),
49
+		'button-groups'        => array('styles' => 'button-groups'),
50
+		'input-groups'         => array('styles' => 'input-groups'),
51
+		'navs'                 => array('styles' => 'navs'),
52
+		'navbar'               => array('styles' => 'navbar'),
53
+		'breadcrumbs'          => array('styles' => 'breadcrumbs'),
54
+		'pagination'           => array('styles' => 'pagination'),
55
+		'pager'                => array('styles' => 'pager'),
56
+		'labels'               => array('styles' => 'labels'),
57
+		'badges'               => array('styles' => 'badges'),
58
+		'jumbotron'            => array('styles' => 'jumbotron'),
59
+		'thumbnails'           => array('styles' => 'thumbnails'),
60
+		'alerts'               => array('styles' => 'alerts'),
61
+		'progress-bars'        => array('styles' => 'progress-bars'),
62
+		'media'                => array('styles' => 'media'),
63
+		'list-group'           => array('styles' => 'list-group'),
64
+		'panels'               => array('styles' => 'panels'),
65
+		'wells'                => array('styles' => 'wells'),
66
+		'close'                => array('styles' => 'close'),
67 67
 
68 68
 		// Components w/ JavaScript
69
-		'modals'               => array( 'styles' => 'modals', 'scripts' => 'modal' ),
70
-		'tooltip'              => array( 'styles' => 'tooltip', 'scripts' => 'tooltip' ),
71
-		'popovers'             => array( 'styles' => 'popovers', 'scripts' => 'popover', 'dependencies' => 'tooltip' ),
72
-		'carousel'             => array( 'styles' => 'carousel', 'scripts' => 'carousel' ),
69
+		'modals'               => array('styles' => 'modals', 'scripts' => 'modal'),
70
+		'tooltip'              => array('styles' => 'tooltip', 'scripts' => 'tooltip'),
71
+		'popovers'             => array('styles' => 'popovers', 'scripts' => 'popover', 'dependencies' => 'tooltip'),
72
+		'carousel'             => array('styles' => 'carousel', 'scripts' => 'carousel'),
73 73
 
74 74
 		// Utility classes
75
-		'utilities'            => array( 'styles' => 'utilities' ),
76
-		'responsive-utilities' => array( 'styles' => 'responsive-utilities' ),
75
+		'utilities'            => array('styles' => 'utilities'),
76
+		'responsive-utilities' => array('styles' => 'responsive-utilities'),
77 77
 
78 78
 		// JS-only components
79
-		'affix'                => array( 'scripts' => 'affix' ),
80
-		'alert'                => array( 'scripts' => 'alert' ),
81
-		'button'               => array( 'scripts' => 'button' ),
82
-		'collapse'             => array( 'scripts' => 'collapse' ),
83
-		'dropdown'             => array( 'scripts' => 'dropdown' ),
84
-		'scrollspy'            => array( 'scripts' => 'scrollspy' ),
85
-		'tab'                  => array( 'scripts' => 'tab' ),
86
-		'transition'           => array( 'scripts' => 'transition' ),
79
+		'affix'                => array('scripts' => 'affix'),
80
+		'alert'                => array('scripts' => 'alert'),
81
+		'button'               => array('scripts' => 'button'),
82
+		'collapse'             => array('scripts' => 'collapse'),
83
+		'dropdown'             => array('scripts' => 'dropdown'),
84
+		'scrollspy'            => array('scripts' => 'scrollspy'),
85
+		'tab'                  => array('scripts' => 'tab'),
86
+		'transition'           => array('scripts' => 'transition'),
87 87
 
88 88
 	);
89 89
 
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 * @return array
111 111
 	 * @throws InvalidArgumentException
112 112
 	 */
113
-	public function get( $key ) {
113
+	public function get($key) {
114 114
 
115
-		switch ( $key ) {
115
+		switch ($key) {
116 116
 			case 'core':
117 117
 				return self::$coreModules;
118 118
 			case 'optional':
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				return self::$moduleDescriptions;
122 122
 		}
123 123
 
124
-		throw new InvalidArgumentException( 'Expected a valid key' );
124
+		throw new InvalidArgumentException('Expected a valid key');
125 125
 	}
126 126
 
127 127
 }
Please login to merge, or discard this patch.
src/BootstrapManager.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 *
48 48
 	 * @param ModuleDefinition $moduleDefinition
49 49
 	 */
50
-	public function __construct( ModuleDefinition $moduleDefinition ) {
50
+	public function __construct(ModuleDefinition $moduleDefinition) {
51 51
 		$this->moduleDefinition = $moduleDefinition;
52 52
 		$this->initCoreModules();
53 53
 	}
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public static function getInstance() {
63 63
 
64
-		if ( self::$instance === null ) {
65
-			self::$instance = new self( new V3ModuleDefinition );
64
+		if (self::$instance === null) {
65
+			self::$instance = new self(new V3ModuleDefinition);
66 66
 		}
67 67
 
68 68
 		return self::$instance;
@@ -82,29 +82,29 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @param string|string[] $modules
84 84
 	 */
85
-	public function addBootstrapModule( $modules ) {
85
+	public function addBootstrapModule($modules) {
86 86
 
87 87
 		$modules = (array) $modules;
88 88
 
89
-		foreach ( $modules as $module ) {
89
+		foreach ($modules as $module) {
90 90
 
91 91
 			// if the module is known
92
-			if ( isset( $this->mModuleDescriptions[ $module ] ) ) {
92
+			if (isset($this->mModuleDescriptions[$module])) {
93 93
 
94
-				$description = $this->mModuleDescriptions[ $module ];
94
+				$description = $this->mModuleDescriptions[$module];
95 95
 
96 96
 				// prevent adding this module again; this also prevents infinite recursion in case
97 97
 				// of dependency resolution
98
-				unset( $this->mModuleDescriptions[ $module ] );
98
+				unset($this->mModuleDescriptions[$module]);
99 99
 
100 100
 				// first add any dependencies recursively, so they are available when the styles and
101 101
 				// scripts of $module are loaded
102
-				if ( isset( $description[ 'dependencies' ] ) ) {
103
-					$this->addBootstrapModule( $description[ 'dependencies' ] );
102
+				if (isset($description['dependencies'])) {
103
+					$this->addBootstrapModule($description['dependencies']);
104 104
 				}
105 105
 
106
-				$this->addFilesToGlobalResourceModules( 'styles', $description, '.less' );
107
-				$this->addFilesToGlobalResourceModules( 'scripts', $description, '.js' );
106
+				$this->addFilesToGlobalResourceModules('styles', $description, '.less');
107
+				$this->addFilesToGlobalResourceModules('scripts', $description, '.js');
108 108
 
109 109
 			}
110 110
 		}
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 	 * @param mixed[]      $description
117 117
 	 * @param              $fileExt
118 118
 	 */
119
-	protected function addFilesToGlobalResourceModules ( $filetype, $description, $fileExt ) {
119
+	protected function addFilesToGlobalResourceModules($filetype, $description, $fileExt) {
120 120
 
121
-		if ( isset( $description[ $filetype ] ) ) {
121
+		if (isset($description[$filetype])) {
122 122
 
123 123
 			$files = array_map(
124
-				function ( $filename ) use ( $fileExt ) {
124
+				function($filename) use ($fileExt) {
125 125
 					return $filename . $fileExt;
126 126
 				},
127
-				(array) $description[ $filetype ]
127
+				(array) $description[$filetype]
128 128
 			);
129 129
 
130
-			$this->adjustArrayElementOfResourceModuleDescription( $filetype, $files, $filetype );
130
+			$this->adjustArrayElementOfResourceModuleDescription($filetype, $files, $filetype);
131 131
 
132 132
 		}
133 133
 	}
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @since  1.0
139 139
 	 */
140 140
 	public function addAllBootstrapModules() {
141
-		$this->addBootstrapModule( $this->moduleDefinition->get( 'optional' ) );
141
+		$this->addBootstrapModule($this->moduleDefinition->get('optional'));
142 142
 	}
143 143
 
144 144
 	/**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @internal param string $path
151 151
 	 */
152
-	public function addExternalModule( $file, $remotePath = '' ) {
153
-		$this->adjustArrayElementOfResourceModuleDescription( 'external styles', array( $file => $remotePath ) );
152
+	public function addExternalModule($file, $remotePath = '') {
153
+		$this->adjustArrayElementOfResourceModuleDescription('external styles', array($file => $remotePath));
154 154
 	}
155 155
 
156 156
 	/**
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * @param string $key   the LESS variable name
160 160
 	 * @param string $value the value to assign to the variable
161 161
 	 */
162
-	public function setLessVariable( $key, $value ) {
163
-		$this->setLessVariables( array( $key => $value ) );
162
+	public function setLessVariable($key, $value) {
163
+		$this->setLessVariables(array($key => $value));
164 164
 	}
165 165
 
166 166
 	/**
@@ -168,21 +168,21 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param mixed[] $variables
170 170
 	 */
171
-	public function setLessVariables( $variables ) {
172
-		$this->adjustArrayElementOfResourceModuleDescription( 'variables', $variables );
171
+	public function setLessVariables($variables) {
172
+		$this->adjustArrayElementOfResourceModuleDescription('variables', $variables);
173 173
 	}
174 174
 
175 175
 	/**
176 176
 	 * @since 1.1
177 177
 	 * @param string|string[] $files
178 178
 	 */
179
-	public function addCacheTriggerFile( $files ){
180
-		$this->adjustArrayElementOfResourceModuleDescription( 'cachetriggers', $files );
179
+	public function addCacheTriggerFile($files) {
180
+		$this->adjustArrayElementOfResourceModuleDescription('cachetriggers', $files);
181 181
 	}
182 182
 
183 183
 	protected function initCoreModules() {
184
-		$this->mModuleDescriptions = $this->moduleDefinition->get( 'descriptions' );
185
-		$this->addBootstrapModule( $this->moduleDefinition->get( 'core' ) );
184
+		$this->mModuleDescriptions = $this->moduleDefinition->get('descriptions');
185
+		$this->addBootstrapModule($this->moduleDefinition->get('core'));
186 186
 	}
187 187
 
188 188
 	/**
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	 * @param mixed  $value
191 191
 	 * @param string $filetype 'styles'|'scripts'
192 192
 	 */
193
-	protected function adjustArrayElementOfResourceModuleDescription( $key, $value, $filetype = 'styles' ) {
193
+	protected function adjustArrayElementOfResourceModuleDescription($key, $value, $filetype = 'styles') {
194 194
 
195
-		if (!isset($GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ])) {
196
-			$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] = $value;
195
+		if (!isset($GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key])) {
196
+			$GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] = $value;
197 197
 		} else {
198
-			$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] =
198
+			$GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] =
199 199
 				array_merge(
200
-					$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ],
200
+					$GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key],
201 201
 					(array) $value
202 202
 				);
203 203
 		}
Please login to merge, or discard this patch.
src/Hooks/SetupAfterCache.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @param array $configuration
50 50
 	 */
51
-	public function __construct( array $configuration ) {
51
+	public function __construct(array $configuration) {
52 52
 		$this->configuration = $configuration;
53 53
 	}
54 54
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 		$this->removeLegacyLessCompilerFromComposerAutoloader();
66 66
 
67 67
 		$this->registerBootstrapResourcePaths(
68
-			$this->isReadablePath( $this->configuration['localBasePath'] ),
69
-			$this->configuration[ 'remoteBasePath' ]
68
+			$this->isReadablePath($this->configuration['localBasePath']),
69
+			$this->configuration['remoteBasePath']
70 70
 		);
71 71
 
72 72
 		$this->registerCacheTriggers();
@@ -79,23 +79,23 @@  discard block
 block discarded – undo
79 79
 	 * @param string $localBasePath
80 80
 	 * @param string $remoteBasePath
81 81
 	 */
82
-	protected function registerBootstrapResourcePaths( $localBasePath, $remoteBasePath ) {
82
+	protected function registerBootstrapResourcePaths($localBasePath, $remoteBasePath) {
83 83
 
84
-		$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array_replace_recursive( array(
84
+		$GLOBALS['wgResourceModules']['ext.bootstrap.styles'] = array_replace_recursive(array(
85 85
 				'localBasePath'  => $localBasePath . '/less',
86 86
 				'remoteBasePath' => $remoteBasePath . '/less',
87 87
 				'variables'      => array(
88 88
 					'icon-font-path' => "\"$remoteBasePath/fonts/\"",
89 89
 				),
90 90
 			),
91
-			$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ]
91
+			$GLOBALS['wgResourceModules']['ext.bootstrap.styles']
92 92
 		);
93 93
 
94
-		$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] = array_replace_recursive( array(
94
+		$GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] = array_replace_recursive(array(
95 95
 				'localBasePath'  => $localBasePath . '/js',
96 96
 				'remoteBasePath' => $remoteBasePath . '/js',
97 97
 			),
98
-			$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ]
98
+			$GLOBALS['wgResourceModules']['ext.bootstrap.scripts']
99 99
 		);
100 100
 	}
101 101
 
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 
115 115
 		$autoloadFunctions = spl_autoload_functions();
116 116
 
117
-		foreach ( $autoloadFunctions as $autoloadFunction ) {
117
+		foreach ($autoloadFunctions as $autoloadFunction) {
118 118
 
119
-			if ( is_object( $autoloadFunction ) && ( $autoloadFunction instanceof Closure ) ) {
119
+			if (is_object($autoloadFunction) && ($autoloadFunction instanceof Closure)) {
120 120
 				continue;
121 121
 			}
122 122
 
123
-			$classLoader = $autoloadFunction[ 0 ];
123
+			$classLoader = $autoloadFunction[0];
124 124
 
125
-			if ( is_a( $classLoader, '\Composer\Autoload\ClassLoader' ) ) {
125
+			if (is_a($classLoader, '\Composer\Autoload\ClassLoader')) {
126 126
 
127 127
 				$classMap = $classLoader->getClassMap();
128 128
 
129
-				if ( !is_array( $classMap ) ||
130
-					!array_key_exists( 'lessc', $classMap ) ||
131
-					strpos( $classMap[ 'lessc' ], '/less.php/less.php/lessc.inc.php') !== false ) {
129
+				if (!is_array($classMap) ||
130
+					!array_key_exists('lessc', $classMap) ||
131
+					strpos($classMap['lessc'], '/less.php/less.php/lessc.inc.php') !== false) {
132 132
 
133
-					$classLoader->addClassMap( array( 'lessc' => null ) );
133
+					$classLoader->addClassMap(array('lessc' => null));
134 134
 				}
135 135
 				break;
136 136
 			}
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 	 * @param string $id
143 143
 	 * @return bool
144 144
 	 */
145
-	protected function hasConfiguration( $id ) {
146
-		return isset( $this->configuration[ $id ] );
145
+	protected function hasConfiguration($id) {
146
+		return isset($this->configuration[$id]);
147 147
 	}
148 148
 
149 149
 	/**
@@ -151,28 +151,28 @@  discard block
 block discarded – undo
151 151
 	 * @return string
152 152
 	 * @throws RuntimeException
153 153
 	 */
154
-	protected function isReadablePath( $localBasePath ) {
154
+	protected function isReadablePath($localBasePath) {
155 155
 
156
-		$localBasePath = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $localBasePath );
156
+		$localBasePath = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $localBasePath);
157 157
 
158
-		if ( is_readable( $localBasePath ) ) {
158
+		if (is_readable($localBasePath)) {
159 159
 			return $localBasePath;
160 160
 		}
161 161
 
162
-		throw new RuntimeException( "Expected an accessible {$localBasePath} path" );
162
+		throw new RuntimeException("Expected an accessible {$localBasePath} path");
163 163
 	}
164 164
 
165 165
 	protected function registerCacheTriggers() {
166 166
 
167 167
 		$defaultRecacheTriggers = array(
168
-			'LocalSettings.php' => $this->configuration[ 'IP' ] . '/LocalSettings.php',
169
-			'composer.lock' => $this->configuration[ 'IP' ] . '/composer.lock',
168
+			'LocalSettings.php' => $this->configuration['IP'] . '/LocalSettings.php',
169
+			'composer.lock' => $this->configuration['IP'] . '/composer.lock',
170 170
 		);
171 171
 
172
-		foreach ( $defaultRecacheTriggers as $key => $filename ) {
173
-			if ( array_key_exists( $key, $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cachetriggers' ] ) &&
174
-				$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cachetriggers' ][ $key ] === null ) {
175
-				$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cachetriggers' ][ $key ] = $filename;
172
+		foreach ($defaultRecacheTriggers as $key => $filename) {
173
+			if (array_key_exists($key, $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cachetriggers']) &&
174
+				$GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cachetriggers'][$key] === null) {
175
+				$GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cachetriggers'][$key] = $filename;
176 176
 			}
177 177
 		}
178 178
 	}
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
 			'IP' => 'Full path to working directory ($IP) not found.',
186 186
 		);
187 187
 
188
-		foreach ( $configElements as $key => $errorMessage ) {
189
-			if ( !$this->hasConfiguration( $key ) ) {
190
-				throw new InvalidArgumentException( $errorMessage );
188
+		foreach ($configElements as $key => $errorMessage) {
189
+			if (!$this->hasConfiguration($key)) {
190
+				throw new InvalidArgumentException($errorMessage);
191 191
 			}
192 192
 		}
193 193
 	}
Please login to merge, or discard this patch.
src/ResourceLoaderBootstrapModule.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 	protected $styleText = null;
62 62
 
63
-	public function __construct( $options = array(), $localBasePath = null, $remoteBasePath = null
63
+	public function __construct($options = array(), $localBasePath = null, $remoteBasePath = null
64 64
 	) {
65 65
 
66
-		parent::__construct( $options, $localBasePath, $remoteBasePath );
66
+		parent::__construct($options, $localBasePath, $remoteBasePath);
67 67
 
68
-		$this->applyOptions( $options );
68
+		$this->applyOptions($options);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return array
77 77
 	 */
78
-	public function getStyles( ResourceLoaderContext $context ) {
78
+	public function getStyles(ResourceLoaderContext $context) {
79 79
 
80
-		if ( $this->styleText === null ) {
80
+		if ($this->styleText === null) {
81 81
 
82
-			$this->retrieveStylesFromCache( $context );
82
+			$this->retrieveStylesFromCache($context);
83 83
 
84
-			if ( $this->styleText === null ) {
85
-				$this->compileStyles( $context );
84
+			if ($this->styleText === null) {
85
+				$this->compileStyles($context);
86 86
 			}
87 87
 		}
88 88
 
89
-		return array( 'all' => $this->styleText );
89
+		return array('all' => $this->styleText);
90 90
 	}
91 91
 
92 92
 	/**
@@ -103,79 +103,79 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @param BagOStuff $cache
105 105
 	 */
106
-	public function setCache( BagOStuff $cache ) {
106
+	public function setCache(BagOStuff $cache) {
107 107
 		$this->cache = $cache;
108 108
 	}
109 109
 
110 110
 	protected function getCache() {
111 111
 
112
-		if ( $this->cache === null ) {
113
-			$this->cache = wfGetCache( CACHE_ANYTHING );
112
+		if ($this->cache === null) {
113
+			$this->cache = wfGetCache(CACHE_ANYTHING);
114 114
 		}
115 115
 
116 116
 		return $this->cache;
117 117
 	}
118 118
 
119
-	protected function getCacheKey( ResourceLoaderContext $context ) {
120
-		return wfMemcKey( 'ext', 'bootstrap', $context->getHash() );
119
+	protected function getCacheKey(ResourceLoaderContext $context) {
120
+		return wfMemcKey('ext', 'bootstrap', $context->getHash());
121 121
 	}
122 122
 
123
-	protected function retrieveStylesFromCache( ResourceLoaderContext $context ) {
123
+	protected function retrieveStylesFromCache(ResourceLoaderContext $context) {
124 124
 
125 125
 		// Try for cache hit
126
-		$cacheResult = $this->getCache()->get( $this->getCacheKey( $context ) );
126
+		$cacheResult = $this->getCache()->get($this->getCacheKey($context));
127 127
 
128
-		if ( is_array( $cacheResult ) ) {
128
+		if (is_array($cacheResult)) {
129 129
 
130
-			if ( $this->isCacheOutdated( $cacheResult[ 'storetime' ] ) ) {
131
-				wfDebug( __METHOD__ . " ext.bootstrap: Cache miss: Cache outdated.\n" );
130
+			if ($this->isCacheOutdated($cacheResult['storetime'])) {
131
+				wfDebug(__METHOD__ . " ext.bootstrap: Cache miss: Cache outdated.\n");
132 132
 			} else {
133
-				$this->styleText = $cacheResult[ 'styles' ];
134
-				wfDebug( __METHOD__ . " ext.bootstrap: Cache hit: Got styles from cache.\n" );
133
+				$this->styleText = $cacheResult['styles'];
134
+				wfDebug(__METHOD__ . " ext.bootstrap: Cache hit: Got styles from cache.\n");
135 135
 			}
136 136
 
137 137
 		} else {
138
-			wfDebug( __METHOD__ .  " ext.bootstrap: Cache miss: Styles not found in cache.\n" );
138
+			wfDebug(__METHOD__ . " ext.bootstrap: Cache miss: Styles not found in cache.\n");
139 139
 		}
140 140
 	}
141 141
 
142
-	protected function updateCache( ResourceLoaderContext $context ) {
142
+	protected function updateCache(ResourceLoaderContext $context) {
143 143
 
144 144
 		$this->getCache()->set(
145
-			$this->getCacheKey( $context ),
146
-			array( 'styles' => $this->styleText, 'storetime' => time() )
145
+			$this->getCacheKey($context),
146
+			array('styles' => $this->styleText, 'storetime' => time())
147 147
 		);
148 148
 	}
149 149
 
150
-	protected function purgeCache( ResourceLoaderContext $context ) {
151
-		$this->getCache()->delete( $this->getCacheKey( $context ) );
150
+	protected function purgeCache(ResourceLoaderContext $context) {
151
+		$this->getCache()->delete($this->getCacheKey($context));
152 152
 	}
153 153
 
154
-	protected function compileStyles( ResourceLoaderContext $context ) {
154
+	protected function compileStyles(ResourceLoaderContext $context) {
155 155
 
156 156
 		$lessParser = new Less_Parser();
157
-		$remotePath = $this->getRemotePath( '' );
157
+		$remotePath = $this->getRemotePath('');
158 158
 
159 159
 		try {
160 160
 
161
-			foreach ( $this->styles as $style ) {
162
-				$lessParser->parseFile( $this->getLocalPath( $style ), $remotePath );
161
+			foreach ($this->styles as $style) {
162
+				$lessParser->parseFile($this->getLocalPath($style), $remotePath);
163 163
 			}
164 164
 
165
-			foreach ( $this->extStyles as $stylefile => $remotePath ) {
166
-				$lessParser->parseFile( $stylefile, $remotePath );
165
+			foreach ($this->extStyles as $stylefile => $remotePath) {
166
+				$lessParser->parseFile($stylefile, $remotePath);
167 167
 			}
168 168
 
169
-			$lessParser->ModifyVars( $this->variables );
169
+			$lessParser->ModifyVars($this->variables);
170 170
 
171 171
 			$this->styleText = $lessParser->getCss();
172 172
 
173
-			$this->updateCache( $context );
173
+			$this->updateCache($context);
174 174
 
175
-		} catch ( Exception $e ) {
175
+		} catch (Exception $e) {
176 176
 
177
-			$this->purgeCache( $context );
178
-			wfDebug( $e->getMessage() );
177
+			$this->purgeCache($context);
178
+			wfDebug($e->getMessage());
179 179
 			$this->styleText = '/* LESS compile error: ' . $e->getMessage() . '*/';
180 180
 		}
181 181
 
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 	/**
185 185
 	 * @param mixed[] $options
186 186
 	 */
187
-	protected function applyOptions( $options ) {
188
-		$mapConfigToLocalVar = array (
187
+	protected function applyOptions($options) {
188
+		$mapConfigToLocalVar = array(
189 189
 			'variables'       => 'variables',
190 190
 			'paths'           => 'paths',
191 191
 			'external styles' => 'extStyles',
192 192
 			'cachetriggers'   => 'cacheTriggers',
193 193
 		);
194 194
 
195
-		foreach ( $mapConfigToLocalVar as $config => $local ) {
196
-			if ( isset( $options[ $config ] ) ) {
197
-				$this->$local = $options[ $config ];
195
+		foreach ($mapConfigToLocalVar as $config => $local) {
196
+			if (isset($options[$config])) {
197
+				$this->$local = $options[$config];
198 198
 			}
199 199
 		}
200 200
 	}
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 	 *
205 205
 	 * @return bool
206 206
 	 */
207
-	protected function isCacheOutdated( $cacheStoreTime ) {
207
+	protected function isCacheOutdated($cacheStoreTime) {
208 208
 
209
-		foreach ( $this->cacheTriggers as $triggerFile ) {
210
-			if ( $triggerFile !== null && $cacheStoreTime < filemtime( $triggerFile ) ) {
209
+		foreach ($this->cacheTriggers as $triggerFile) {
210
+			if ($triggerFile !== null && $cacheStoreTime < filemtime($triggerFile)) {
211 211
 				return true;
212 212
 			}
213 213
 		}
Please login to merge, or discard this patch.
Bootstrap.i18n.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,22 +11,22 @@
 block discarded – undo
11 11
  * This shim maintains compatibility back to MediaWiki 1.17.
12 12
  */
13 13
 $messages = array();
14
-if ( !function_exists( 'wfJsonI18nShim8d1eb754050adb9a' ) ) {
15
-	function wfJsonI18nShim8d1eb754050adb9a( $cache, $code, &$cachedData ) {
16
-		$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
17
-		foreach ( $codeSequence as $csCode ) {
18
-			$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
19
-			if ( is_readable( $fileName ) ) {
20
-				$data = FormatJson::decode( file_get_contents( $fileName ), true );
21
-				foreach ( array_keys( $data ) as $key ) {
22
-					if ( $key === '' || $key[0] === '@' ) {
23
-						unset( $data[$key] );
14
+if (!function_exists('wfJsonI18nShim8d1eb754050adb9a')) {
15
+	function wfJsonI18nShim8d1eb754050adb9a($cache, $code, &$cachedData) {
16
+		$codeSequence = array_merge(array($code), $cachedData['fallbackSequence']);
17
+		foreach ($codeSequence as $csCode) {
18
+			$fileName = dirname(__FILE__) . "/i18n/$csCode.json";
19
+			if (is_readable($fileName)) {
20
+				$data = FormatJson::decode(file_get_contents($fileName), true);
21
+				foreach (array_keys($data) as $key) {
22
+					if ($key === '' || $key[0] === '@') {
23
+						unset($data[$key]);
24 24
 					}
25 25
 				}
26
-				$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
26
+				$cachedData['messages'] = array_merge($data, $cachedData['messages']);
27 27
 			}
28 28
 
29
-			$cachedData['deps'][] = new FileDependency( $fileName );
29
+			$cachedData['deps'][] = new FileDependency($fileName);
30 30
 		}
31 31
 		return true;
32 32
 	}
Please login to merge, or discard this patch.
Bootstrap.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @codeCoverageIgnore
37 37
  */
38
-call_user_func( function () {
38
+call_user_func(function() {
39 39
 
40
-	if ( !defined( 'MEDIAWIKI' ) ) {
41
-		die( 'This file is part of the MediaWiki extension Bootstrap, it is not a valid entry point.' );
40
+	if (!defined('MEDIAWIKI')) {
41
+		die('This file is part of the MediaWiki extension Bootstrap, it is not a valid entry point.');
42 42
 	}
43 43
 
44
-	if ( version_compare( $GLOBALS[ 'wgVersion' ], '1.22', 'lt' ) ) {
45
-		die( '<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Bootstrap">Bootstrap</a> is only compatible with MediaWiki 1.22 or above. You need to upgrade MediaWiki first.' );
44
+	if (version_compare($GLOBALS['wgVersion'], '1.22', 'lt')) {
45
+		die('<b>Error:</b> This version of <a href="https://www.mediawiki.org/wiki/Extension:Bootstrap">Bootstrap</a> is only compatible with MediaWiki 1.22 or above. You need to upgrade MediaWiki first.');
46 46
 	}
47 47
 
48 48
 	/**
49 49
 	 * The extension version
50 50
 	 */
51
-	define( 'BS_VERSION', '1.3.0' );
51
+	define('BS_VERSION', '1.3.0');
52 52
 
53 53
 	// register the extension
54
-	$GLOBALS[ 'wgExtensionCredits' ][ 'other' ][ ] = array(
54
+	$GLOBALS['wgExtensionCredits']['other'][] = array(
55 55
 		'path'           => __FILE__,
56 56
 		'name'           => 'Bootstrap',
57
-		'author' => array( '[https://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', 'James Hong Kong' ),
57
+		'author' => array('[https://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', 'James Hong Kong'),
58 58
 		'url'            => 'https://www.mediawiki.org/wiki/Extension:Bootstrap',
59 59
 		'descriptionmsg' => 'bootstrap-desc',
60 60
 		'version'        => BS_VERSION,
@@ -62,35 +62,35 @@  discard block
 block discarded – undo
62 62
 	);
63 63
 
64 64
 	// register message files
65
-	$GLOBALS[ 'wgMessagesDirs' ][ 'Bootstrap' ] = __DIR__ . '/i18n';
66
-	$GLOBALS[ 'wgExtensionMessagesFiles' ][ 'Bootstrap' ] = __DIR__ . '/Bootstrap.i18n.php';
65
+	$GLOBALS['wgMessagesDirs']['Bootstrap'] = __DIR__ . '/i18n';
66
+	$GLOBALS['wgExtensionMessagesFiles']['Bootstrap'] = __DIR__ . '/Bootstrap.i18n.php';
67 67
 
68 68
 	// register classes
69
-	$GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\ResourceLoaderBootstrapModule' ] = __DIR__ . '/src/ResourceLoaderBootstrapModule.php';
70
-	$GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\BootstrapManager' ]      = __DIR__ . '/src/BootstrapManager.php';
71
-	$GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Hooks\SetupAfterCache' ] = __DIR__ . '/src/Hooks/SetupAfterCache.php';
72
-	$GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\ModuleDefinition' ]   = __DIR__ . '/src/Definition/ModuleDefinition.php';
73
-	$GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\V3ModuleDefinition' ] = __DIR__ . '/src/Definition/V3ModuleDefinition.php';
69
+	$GLOBALS['wgAutoloadClasses']['Bootstrap\ResourceLoaderBootstrapModule'] = __DIR__ . '/src/ResourceLoaderBootstrapModule.php';
70
+	$GLOBALS['wgAutoloadClasses']['Bootstrap\BootstrapManager']      = __DIR__ . '/src/BootstrapManager.php';
71
+	$GLOBALS['wgAutoloadClasses']['Bootstrap\Hooks\SetupAfterCache'] = __DIR__ . '/src/Hooks/SetupAfterCache.php';
72
+	$GLOBALS['wgAutoloadClasses']['Bootstrap\Definition\ModuleDefinition']   = __DIR__ . '/src/Definition/ModuleDefinition.php';
73
+	$GLOBALS['wgAutoloadClasses']['Bootstrap\Definition\V3ModuleDefinition'] = __DIR__ . '/src/Definition/V3ModuleDefinition.php';
74 74
 
75
-	$GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][ ] = function() {
75
+	$GLOBALS['wgHooks']['SetupAfterCache'][] = function() {
76 76
 
77 77
 		$configuration = array();
78
-		$configuration[ 'IP' ] = $GLOBALS[ 'IP' ];
79
-		$configuration[ 'remoteBasePath' ] = $GLOBALS[ 'wgExtensionAssetsPath' ] . '/Bootstrap/resources/bootstrap';
78
+		$configuration['IP'] = $GLOBALS['IP'];
79
+		$configuration['remoteBasePath'] = $GLOBALS['wgExtensionAssetsPath'] . '/Bootstrap/resources/bootstrap';
80 80
 
81
-		if ( isset( $GLOBALS[ 'wgExtensionDirectory' ] ) ) { // MW >= 1.25
82
-			$configuration[ 'localBasePath' ] = $GLOBALS[ 'wgExtensionDirectory' ] . '/Bootstrap/resources/bootstrap';
81
+		if (isset($GLOBALS['wgExtensionDirectory'])) { // MW >= 1.25
82
+			$configuration['localBasePath'] = $GLOBALS['wgExtensionDirectory'] . '/Bootstrap/resources/bootstrap';
83 83
 		} else {
84
-			$configuration[ 'localBasePath' ] = __DIR__ . '/resources/bootstrap';
84
+			$configuration['localBasePath'] = __DIR__ . '/resources/bootstrap';
85 85
 		}
86 86
 
87
-		$setupAfterCache = new \Bootstrap\Hooks\SetupAfterCache( $configuration );
87
+		$setupAfterCache = new \Bootstrap\Hooks\SetupAfterCache($configuration);
88 88
 		$setupAfterCache->process();
89 89
 	};
90 90
 
91 91
 	// register skeleton resource module with the Resource Loader
92 92
 	// do not add paths, globals are not set yet
93
-	$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array(
93
+	$GLOBALS['wgResourceModules']['ext.bootstrap.styles'] = array(
94 94
 		'class'          => 'Bootstrap\ResourceLoaderBootstrapModule',
95 95
 		'position'       => 'top',
96 96
 		'styles'         => array(),
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		),
103 103
 	);
104 104
 
105
-	$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] = array(
105
+	$GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] = array(
106 106
 		'scripts'        => array(),
107 107
 	);
108 108
 
109
-	$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap' ] = array(
110
-		'dependencies' => array( 'ext.bootstrap.styles', 'ext.bootstrap.scripts' ),
109
+	$GLOBALS['wgResourceModules']['ext.bootstrap'] = array(
110
+		'dependencies' => array('ext.bootstrap.styles', 'ext.bootstrap.scripts'),
111 111
 	);
112 112
 
113 113
 } );
Please login to merge, or discard this patch.