@@ -6,36 +6,36 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0 |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
10 | - 'S' => |
|
11 | - array ( |
|
12 | - 'ScssPhp\\ScssPhp\\' => 16, |
|
13 | - 'SCSS\\Tests\\' => 11, |
|
14 | - 'SCSS\\' => 5, |
|
15 | - ), |
|
16 | - ); |
|
9 | + public static $prefixLengthsPsr4 = array ( |
|
10 | + 'S' => |
|
11 | + array ( |
|
12 | + 'ScssPhp\\ScssPhp\\' => 16, |
|
13 | + 'SCSS\\Tests\\' => 11, |
|
14 | + 'SCSS\\' => 5, |
|
15 | + ), |
|
16 | + ); |
|
17 | 17 | |
18 | - public static $prefixDirsPsr4 = array ( |
|
19 | - 'ScssPhp\\ScssPhp\\' => |
|
20 | - array ( |
|
21 | - 0 => __DIR__ . '/..' . '/scssphp/scssphp/src', |
|
22 | - ), |
|
23 | - 'SCSS\\Tests\\' => |
|
24 | - array ( |
|
25 | - 0 => __DIR__ . '/..' . '/mediawiki/scss/tests/phpunit', |
|
26 | - ), |
|
27 | - 'SCSS\\' => |
|
28 | - array ( |
|
29 | - 0 => __DIR__ . '/..' . '/mediawiki/scss/src', |
|
30 | - ), |
|
31 | - ); |
|
18 | + public static $prefixDirsPsr4 = array ( |
|
19 | + 'ScssPhp\\ScssPhp\\' => |
|
20 | + array ( |
|
21 | + 0 => __DIR__ . '/..' . '/scssphp/scssphp/src', |
|
22 | + ), |
|
23 | + 'SCSS\\Tests\\' => |
|
24 | + array ( |
|
25 | + 0 => __DIR__ . '/..' . '/mediawiki/scss/tests/phpunit', |
|
26 | + ), |
|
27 | + 'SCSS\\' => |
|
28 | + array ( |
|
29 | + 0 => __DIR__ . '/..' . '/mediawiki/scss/src', |
|
30 | + ), |
|
31 | + ); |
|
32 | 32 | |
33 | - public static function getInitializer(ClassLoader $loader) |
|
34 | - { |
|
35 | - return \Closure::bind(function () use ($loader) { |
|
36 | - $loader->prefixLengthsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixLengthsPsr4; |
|
37 | - $loader->prefixDirsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixDirsPsr4; |
|
33 | + public static function getInitializer(ClassLoader $loader) |
|
34 | + { |
|
35 | + return \Closure::bind(function () use ($loader) { |
|
36 | + $loader->prefixLengthsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixLengthsPsr4; |
|
37 | + $loader->prefixDirsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixDirsPsr4; |
|
38 | 38 | |
39 | - }, null, ClassLoader::class); |
|
40 | - } |
|
39 | + }, null, ClassLoader::class); |
|
40 | + } |
|
41 | 41 | } |
@@ -6,33 +6,33 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0 |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'S' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'ScssPhp\\ScssPhp\\' => 16, |
13 | 13 | 'SCSS\\Tests\\' => 11, |
14 | 14 | 'SCSS\\' => 5, |
15 | 15 | ), |
16 | 16 | ); |
17 | 17 | |
18 | - public static $prefixDirsPsr4 = array ( |
|
18 | + public static $prefixDirsPsr4 = array( |
|
19 | 19 | 'ScssPhp\\ScssPhp\\' => |
20 | - array ( |
|
20 | + array( |
|
21 | 21 | 0 => __DIR__ . '/..' . '/scssphp/scssphp/src', |
22 | 22 | ), |
23 | 23 | 'SCSS\\Tests\\' => |
24 | - array ( |
|
24 | + array( |
|
25 | 25 | 0 => __DIR__ . '/..' . '/mediawiki/scss/tests/phpunit', |
26 | 26 | ), |
27 | 27 | 'SCSS\\' => |
28 | - array ( |
|
28 | + array( |
|
29 | 29 | 0 => __DIR__ . '/..' . '/mediawiki/scss/src', |
30 | 30 | ), |
31 | 31 | ); |
32 | 32 | |
33 | 33 | public static function getInitializer(ClassLoader $loader) |
34 | 34 | { |
35 | - return \Closure::bind(function () use ($loader) { |
|
35 | + return \Closure::bind(function() use ($loader) { |
|
36 | 36 | $loader->prefixLengthsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixLengthsPsr4; |
37 | 37 | $loader->prefixDirsPsr4 = ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::$prefixDirsPsr4; |
38 | 38 |
@@ -4,49 +4,49 @@ |
||
4 | 4 | |
5 | 5 | class ComposerAutoloaderInitcfde1b79fcf8c357dcf292f5aa2962d0 |
6 | 6 | { |
7 | - private static $loader; |
|
8 | - |
|
9 | - public static function loadClassLoader($class) |
|
10 | - { |
|
11 | - if ('Composer\Autoload\ClassLoader' === $class) { |
|
12 | - require __DIR__ . '/ClassLoader.php'; |
|
13 | - } |
|
14 | - } |
|
15 | - |
|
16 | - public static function getLoader() |
|
17 | - { |
|
18 | - if (null !== self::$loader) { |
|
19 | - return self::$loader; |
|
20 | - } |
|
21 | - |
|
22 | - spl_autoload_register(array('ComposerAutoloaderInitcfde1b79fcf8c357dcf292f5aa2962d0', 'loadClassLoader'), true, true); |
|
23 | - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); |
|
24 | - spl_autoload_unregister(array('ComposerAutoloaderInitcfde1b79fcf8c357dcf292f5aa2962d0', 'loadClassLoader')); |
|
25 | - |
|
26 | - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); |
|
27 | - if ($useStaticLoader) { |
|
28 | - require_once __DIR__ . '/autoload_static.php'; |
|
29 | - |
|
30 | - call_user_func(\Composer\Autoload\ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::getInitializer($loader)); |
|
31 | - } else { |
|
32 | - $map = require __DIR__ . '/autoload_namespaces.php'; |
|
33 | - foreach ($map as $namespace => $path) { |
|
34 | - $loader->set($namespace, $path); |
|
35 | - } |
|
36 | - |
|
37 | - $map = require __DIR__ . '/autoload_psr4.php'; |
|
38 | - foreach ($map as $namespace => $path) { |
|
39 | - $loader->setPsr4($namespace, $path); |
|
40 | - } |
|
41 | - |
|
42 | - $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
43 | - if ($classMap) { |
|
44 | - $loader->addClassMap($classMap); |
|
45 | - } |
|
46 | - } |
|
47 | - |
|
48 | - $loader->register(true); |
|
49 | - |
|
50 | - return $loader; |
|
51 | - } |
|
7 | + private static $loader; |
|
8 | + |
|
9 | + public static function loadClassLoader($class) |
|
10 | + { |
|
11 | + if ('Composer\Autoload\ClassLoader' === $class) { |
|
12 | + require __DIR__ . '/ClassLoader.php'; |
|
13 | + } |
|
14 | + } |
|
15 | + |
|
16 | + public static function getLoader() |
|
17 | + { |
|
18 | + if (null !== self::$loader) { |
|
19 | + return self::$loader; |
|
20 | + } |
|
21 | + |
|
22 | + spl_autoload_register(array('ComposerAutoloaderInitcfde1b79fcf8c357dcf292f5aa2962d0', 'loadClassLoader'), true, true); |
|
23 | + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); |
|
24 | + spl_autoload_unregister(array('ComposerAutoloaderInitcfde1b79fcf8c357dcf292f5aa2962d0', 'loadClassLoader')); |
|
25 | + |
|
26 | + $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); |
|
27 | + if ($useStaticLoader) { |
|
28 | + require_once __DIR__ . '/autoload_static.php'; |
|
29 | + |
|
30 | + call_user_func(\Composer\Autoload\ComposerStaticInitcfde1b79fcf8c357dcf292f5aa2962d0::getInitializer($loader)); |
|
31 | + } else { |
|
32 | + $map = require __DIR__ . '/autoload_namespaces.php'; |
|
33 | + foreach ($map as $namespace => $path) { |
|
34 | + $loader->set($namespace, $path); |
|
35 | + } |
|
36 | + |
|
37 | + $map = require __DIR__ . '/autoload_psr4.php'; |
|
38 | + foreach ($map as $namespace => $path) { |
|
39 | + $loader->setPsr4($namespace, $path); |
|
40 | + } |
|
41 | + |
|
42 | + $classMap = require __DIR__ . '/autoload_classmap.php'; |
|
43 | + if ($classMap) { |
|
44 | + $loader->addClassMap($classMap); |
|
45 | + } |
|
46 | + } |
|
47 | + |
|
48 | + $loader->register(true); |
|
49 | + |
|
50 | + return $loader; |
|
51 | + } |
|
52 | 52 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * @param string|null $localBasePath |
74 | 74 | * @param string|null $remoteBasePath |
75 | 75 | */ |
76 | - public function __construct( $options = [], $localBasePath = null, $remoteBasePath = null ) { |
|
76 | + public function __construct($options = [], $localBasePath = null, $remoteBasePath = null) { |
|
77 | 77 | |
78 | - parent::__construct( $options, $localBasePath, $remoteBasePath ); |
|
78 | + parent::__construct($options, $localBasePath, $remoteBasePath); |
|
79 | 79 | |
80 | - $this->applyOptions( $options ); |
|
80 | + $this->applyOptions($options); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * @param mixed[] $options |
85 | 85 | */ |
86 | - protected function applyOptions( $options ) { |
|
86 | + protected function applyOptions($options) { |
|
87 | 87 | |
88 | 88 | $mapConfigToLocalVar = [ |
89 | 89 | 'variables' => 'variables', |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | 'cacheTriggers' => 'cacheTriggers', |
92 | 92 | ]; |
93 | 93 | |
94 | - foreach ( $mapConfigToLocalVar as $config => $local ) { |
|
95 | - if ( isset( $options[ $config ] ) ) { |
|
96 | - $this->$local = $options[ $config ]; |
|
94 | + foreach ($mapConfigToLocalVar as $config => $local) { |
|
95 | + if (isset($options[$config])) { |
|
96 | + $this->$local = $options[$config]; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
@@ -105,40 +105,40 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return array |
107 | 107 | */ |
108 | - public function getStyles( ResourceLoaderContext $context ) { |
|
108 | + public function getStyles(ResourceLoaderContext $context) { |
|
109 | 109 | |
110 | - if ( $this->styleText === null ) { |
|
110 | + if ($this->styleText === null) { |
|
111 | 111 | |
112 | - $this->retrieveStylesFromCache( $context ); |
|
112 | + $this->retrieveStylesFromCache($context); |
|
113 | 113 | |
114 | - if ( $this->styleText === null ) { |
|
115 | - $this->compileStyles( $context ); |
|
114 | + if ($this->styleText === null) { |
|
115 | + $this->compileStyles($context); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - return [ 'all' => $this->styleText ]; |
|
119 | + return ['all' => $this->styleText]; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @param ResourceLoaderContext $context |
124 | 124 | */ |
125 | - protected function retrieveStylesFromCache( ResourceLoaderContext $context ) { |
|
125 | + protected function retrieveStylesFromCache(ResourceLoaderContext $context) { |
|
126 | 126 | |
127 | 127 | // Try for cache hit |
128 | - $cacheKey = $this->getCacheKey( $context ); |
|
129 | - $cacheResult = $this->getCache()->get( $cacheKey ); |
|
128 | + $cacheKey = $this->getCacheKey($context); |
|
129 | + $cacheResult = $this->getCache()->get($cacheKey); |
|
130 | 130 | |
131 | - if ( is_array( $cacheResult ) ) { |
|
131 | + if (is_array($cacheResult)) { |
|
132 | 132 | |
133 | - if ( $this->isCacheOutdated( $cacheResult[ 'storetime' ] ) ) { |
|
134 | - wfDebug( "SCSS: Cache miss for {$this->getName()}: Cache outdated.\n", 'private' ); |
|
133 | + if ($this->isCacheOutdated($cacheResult['storetime'])) { |
|
134 | + wfDebug("SCSS: Cache miss for {$this->getName()}: Cache outdated.\n", 'private'); |
|
135 | 135 | } else { |
136 | - $this->styleText = $cacheResult[ 'styles' ]; |
|
137 | - wfDebug( "SCSS: Cache hit for {$this->getName()}: Got styles from cache.\n", 'private' ); |
|
136 | + $this->styleText = $cacheResult['styles']; |
|
137 | + wfDebug("SCSS: Cache hit for {$this->getName()}: Got styles from cache.\n", 'private'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } else { |
141 | - wfDebug( "SCSS: Cache miss for {$this->getName()}: Styles not found in cache.\n", 'private' ); |
|
141 | + wfDebug("SCSS: Cache miss for {$this->getName()}: Styles not found in cache.\n", 'private'); |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function getCache() { |
149 | 149 | |
150 | - if ( $this->cache === null ) { |
|
151 | - $this->cache = ObjectCache::getInstance( $this->getCacheType() ); |
|
150 | + if ($this->cache === null) { |
|
151 | + $this->cache = ObjectCache::getInstance($this->getCacheType()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return $this->cache; |
155 | 155 | } |
156 | 156 | |
157 | 157 | private function getCacheType() { |
158 | - return array_key_exists( 'egScssCacheType', $GLOBALS ) ? $GLOBALS[ 'egScssCacheType' ] : -1; |
|
158 | + return array_key_exists('egScssCacheType', $GLOBALS) ? $GLOBALS['egScssCacheType'] : -1; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @param BagOStuff $cache |
165 | 165 | */ |
166 | - public function setCache( BagOStuff $cache ) { |
|
166 | + public function setCache(BagOStuff $cache) { |
|
167 | 167 | $this->cache = $cache; |
168 | 168 | } |
169 | 169 | |
@@ -172,18 +172,18 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - protected function getCacheKey( ResourceLoaderContext $context ) { |
|
175 | + protected function getCacheKey(ResourceLoaderContext $context) { |
|
176 | 176 | |
177 | - if ( $this->cacheKey === null ) { |
|
177 | + if ($this->cacheKey === null) { |
|
178 | 178 | |
179 | - $styles = serialize( $this->styles ); |
|
179 | + $styles = serialize($this->styles); |
|
180 | 180 | |
181 | 181 | $vars = $this->variables; |
182 | - ksort( $vars ); |
|
183 | - $vars = serialize( $vars ); |
|
182 | + ksort($vars); |
|
183 | + $vars = serialize($vars); |
|
184 | 184 | |
185 | 185 | // have to hash the module config, else it may become too long |
186 | - $configHash = md5( $styles . $vars ); |
|
186 | + $configHash = md5($styles . $vars); |
|
187 | 187 | |
188 | 188 | $this->cacheKey = wfMemcKey( |
189 | 189 | 'ext', |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return bool |
203 | 203 | */ |
204 | - protected function isCacheOutdated( $cacheStoreTime ) { |
|
204 | + protected function isCacheOutdated($cacheStoreTime) { |
|
205 | 205 | |
206 | - foreach ( $this->cacheTriggers as $triggerFile ) { |
|
206 | + foreach ($this->cacheTriggers as $triggerFile) { |
|
207 | 207 | |
208 | - if ( $triggerFile !== null && $cacheStoreTime < filemtime( $triggerFile ) ) { |
|
208 | + if ($triggerFile !== null && $cacheStoreTime < filemtime($triggerFile)) { |
|
209 | 209 | return true; |
210 | 210 | } |
211 | 211 | |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * @param ResourceLoaderContext $context |
219 | 219 | */ |
220 | - protected function compileStyles( ResourceLoaderContext $context ) { |
|
220 | + protected function compileStyles(ResourceLoaderContext $context) { |
|
221 | 221 | |
222 | 222 | $scss = new Compiler(); |
223 | - $scss->setImportPaths( $this->getLocalPath( '' ) ); |
|
223 | + $scss->setImportPaths($this->getLocalPath('')); |
|
224 | 224 | |
225 | 225 | // Allows inlining of arbitrary files regardless of extension, .css in particular |
226 | 226 | $scss->addImportPath( |
227 | 227 | |
228 | 228 | // addImportPath is declared as requiring a string param, but actually also understand callables |
229 | 229 | /** @scrutinizer ignore-type */ |
230 | - function ( $path ) { |
|
231 | - if ( file_exists( $path ) ) { |
|
230 | + function($path) { |
|
231 | + if (file_exists($path)) { |
|
232 | 232 | return $path; |
233 | 233 | } |
234 | 234 | return null; |
@@ -240,27 +240,27 @@ discard block |
||
240 | 240 | |
241 | 241 | $imports = $this->getStyleFilesList(); |
242 | 242 | |
243 | - foreach ( $imports as $key => $import ) { |
|
244 | - $path = str_replace( [ '\\', '"' ], [ '\\\\', '\\"' ], $import ); |
|
245 | - $imports[ $key ] = '@import "' . $path . '";'; |
|
243 | + foreach ($imports as $key => $import) { |
|
244 | + $path = str_replace(['\\', '"'], ['\\\\', '\\"'], $import); |
|
245 | + $imports[$key] = '@import "' . $path . '";'; |
|
246 | 246 | } |
247 | 247 | |
248 | - $scss->setVariables( $this->variables ); |
|
248 | + $scss->setVariables($this->variables); |
|
249 | 249 | |
250 | - $style = $scss->compile( implode( $imports ) ); |
|
250 | + $style = $scss->compile(implode($imports)); |
|
251 | 251 | |
252 | - if ( $this->getFlip( $context ) ) { |
|
253 | - $style = CSSJanus::transform( $style, true, false ); |
|
252 | + if ($this->getFlip($context)) { |
|
253 | + $style = CSSJanus::transform($style, true, false); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | $this->styleText = $style; |
257 | 257 | |
258 | - $this->updateCache( $context ); |
|
258 | + $this->updateCache($context); |
|
259 | 259 | |
260 | - } catch ( Exception $e ) { |
|
260 | + } catch (Exception $e) { |
|
261 | 261 | |
262 | - $this->purgeCache( $context ); |
|
263 | - wfDebug( $e->getMessage() ); |
|
262 | + $this->purgeCache($context); |
|
263 | + wfDebug($e->getMessage()); |
|
264 | 264 | $this->styleText = '/* SCSS compile error: ' . $e->getMessage() . '*/'; |
265 | 265 | } |
266 | 266 | |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | /** |
270 | 270 | * @param ResourceLoaderContext $context |
271 | 271 | */ |
272 | - protected function updateCache( ResourceLoaderContext $context ) { |
|
272 | + protected function updateCache(ResourceLoaderContext $context) { |
|
273 | 273 | |
274 | 274 | $this->getCache()->set( |
275 | - $this->getCacheKey( $context ), |
|
276 | - [ 'styles' => $this->styleText, 'storetime' => time() ] |
|
275 | + $this->getCacheKey($context), |
|
276 | + ['styles' => $this->styleText, 'storetime' => time()] |
|
277 | 277 | ); |
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | 281 | * @param ResourceLoaderContext $context |
282 | 282 | */ |
283 | - protected function purgeCache( ResourceLoaderContext $context ) { |
|
284 | - $this->getCache()->delete( $this->getCacheKey( $context ) ); |
|
283 | + protected function purgeCache(ResourceLoaderContext $context) { |
|
284 | + $this->getCache()->delete($this->getCacheKey($context)); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | * @return array |
296 | 296 | */ |
297 | 297 | protected function getStyleFilesList() { |
298 | - $styles = self::collateFilePathListByOption( $this->styles, 'position', 'main' ); |
|
298 | + $styles = self::collateFilePathListByOption($this->styles, 'position', 'main'); |
|
299 | 299 | $imports = []; |
300 | 300 | |
301 | - foreach ( $this->styleModulePositions as $position ) { |
|
302 | - if ( isset( $styles[ $position ] ) ) { |
|
303 | - $imports = array_merge( $imports, $styles[ $position ] ); |
|
301 | + foreach ($this->styleModulePositions as $position) { |
|
302 | + if (isset($styles[$position])) { |
|
303 | + $imports = array_merge($imports, $styles[$position]); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 |