@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @param ModuleDefinition $moduleDefinition |
| 51 | 51 | */ |
| 52 | - public function __construct( ModuleDefinition $moduleDefinition ) { |
|
| 52 | + public function __construct(ModuleDefinition $moduleDefinition) { |
|
| 53 | 53 | $this->moduleDefinition = $moduleDefinition; |
| 54 | - $this->moduleDescriptions = $this->moduleDefinition->get( 'descriptions' ); |
|
| 54 | + $this->moduleDescriptions = $this->moduleDefinition->get('descriptions'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public static function getInstance() { |
| 65 | 65 | |
| 66 | - if ( self::$instance === null ) { |
|
| 67 | - self::$instance = new self( new V4ModuleDefinition ); |
|
| 66 | + if (self::$instance === null) { |
|
| 67 | + self::$instance = new self(new V4ModuleDefinition); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | return self::$instance; |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @param string|string[] $modules |
| 86 | 86 | */ |
| 87 | - public function addBootstrapModule( $modules ) { |
|
| 87 | + public function addBootstrapModule($modules) { |
|
| 88 | 88 | |
| 89 | 89 | $modules = (array) $modules; |
| 90 | 90 | |
| 91 | - foreach ( $modules as $module ) { |
|
| 91 | + foreach ($modules as $module) { |
|
| 92 | 92 | |
| 93 | 93 | // if the module is known |
| 94 | - if ( isset( $this->moduleDescriptions[ $module ] ) ) { |
|
| 94 | + if (isset($this->moduleDescriptions[$module])) { |
|
| 95 | 95 | |
| 96 | - $description = $this->moduleDescriptions[ $module ]; |
|
| 96 | + $description = $this->moduleDescriptions[$module]; |
|
| 97 | 97 | |
| 98 | 98 | // prevent adding this module again; this also prevents infinite recursion in case |
| 99 | 99 | // of dependency resolution |
| 100 | - unset( $this->moduleDescriptions[ $module ] ); |
|
| 100 | + unset($this->moduleDescriptions[$module]); |
|
| 101 | 101 | |
| 102 | 102 | // first add any dependencies recursively, so they are available when the styles and |
| 103 | 103 | // scripts of $module are loaded |
| 104 | - if ( isset( $description[ 'dependencies' ] ) ) { |
|
| 105 | - $this->addBootstrapModule( $description[ 'dependencies' ] ); |
|
| 104 | + if (isset($description['dependencies'])) { |
|
| 105 | + $this->addBootstrapModule($description['dependencies']); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $this->addFilesToGlobalResourceModules( 'styles', $description ); |
|
| 109 | - $this->addFilesToGlobalResourceModules( 'scripts', $description ); |
|
| 108 | + $this->addFilesToGlobalResourceModules('styles', $description); |
|
| 109 | + $this->addFilesToGlobalResourceModules('scripts', $description); |
|
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | * @param string $filetype 'styles'|'scripts' |
| 118 | 118 | * @param mixed[] $description |
| 119 | 119 | */ |
| 120 | - protected function addFilesToGlobalResourceModules ( $filetype, $description ) { |
|
| 120 | + protected function addFilesToGlobalResourceModules($filetype, $description) { |
|
| 121 | 121 | |
| 122 | - if ( isset( $description[ $filetype ] ) ) { |
|
| 122 | + if (isset($description[$filetype])) { |
|
| 123 | 123 | |
| 124 | - $this->adjustArrayElementOfResourceModuleDescription( $filetype, $description[ $filetype ], $filetype ); |
|
| 124 | + $this->adjustArrayElementOfResourceModuleDescription($filetype, $description[$filetype], $filetype); |
|
| 125 | 125 | |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @since 2.0 |
| 133 | 133 | */ |
| 134 | 134 | public function addCoreBootstrapModules() { |
| 135 | - $this->addBootstrapModule( $this->moduleDefinition->get( 'core' ) ); |
|
| 135 | + $this->addBootstrapModule($this->moduleDefinition->get('core')); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * @since 1.0 |
| 142 | 142 | */ |
| 143 | 143 | public function addAllBootstrapModules() { |
| 144 | - $this->addBootstrapModule( $this->moduleDefinition->get( 'optional' ) ); |
|
| 144 | + $this->addBootstrapModule($this->moduleDefinition->get('optional')); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @internal param string $path |
| 154 | 154 | */ |
| 155 | - public function addStyleFile( $path, $position = 'main' ) { |
|
| 156 | - $this->adjustArrayElementOfResourceModuleDescription( 'styles', [ $path => [ 'position' => $position ] ] ); |
|
| 155 | + public function addStyleFile($path, $position = 'main') { |
|
| 156 | + $this->adjustArrayElementOfResourceModuleDescription('styles', [$path => ['position' => $position]]); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | * @param string $key the SCSS variable name |
| 163 | 163 | * @param string $value the value to assign to the variable |
| 164 | 164 | */ |
| 165 | - public function setScssVariable( $key, $value ) { |
|
| 166 | - $this->setScssVariables( [ $key => $value ] ); |
|
| 165 | + public function setScssVariable($key, $value) { |
|
| 166 | + $this->setScssVariables([$key => $value]); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -171,16 +171,16 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @param mixed[] $variables |
| 173 | 173 | */ |
| 174 | - public function setScssVariables( $variables ) { |
|
| 175 | - $this->adjustArrayElementOfResourceModuleDescription( 'variables', $variables ); |
|
| 174 | + public function setScssVariables($variables) { |
|
| 175 | + $this->adjustArrayElementOfResourceModuleDescription('variables', $variables); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * @since 1.1 |
| 180 | 180 | * @param string|string[] $files |
| 181 | 181 | */ |
| 182 | - public function addCacheTriggerFile( $files ){ |
|
| 183 | - $this->adjustArrayElementOfResourceModuleDescription( 'cacheTriggers', $files ); |
|
| 182 | + public function addCacheTriggerFile($files) { |
|
| 183 | + $this->adjustArrayElementOfResourceModuleDescription('cacheTriggers', $files); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | * @param mixed $value |
| 189 | 189 | * @param string $filetype 'styles'|'scripts' |
| 190 | 190 | */ |
| 191 | - protected function adjustArrayElementOfResourceModuleDescription( $key, $value, $filetype = 'styles' ) { |
|
| 191 | + protected function adjustArrayElementOfResourceModuleDescription($key, $value, $filetype = 'styles') { |
|
| 192 | 192 | |
| 193 | - if (!isset($GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ])) { |
|
| 194 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] = []; |
|
| 193 | + if (!isset($GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key])) { |
|
| 194 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] = []; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ] = |
|
| 197 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key] = |
|
| 198 | 198 | array_merge( |
| 199 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $key ], |
|
| 199 | + $GLOBALS['wgResourceModules']['ext.bootstrap.' . $filetype][$key], |
|
| 200 | 200 | (array) $value |
| 201 | 201 | ); |
| 202 | 202 | } |
@@ -51,16 +51,16 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | public static function init() { |
| 53 | 53 | |
| 54 | - ExtensionRegistryHelper::singleton()->loadExtensionRecursive( 'Scss' ); |
|
| 54 | + ExtensionRegistryHelper::singleton()->loadExtensionRecursive('Scss'); |
|
| 55 | 55 | |
| 56 | - $GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][] = function () { |
|
| 56 | + $GLOBALS['wgHooks']['SetupAfterCache'][] = function() { |
|
| 57 | 57 | |
| 58 | 58 | $configuration = []; |
| 59 | - $configuration[ 'IP' ] = $GLOBALS[ 'IP' ]; |
|
| 60 | - $configuration[ 'remoteBasePath' ] = $GLOBALS[ 'wgExtensionAssetsPath' ] . '/Bootstrap/resources/bootstrap'; |
|
| 61 | - $configuration[ 'localBasePath' ] = $GLOBALS[ 'wgExtensionDirectory' ] . '/Bootstrap/resources/bootstrap'; |
|
| 59 | + $configuration['IP'] = $GLOBALS['IP']; |
|
| 60 | + $configuration['remoteBasePath'] = $GLOBALS['wgExtensionAssetsPath'] . '/Bootstrap/resources/bootstrap'; |
|
| 61 | + $configuration['localBasePath'] = $GLOBALS['wgExtensionDirectory'] . '/Bootstrap/resources/bootstrap'; |
|
| 62 | 62 | |
| 63 | - $setupAfterCache = new SetupAfterCache( $configuration ); |
|
| 63 | + $setupAfterCache = new SetupAfterCache($configuration); |
|
| 64 | 64 | $setupAfterCache->process(); |
| 65 | 65 | }; |
| 66 | 66 | } |
@@ -34,61 +34,61 @@ discard block |
||
| 34 | 34 | class V4ModuleDefinition implements ModuleDefinition { |
| 35 | 35 | |
| 36 | 36 | static private $moduleDescriptions = [ |
| 37 | - 'functions' => [ 'styles' => [ 'functions' => [ 'position' => 'functions' ] ] ], |
|
| 38 | - 'variables' => [ 'styles' => [ 'variables' => [ 'position' => 'variables' ] ], 'dependencies' => 'functions' ], |
|
| 39 | - 'mixins' => [ 'styles' => 'mixins' ], |
|
| 40 | - 'root' => [ 'styles' => 'root' ], |
|
| 41 | - 'reboot' => [ 'styles' => 'reboot' ], |
|
| 42 | - 'type' => [ 'styles' => 'type' ], |
|
| 43 | - 'images' => [ 'styles' => 'images' ], |
|
| 44 | - 'code' => [ 'styles' => 'code' ], |
|
| 45 | - 'grid' => [ 'styles' => 'grid' ], |
|
| 46 | - 'tables' => [ 'styles' => 'tables' ], |
|
| 47 | - 'forms' => [ 'styles' => 'forms' ], |
|
| 48 | - 'buttons' => [ 'styles' => 'buttons' ], |
|
| 49 | - 'transitions' => [ 'styles' => 'transitions' ], |
|
| 50 | - 'dropdown' => [ 'styles' => 'dropdown', 'scripts' => 'dropdown.js', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 51 | - 'button-group' => [ 'styles' => 'button-group', 'dependencies' => [ 'buttons' ] ], |
|
| 52 | - 'input-group' => [ 'styles' => 'input-group', 'dependencies' => [ 'forms' ] ], |
|
| 53 | - 'custom-forms' => [ 'styles' => 'custom-forms' ], |
|
| 54 | - 'nav' => [ 'styles' => 'nav' ], |
|
| 55 | - 'navbar' => [ 'styles' => 'navbar' ], |
|
| 56 | - 'card' => [ 'styles' => 'card' ], |
|
| 57 | - 'breadcrumb' => [ 'styles' => 'breadcrumb' ], |
|
| 58 | - 'pagination' => [ 'styles' => 'pagination' ], |
|
| 59 | - 'badge' => [ 'styles' => 'badge' ], |
|
| 60 | - 'jumbotron' => [ 'styles' => 'jumbotron' ], |
|
| 61 | - 'alert' => [ 'styles' => 'alert' ], |
|
| 62 | - 'progress' => [ 'styles' => 'progress' ], |
|
| 63 | - 'media' => [ 'styles' => 'media' ], |
|
| 64 | - 'list-group' => [ 'styles' => 'list-group' ], |
|
| 65 | - 'close' => [ 'styles' => 'close' ], |
|
| 66 | - 'toasts' => [ 'styles' => 'toasts', 'scripts' => 'toast.js', 'dependencies' => 'js-util' ], |
|
| 67 | - 'modal' => [ 'styles' => 'modal', 'scripts' => 'modal.js' ], |
|
| 68 | - 'tooltip' => [ 'styles' => 'tooltip', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 69 | - 'popover' => [ 'styles' => 'popover', 'dependencies' => [ 'popper', 'tooltip', 'js-util' ] ], |
|
| 70 | - 'carousel' => [ 'styles' => 'carousel', 'scripts' => 'carousel.js', 'dependencies' => 'js-util' ], |
|
| 71 | - 'spinners' => [ 'styles' => 'spinners' ], |
|
| 72 | - 'utilities' => [ 'styles' => 'utilities' ], |
|
| 73 | - 'print' => [ 'styles' => 'print' ], |
|
| 74 | - 'active-buttons' => [ 'scripts' => 'button.js', 'dependencies' => [ 'buttons' ] ], |
|
| 75 | - 'dismissable-alert' => [ 'scripts' => 'alert.js', 'dependencies' => [ 'alert', 'js-util' ] ], |
|
| 76 | - 'collapse' => [ 'scripts' => 'collapse.js' ], |
|
| 77 | - 'scrollspy' => [ 'scripts' => 'scrollspy.js', 'dependencies' => [ 'popper', 'js-util' ] ], |
|
| 78 | - 'tab' => [ 'scripts' => 'tab.js', 'dependencies' => [ 'list-group' ] ], |
|
| 79 | - 'js-util' => [ 'scripts' => 'util.js' ], |
|
| 80 | - 'popper' => [ 'scripts' => 'popper.js' ], |
|
| 37 | + 'functions' => ['styles' => ['functions' => ['position' => 'functions']]], |
|
| 38 | + 'variables' => ['styles' => ['variables' => ['position' => 'variables']], 'dependencies' => 'functions'], |
|
| 39 | + 'mixins' => ['styles' => 'mixins'], |
|
| 40 | + 'root' => ['styles' => 'root'], |
|
| 41 | + 'reboot' => ['styles' => 'reboot'], |
|
| 42 | + 'type' => ['styles' => 'type'], |
|
| 43 | + 'images' => ['styles' => 'images'], |
|
| 44 | + 'code' => ['styles' => 'code'], |
|
| 45 | + 'grid' => ['styles' => 'grid'], |
|
| 46 | + 'tables' => ['styles' => 'tables'], |
|
| 47 | + 'forms' => ['styles' => 'forms'], |
|
| 48 | + 'buttons' => ['styles' => 'buttons'], |
|
| 49 | + 'transitions' => ['styles' => 'transitions'], |
|
| 50 | + 'dropdown' => ['styles' => 'dropdown', 'scripts' => 'dropdown.js', 'dependencies' => ['popper', 'js-util']], |
|
| 51 | + 'button-group' => ['styles' => 'button-group', 'dependencies' => ['buttons']], |
|
| 52 | + 'input-group' => ['styles' => 'input-group', 'dependencies' => ['forms']], |
|
| 53 | + 'custom-forms' => ['styles' => 'custom-forms'], |
|
| 54 | + 'nav' => ['styles' => 'nav'], |
|
| 55 | + 'navbar' => ['styles' => 'navbar'], |
|
| 56 | + 'card' => ['styles' => 'card'], |
|
| 57 | + 'breadcrumb' => ['styles' => 'breadcrumb'], |
|
| 58 | + 'pagination' => ['styles' => 'pagination'], |
|
| 59 | + 'badge' => ['styles' => 'badge'], |
|
| 60 | + 'jumbotron' => ['styles' => 'jumbotron'], |
|
| 61 | + 'alert' => ['styles' => 'alert'], |
|
| 62 | + 'progress' => ['styles' => 'progress'], |
|
| 63 | + 'media' => ['styles' => 'media'], |
|
| 64 | + 'list-group' => ['styles' => 'list-group'], |
|
| 65 | + 'close' => ['styles' => 'close'], |
|
| 66 | + 'toasts' => ['styles' => 'toasts', 'scripts' => 'toast.js', 'dependencies' => 'js-util'], |
|
| 67 | + 'modal' => ['styles' => 'modal', 'scripts' => 'modal.js'], |
|
| 68 | + 'tooltip' => ['styles' => 'tooltip', 'dependencies' => ['popper', 'js-util']], |
|
| 69 | + 'popover' => ['styles' => 'popover', 'dependencies' => ['popper', 'tooltip', 'js-util']], |
|
| 70 | + 'carousel' => ['styles' => 'carousel', 'scripts' => 'carousel.js', 'dependencies' => 'js-util'], |
|
| 71 | + 'spinners' => ['styles' => 'spinners'], |
|
| 72 | + 'utilities' => ['styles' => 'utilities'], |
|
| 73 | + 'print' => ['styles' => 'print'], |
|
| 74 | + 'active-buttons' => ['scripts' => 'button.js', 'dependencies' => ['buttons']], |
|
| 75 | + 'dismissable-alert' => ['scripts' => 'alert.js', 'dependencies' => ['alert', 'js-util']], |
|
| 76 | + 'collapse' => ['scripts' => 'collapse.js'], |
|
| 77 | + 'scrollspy' => ['scripts' => 'scrollspy.js', 'dependencies' => ['popper', 'js-util']], |
|
| 78 | + 'tab' => ['scripts' => 'tab.js', 'dependencies' => ['list-group']], |
|
| 79 | + 'js-util' => ['scripts' => 'util.js'], |
|
| 80 | + 'popper' => ['scripts' => 'popper.js'], |
|
| 81 | 81 | |
| 82 | - 'bs-core' => [ 'dependencies' => [ 'variables', 'mixins' ] ], |
|
| 83 | - 'bs-reboot' => [ 'dependencies' => [ 'bs-core', 'reboot' ] ], |
|
| 84 | - 'bs-grid' => [ 'styles' => 'bootstrap-grid' ], |
|
| 82 | + 'bs-core' => ['dependencies' => ['variables', 'mixins']], |
|
| 83 | + 'bs-reboot' => ['dependencies' => ['bs-core', 'reboot']], |
|
| 84 | + 'bs-grid' => ['styles' => 'bootstrap-grid'], |
|
| 85 | 85 | |
| 86 | - 'bs-basic' => [ 'dependencies' => [ |
|
| 86 | + 'bs-basic' => ['dependencies' => [ |
|
| 87 | 87 | 'bs-core', 'root', 'reboot', 'type', 'images', 'code', 'grid', |
| 88 | 88 | 'tables', 'transitions', 'utilities', 'print' |
| 89 | - ] ], |
|
| 89 | + ]], |
|
| 90 | 90 | |
| 91 | - 'bs-all' => [ 'dependencies' => [ |
|
| 91 | + 'bs-all' => ['dependencies' => [ |
|
| 92 | 92 | 'bs-core', 'root', 'reboot', 'type', 'images', 'code', 'grid', |
| 93 | 93 | 'tables', 'forms', 'buttons', 'transitions', 'dropdown', |
| 94 | 94 | 'button-group', 'input-group', 'custom-forms', 'nav', 'navbar', |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'progress', 'media', 'list-group', 'close', 'toasts', 'modal', 'tooltip', |
| 97 | 97 | 'popover', 'carousel', 'spinners', 'utilities', 'print', 'active-buttons', |
| 98 | 98 | 'dismissable-alert', 'collapse', 'scrollspy', 'tab', 'js-util', |
| 99 | - ] ], |
|
| 99 | + ]], |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | // TODO: Add each SCSS util separately? |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | ]; |
| 106 | 106 | |
| 107 | - static private $coreModules = [ 'bs-core' ]; |
|
| 108 | - static private $optionalModules = [ 'bs-all' ]; |
|
| 107 | + static private $coreModules = ['bs-core']; |
|
| 108 | + static private $optionalModules = ['bs-all']; |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * @see ModuleDefinition::get |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | * @return array |
| 118 | 118 | * @throws InvalidArgumentException |
| 119 | 119 | */ |
| 120 | - public function get( $key ) { |
|
| 120 | + public function get($key) { |
|
| 121 | 121 | |
| 122 | - switch ( $key ) { |
|
| 122 | + switch ($key) { |
|
| 123 | 123 | case 'core': |
| 124 | 124 | return self::$coreModules; |
| 125 | 125 | case 'optional': |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return self::$moduleDescriptions; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - throw new InvalidArgumentException( 'Expected a valid key' ); |
|
| 131 | + throw new InvalidArgumentException('Expected a valid key'); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param mixed[] $configuration |
| 50 | 50 | */ |
| 51 | - public function __construct( array $configuration ) { |
|
| 51 | + public function __construct(array $configuration) { |
|
| 52 | 52 | $this->configuration = $configuration; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | $this->assertAcceptableConfiguration(); |
| 68 | 68 | |
| 69 | 69 | $this->registerResourceLoaderModules( |
| 70 | - $this->isReadablePath( $this->configuration['localBasePath'] ), |
|
| 71 | - $this->configuration[ 'remoteBasePath' ] |
|
| 70 | + $this->isReadablePath($this->configuration['localBasePath']), |
|
| 71 | + $this->configuration['remoteBasePath'] |
|
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | 74 | $this->registerCacheTriggers(); |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | * @param string $localBasePath |
| 83 | 83 | * @param string $remoteBasePath |
| 84 | 84 | */ |
| 85 | - protected function registerResourceLoaderModules( $localBasePath, $remoteBasePath ) { |
|
| 85 | + protected function registerResourceLoaderModules($localBasePath, $remoteBasePath) { |
|
| 86 | 86 | |
| 87 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array_replace_recursive( |
|
| 87 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles'] = array_replace_recursive( |
|
| 88 | 88 | [ |
| 89 | 89 | 'localBasePath' => $localBasePath . '/scss', |
| 90 | 90 | 'remoteBasePath' => $remoteBasePath . '/scss', |
@@ -98,20 +98,20 @@ discard block |
||
| 98 | 98 | 'composer.lock' => null, |
| 99 | 99 | ], |
| 100 | 100 | ], |
| 101 | - array_keys( $GLOBALS[ 'wgResourceModules' ], 'ext.bootstrap.styles' ) ? $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] : [] |
|
| 101 | + array_keys($GLOBALS['wgResourceModules'], 'ext.bootstrap.styles') ? $GLOBALS['wgResourceModules']['ext.bootstrap.styles'] : [] |
|
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] = array_replace_recursive( |
|
| 104 | + $GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] = array_replace_recursive( |
|
| 105 | 105 | [ |
| 106 | 106 | 'localBasePath' => $localBasePath . '/js', |
| 107 | 107 | 'remoteBasePath' => $remoteBasePath . '/js', |
| 108 | 108 | 'scripts' => [], |
| 109 | 109 | ], |
| 110 | - array_keys( $GLOBALS[ 'wgResourceModules' ], 'ext.bootstrap.scripts' ) ? $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] : [] |
|
| 110 | + array_keys($GLOBALS['wgResourceModules'], 'ext.bootstrap.scripts') ? $GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] : [] |
|
| 111 | 111 | ); |
| 112 | 112 | |
| 113 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap' ] = [ |
|
| 114 | - 'dependencies' => [ 'ext.bootstrap.styles', 'ext.bootstrap.scripts' ], |
|
| 113 | + $GLOBALS['wgResourceModules']['ext.bootstrap'] = [ |
|
| 114 | + 'dependencies' => ['ext.bootstrap.styles', 'ext.bootstrap.scripts'], |
|
| 115 | 115 | ]; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | * @param string $id |
| 120 | 120 | * @return bool |
| 121 | 121 | */ |
| 122 | - protected function hasConfiguration( $id ) { |
|
| 123 | - return isset( $this->configuration[ $id ] ); |
|
| 122 | + protected function hasConfiguration($id) { |
|
| 123 | + return isset($this->configuration[$id]); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -128,28 +128,28 @@ discard block |
||
| 128 | 128 | * @return string |
| 129 | 129 | * @throws RuntimeException |
| 130 | 130 | */ |
| 131 | - protected function isReadablePath( $localBasePath ) { |
|
| 131 | + protected function isReadablePath($localBasePath) { |
|
| 132 | 132 | |
| 133 | - $localBasePath = str_replace( [ '\\', '/' ], DIRECTORY_SEPARATOR, $localBasePath ); |
|
| 133 | + $localBasePath = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $localBasePath); |
|
| 134 | 134 | |
| 135 | - if ( is_readable( $localBasePath ) ) { |
|
| 135 | + if (is_readable($localBasePath)) { |
|
| 136 | 136 | return $localBasePath; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - throw new RuntimeException( "Expected an accessible {$localBasePath} path" ); |
|
| 139 | + throw new RuntimeException("Expected an accessible {$localBasePath} path"); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | protected function registerCacheTriggers() { |
| 143 | 143 | |
| 144 | 144 | $defaultRecacheTriggers = [ |
| 145 | - 'LocalSettings.php' => $this->configuration[ 'IP' ] . '/LocalSettings.php', |
|
| 146 | - 'composer.lock' => $this->configuration[ 'IP' ] . '/composer.lock', |
|
| 145 | + 'LocalSettings.php' => $this->configuration['IP'] . '/LocalSettings.php', |
|
| 146 | + 'composer.lock' => $this->configuration['IP'] . '/composer.lock', |
|
| 147 | 147 | ]; |
| 148 | 148 | |
| 149 | - foreach ( $defaultRecacheTriggers as $key => $filename ) { |
|
| 150 | - if ( array_key_exists( $key, $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ] ) && |
|
| 151 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] === null ) { |
|
| 152 | - $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] = $filename; |
|
| 149 | + foreach ($defaultRecacheTriggers as $key => $filename) { |
|
| 150 | + if (array_key_exists($key, $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers']) && |
|
| 151 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] === null) { |
|
| 152 | + $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] = $filename; |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | 'IP' => 'Full path to working directory ($IP) not found.', |
| 163 | 163 | ]; |
| 164 | 164 | |
| 165 | - foreach ( $configElements as $key => $errorMessage ) { |
|
| 166 | - if ( !$this->hasConfiguration( $key ) ) { |
|
| 167 | - throw new InvalidArgumentException( $errorMessage ); |
|
| 165 | + foreach ($configElements as $key => $errorMessage) { |
|
| 166 | + if (!$this->hasConfiguration($key)) { |
|
| 167 | + throw new InvalidArgumentException($errorMessage); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -36,6 +36,6 @@ |
||
| 36 | 36 | * @param string $key |
| 37 | 37 | * @return array |
| 38 | 38 | */ |
| 39 | - public function get( $key ); |
|
| 39 | + public function get($key); |
|
| 40 | 40 | |
| 41 | 41 | } |