Passed
Push — master ( f8e942...98e20a )
by Stephan
14:07
created
src/Hooks/SetupAfterCache.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @param mixed[] $configuration
51 51
 	 */
52
-	public function __construct( array $configuration ) {
52
+	public function __construct(array $configuration) {
53 53
 		$this->configuration = $configuration;
54 54
 	}
55 55
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		$this->assertAcceptableConfiguration();
69 69
 
70 70
 		$this->registerResourceLoaderModules(
71
-			$this->isReadablePath( $this->configuration['localBasePath'] ),
72
-			$this->configuration[ 'remoteBasePath' ]
71
+			$this->isReadablePath($this->configuration['localBasePath']),
72
+			$this->configuration['remoteBasePath']
73 73
 		);
74 74
 
75 75
 		$this->registerCacheTriggers();
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
 	 * @param string $localBasePath
84 84
 	 * @param string $remoteBasePath
85 85
 	 */
86
-	protected function registerResourceLoaderModules( $localBasePath, $remoteBasePath ) {
86
+	protected function registerResourceLoaderModules($localBasePath, $remoteBasePath) {
87 87
 
88
-		$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array_replace_recursive(
88
+		$GLOBALS['wgResourceModules']['ext.bootstrap.styles'] = array_replace_recursive(
89 89
 			[
90 90
 				'localBasePath' => $localBasePath . '/scss',
91 91
 				'remoteBasePath' => $remoteBasePath . '/scss',
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
 					'composer.lock' => null,
100 100
 				],
101 101
 			],
102
-			array_key_exists( 'ext.bootstrap.styles', $GLOBALS[ 'wgResourceModules' ] ) ? $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] : []
102
+			array_key_exists('ext.bootstrap.styles', $GLOBALS['wgResourceModules']) ? $GLOBALS['wgResourceModules']['ext.bootstrap.styles'] : []
103 103
 		);
104 104
 
105
-		$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] = array_replace_recursive(
105
+		$GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] = array_replace_recursive(
106 106
 			[
107 107
 				'localBasePath'  => $localBasePath . '/js',
108 108
 				'remoteBasePath' => $remoteBasePath . '/js',
109 109
 				'scripts' => [],
110 110
 			],
111
-			array_key_exists( 'ext.bootstrap.scripts', $GLOBALS[ 'wgResourceModules' ] ) ? $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.scripts' ] : []
111
+			array_key_exists('ext.bootstrap.scripts', $GLOBALS['wgResourceModules']) ? $GLOBALS['wgResourceModules']['ext.bootstrap.scripts'] : []
112 112
 		);
113 113
 
114
-		$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap' ] = [
115
-			'dependencies' => [ 'ext.bootstrap.styles', 'ext.bootstrap.scripts' ],
114
+		$GLOBALS['wgResourceModules']['ext.bootstrap'] = [
115
+			'dependencies' => ['ext.bootstrap.styles', 'ext.bootstrap.scripts'],
116 116
 		];
117 117
 	}
118 118
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 * @param string $id
121 121
 	 * @return bool
122 122
 	 */
123
-	protected function hasConfiguration( $id ) {
124
-		return isset( $this->configuration[ $id ] );
123
+	protected function hasConfiguration($id) {
124
+		return isset($this->configuration[$id]);
125 125
 	}
126 126
 
127 127
 	/**
@@ -129,28 +129,28 @@  discard block
 block discarded – undo
129 129
 	 * @return string
130 130
 	 * @throws RuntimeException
131 131
 	 */
132
-	protected function isReadablePath( $localBasePath ) {
132
+	protected function isReadablePath($localBasePath) {
133 133
 
134
-		$localBasePath = str_replace( [ '\\', '/' ], DIRECTORY_SEPARATOR, $localBasePath );
134
+		$localBasePath = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $localBasePath);
135 135
 
136
-		if ( is_readable( $localBasePath ) ) {
136
+		if (is_readable($localBasePath)) {
137 137
 			return $localBasePath;
138 138
 		}
139 139
 
140
-		throw new RuntimeException( "Expected an accessible {$localBasePath} path" );
140
+		throw new RuntimeException("Expected an accessible {$localBasePath} path");
141 141
 	}
142 142
 
143 143
 	protected function registerCacheTriggers() {
144 144
 
145 145
 		$defaultRecacheTriggers = [
146
-			'LocalSettings.php' => $this->configuration[ 'IP' ] . '/LocalSettings.php',
147
-			'composer.lock' => $this->configuration[ 'IP' ] . '/composer.lock',
146
+			'LocalSettings.php' => $this->configuration['IP'] . '/LocalSettings.php',
147
+			'composer.lock' => $this->configuration['IP'] . '/composer.lock',
148 148
 		];
149 149
 
150
-		foreach ( $defaultRecacheTriggers as $key => $filename ) {
151
-			if ( array_key_exists( $key, $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ] ) &&
152
-				$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] === null ) {
153
-				$GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ][ 'cacheTriggers' ][ $key ] = $filename;
150
+		foreach ($defaultRecacheTriggers as $key => $filename) {
151
+			if (array_key_exists($key, $GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers']) &&
152
+				$GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] === null) {
153
+				$GLOBALS['wgResourceModules']['ext.bootstrap.styles']['cacheTriggers'][$key] = $filename;
154 154
 			}
155 155
 		}
156 156
 	}
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 			'IP' => 'Full path to working directory ($IP) not found.',
164 164
 		];
165 165
 
166
-		foreach ( $configElements as $key => $errorMessage ) {
167
-			if ( !$this->hasConfiguration( $key ) ) {
168
-				throw new InvalidArgumentException( $errorMessage );
166
+		foreach ($configElements as $key => $errorMessage) {
167
+			if (!$this->hasConfiguration($key)) {
168
+				throw new InvalidArgumentException($errorMessage);
169 169
 			}
170 170
 		}
171 171
 	}
Please login to merge, or discard this patch.