@@ -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 | } |