Completed
Push — master ( 6a30d5...22bc4b )
by
unknown
01:53
created
src/ServiceWiring.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
 use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer;
29 29
 
30 30
 return [
31
-	ConstraintsServices::EXPIRY_LOCK => function( MediaWikiServices $services ) {
32
-		return new ExpiryLock( ObjectCache::getInstance( CACHE_ANYTHING ) );
31
+	ConstraintsServices::EXPIRY_LOCK => function(MediaWikiServices $services) {
32
+		return new ExpiryLock(ObjectCache::getInstance(CACHE_ANYTHING));
33 33
 	},
34 34
 
35
-	ConstraintsServices::LOGGING_HELPER => function( MediaWikiServices $services ) {
35
+	ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) {
36 36
 		return new LoggingHelper(
37 37
 			$services->getStatsdDataFactory(),
38
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
38
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
39 39
 			$services->getMainConfig()
40 40
 		);
41 41
 	},
42 42
 
43
-	ConstraintsServices::CONSTRAINT_REPOSITORY => function( MediaWikiServices $services ) {
43
+	ConstraintsServices::CONSTRAINT_REPOSITORY => function(MediaWikiServices $services) {
44 44
 		$sourceDefinitions = WikibaseRepo::getDefaultInstance()->getEntitySourceDefinitions();
45
-		$propertySource = $sourceDefinitions->getSourceForEntityType( Property::ENTITY_TYPE );
45
+		$propertySource = $sourceDefinitions->getSourceForEntityType(Property::ENTITY_TYPE);
46 46
 
47
-		return new ConstraintRepository( $services->getDBLoadBalancer(), $propertySource->getDatabaseName() );
47
+		return new ConstraintRepository($services->getDBLoadBalancer(), $propertySource->getDatabaseName());
48 48
 	},
49 49
 
50
-	ConstraintsServices::CONSTRAINT_LOOKUP => function( MediaWikiServices $services ) {
51
-		$constraintRepository = ConstraintsServices::getConstraintRepository( $services );
52
-		return new CachingConstraintLookup( $constraintRepository );
50
+	ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) {
51
+		$constraintRepository = ConstraintsServices::getConstraintRepository($services);
52
+		return new CachingConstraintLookup($constraintRepository);
53 53
 	},
54 54
 
55
-	ConstraintsServices::CHECK_RESULT_SERIALIZER => function( MediaWikiServices $services ) {
55
+	ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) {
56 56
 		return new CheckResultSerializer(
57 57
 			new ConstraintSerializer(
58 58
 				false // constraint parameters are not exposed
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		);
64 64
 	},
65 65
 
66
-	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function( MediaWikiServices $services ) {
66
+	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) {
67 67
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
68 68
 		$repo = WikibaseRepo::getDefaultInstance();
69 69
 		$entityIdParser = $repo->getEntityIdParser();
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		);
81 81
 	},
82 82
 
83
-	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function( MediaWikiServices $services ) {
83
+	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) {
84 84
 		return new ViolationMessageSerializer();
85 85
 	},
86 86
 
87
-	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function( MediaWikiServices $services ) {
87
+	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) {
88 88
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
89 89
 		$repo = WikibaseRepo::getDefaultInstance();
90 90
 		$entityIdParser = $repo->getEntityIdParser();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		);
97 97
 	},
98 98
 
99
-	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function( MediaWikiServices $services ) {
99
+	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) {
100 100
 		// TODO in the future, get DeserializerFactory and entity source definitions from $services?
101 101
 		$repo = WikibaseRepo::getDefaultInstance();
102 102
 		$deserializerFactory = $repo->getBaseDataModelDeserializerFactory();
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 		return new ConstraintParameterParser(
106 106
 			$services->getMainConfig(),
107 107
 			$deserializerFactory,
108
-			$entitySourceDefinitions->getSourceForEntityType( 'item' )->getConceptBaseUri()
108
+			$entitySourceDefinitions->getSourceForEntityType('item')->getConceptBaseUri()
109 109
 		);
110 110
 	},
111 111
 
112
-	ConstraintsServices::CONNECTION_CHECKER_HELPER => function( MediaWikiServices $services ) {
112
+	ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) {
113 113
 		return new ConnectionCheckerHelper();
114 114
 	},
115 115
 
116
-	ConstraintsServices::RANGE_CHECKER_HELPER => function( MediaWikiServices $services ) {
116
+	ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) {
117 117
 		// TODO in the future, get UnitConverter from $services?
118 118
 		$repo = WikibaseRepo::getDefaultInstance();
119 119
 		$unitConverter = $repo->getUnitConverter();
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		);
125 125
 	},
126 126
 
127
-	ConstraintsServices::SPARQL_HELPER => function( MediaWikiServices $services ) {
128
-		$endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' );
129
-		if ( $endpoint === '' ) {
127
+	ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) {
128
+		$endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint');
129
+		if ($endpoint === '') {
130 130
 			return new DummySparqlHelper();
131 131
 		}
132 132
 
@@ -142,122 +142,122 @@  discard block
 block discarded – undo
142 142
 			$entityIdParser,
143 143
 			$propertyDataTypeLookup,
144 144
 			$services->getMainWANObjectCache(),
145
-			ConstraintsServices::getViolationMessageSerializer( $services ),
146
-			ConstraintsServices::getViolationMessageDeserializer( $services ),
145
+			ConstraintsServices::getViolationMessageSerializer($services),
146
+			ConstraintsServices::getViolationMessageDeserializer($services),
147 147
 			$services->getStatsdDataFactory(),
148
-			ConstraintsServices::getExpiryLock( $services ),
148
+			ConstraintsServices::getExpiryLock($services),
149 149
 			ConstraintsServices::getLoggingHelper(),
150
-			wfWikiID() . ' WikibaseQualityConstraints ' . Http::userAgent(),
150
+			wfWikiID().' WikibaseQualityConstraints '.Http::userAgent(),
151 151
 			$services->getHttpRequestFactory()
152 152
 		);
153 153
 	},
154 154
 
155
-	ConstraintsServices::TYPE_CHECKER_HELPER => function( MediaWikiServices $services ) {
155
+	ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) {
156 156
 		return new TypeCheckerHelper(
157
-			WikibaseServices::getEntityLookup( $services ),
157
+			WikibaseServices::getEntityLookup($services),
158 158
 			$services->getMainConfig(),
159
-			ConstraintsServices::getSparqlHelper( $services ),
159
+			ConstraintsServices::getSparqlHelper($services),
160 160
 			$services->getStatsdDataFactory()
161 161
 		);
162 162
 	},
163 163
 
164
-	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function( MediaWikiServices $services ) {
164
+	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function(MediaWikiServices $services) {
165 165
 		// TODO in the future, get StatementGuidParser from $services?
166 166
 		$repo = WikibaseRepo::getDefaultInstance();
167 167
 		$statementGuidParser = $repo->getStatementGuidParser();
168 168
 
169 169
 		$config = $services->getMainConfig();
170 170
 		$checkerMap = [
171
-			$config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
172
-				=> ConstraintCheckerServices::getConflictsWithChecker( $services ),
173
-			$config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
174
-				=> ConstraintCheckerServices::getItemChecker( $services ),
175
-			$config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
176
-				=> ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ),
177
-			$config->get( 'WBQualityConstraintsSymmetricConstraintId' )
178
-				=> ConstraintCheckerServices::getSymmetricChecker( $services ),
179
-			$config->get( 'WBQualityConstraintsInverseConstraintId' )
180
-				=> ConstraintCheckerServices::getInverseChecker( $services ),
181
-			$config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
182
-				=> ConstraintCheckerServices::getQualifierChecker( $services ),
183
-			$config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
184
-				=> ConstraintCheckerServices::getQualifiersChecker( $services ),
185
-			$config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
186
-				=> ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ),
187
-			$config->get( 'WBQualityConstraintsRangeConstraintId' )
188
-				=> ConstraintCheckerServices::getRangeChecker( $services ),
189
-			$config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
190
-				=> ConstraintCheckerServices::getDiffWithinRangeChecker( $services ),
191
-			$config->get( 'WBQualityConstraintsTypeConstraintId' )
192
-				=> ConstraintCheckerServices::getTypeChecker( $services ),
193
-			$config->get( 'WBQualityConstraintsValueTypeConstraintId' )
194
-				=> ConstraintCheckerServices::getValueTypeChecker( $services ),
195
-			$config->get( 'WBQualityConstraintsSingleValueConstraintId' )
196
-				=> ConstraintCheckerServices::getSingleValueChecker( $services ),
197
-			$config->get( 'WBQualityConstraintsMultiValueConstraintId' )
198
-				=> ConstraintCheckerServices::getMultiValueChecker( $services ),
199
-			$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
200
-				=> ConstraintCheckerServices::getUniqueValueChecker( $services ),
201
-			$config->get( 'WBQualityConstraintsFormatConstraintId' )
202
-				=> ConstraintCheckerServices::getFormatChecker( $services ),
203
-			$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
204
-				=> ConstraintCheckerServices::getCommonsLinkChecker( $services ),
205
-			$config->get( 'WBQualityConstraintsOneOfConstraintId' )
206
-				=> ConstraintCheckerServices::getOneOfChecker( $services ),
207
-			$config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
208
-				=> ConstraintCheckerServices::getValueOnlyChecker( $services ),
209
-			$config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
210
-				=> ConstraintCheckerServices::getReferenceChecker( $services ),
211
-			$config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
212
-				=> ConstraintCheckerServices::getNoBoundsChecker( $services ),
213
-			$config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
214
-				=> ConstraintCheckerServices::getAllowedUnitsChecker( $services ),
215
-			$config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
216
-				=> ConstraintCheckerServices::getSingleBestValueChecker( $services ),
217
-			$config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
218
-				=> ConstraintCheckerServices::getEntityTypeChecker( $services ),
219
-			$config->get( 'WBQualityConstraintsNoneOfConstraintId' )
220
-				=> ConstraintCheckerServices::getNoneOfChecker( $services ),
221
-			$config->get( 'WBQualityConstraintsIntegerConstraintId' )
222
-				=> ConstraintCheckerServices::getIntegerChecker( $services ),
223
-			$config->get( 'WBQualityConstraintsCitationNeededConstraintId' )
224
-				=> ConstraintCheckerServices::getCitationNeededChecker( $services ),
225
-			$config->get( 'WBQualityConstraintsPropertyScopeConstraintId' )
226
-				=> ConstraintCheckerServices::getPropertyScopeChecker( $services ),
227
-			$config->get( 'WBQualityConstraintsContemporaryConstraintId' )
228
-				=> ConstraintCheckerServices::getContemporaryChecker( $services ),
171
+			$config->get('WBQualityConstraintsConflictsWithConstraintId')
172
+				=> ConstraintCheckerServices::getConflictsWithChecker($services),
173
+			$config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
174
+				=> ConstraintCheckerServices::getItemChecker($services),
175
+			$config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
176
+				=> ConstraintCheckerServices::getTargetRequiredClaimChecker($services),
177
+			$config->get('WBQualityConstraintsSymmetricConstraintId')
178
+				=> ConstraintCheckerServices::getSymmetricChecker($services),
179
+			$config->get('WBQualityConstraintsInverseConstraintId')
180
+				=> ConstraintCheckerServices::getInverseChecker($services),
181
+			$config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
182
+				=> ConstraintCheckerServices::getQualifierChecker($services),
183
+			$config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
184
+				=> ConstraintCheckerServices::getQualifiersChecker($services),
185
+			$config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
186
+				=> ConstraintCheckerServices::getMandatoryQualifiersChecker($services),
187
+			$config->get('WBQualityConstraintsRangeConstraintId')
188
+				=> ConstraintCheckerServices::getRangeChecker($services),
189
+			$config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
190
+				=> ConstraintCheckerServices::getDiffWithinRangeChecker($services),
191
+			$config->get('WBQualityConstraintsTypeConstraintId')
192
+				=> ConstraintCheckerServices::getTypeChecker($services),
193
+			$config->get('WBQualityConstraintsValueTypeConstraintId')
194
+				=> ConstraintCheckerServices::getValueTypeChecker($services),
195
+			$config->get('WBQualityConstraintsSingleValueConstraintId')
196
+				=> ConstraintCheckerServices::getSingleValueChecker($services),
197
+			$config->get('WBQualityConstraintsMultiValueConstraintId')
198
+				=> ConstraintCheckerServices::getMultiValueChecker($services),
199
+			$config->get('WBQualityConstraintsDistinctValuesConstraintId')
200
+				=> ConstraintCheckerServices::getUniqueValueChecker($services),
201
+			$config->get('WBQualityConstraintsFormatConstraintId')
202
+				=> ConstraintCheckerServices::getFormatChecker($services),
203
+			$config->get('WBQualityConstraintsCommonsLinkConstraintId')
204
+				=> ConstraintCheckerServices::getCommonsLinkChecker($services),
205
+			$config->get('WBQualityConstraintsOneOfConstraintId')
206
+				=> ConstraintCheckerServices::getOneOfChecker($services),
207
+			$config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
208
+				=> ConstraintCheckerServices::getValueOnlyChecker($services),
209
+			$config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
210
+				=> ConstraintCheckerServices::getReferenceChecker($services),
211
+			$config->get('WBQualityConstraintsNoBoundsConstraintId')
212
+				=> ConstraintCheckerServices::getNoBoundsChecker($services),
213
+			$config->get('WBQualityConstraintsAllowedUnitsConstraintId')
214
+				=> ConstraintCheckerServices::getAllowedUnitsChecker($services),
215
+			$config->get('WBQualityConstraintsSingleBestValueConstraintId')
216
+				=> ConstraintCheckerServices::getSingleBestValueChecker($services),
217
+			$config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
218
+				=> ConstraintCheckerServices::getEntityTypeChecker($services),
219
+			$config->get('WBQualityConstraintsNoneOfConstraintId')
220
+				=> ConstraintCheckerServices::getNoneOfChecker($services),
221
+			$config->get('WBQualityConstraintsIntegerConstraintId')
222
+				=> ConstraintCheckerServices::getIntegerChecker($services),
223
+			$config->get('WBQualityConstraintsCitationNeededConstraintId')
224
+				=> ConstraintCheckerServices::getCitationNeededChecker($services),
225
+			$config->get('WBQualityConstraintsPropertyScopeConstraintId')
226
+				=> ConstraintCheckerServices::getPropertyScopeChecker($services),
227
+			$config->get('WBQualityConstraintsContemporaryConstraintId')
228
+				=> ConstraintCheckerServices::getContemporaryChecker($services),
229 229
 		];
230 230
 
231 231
 		return new DelegatingConstraintChecker(
232
-			WikibaseServices::getEntityLookup( $services ),
232
+			WikibaseServices::getEntityLookup($services),
233 233
 			$checkerMap,
234
-			ConstraintsServices::getConstraintLookup( $services ),
235
-			ConstraintsServices::getConstraintParameterParser( $services ),
234
+			ConstraintsServices::getConstraintLookup($services),
235
+			ConstraintsServices::getConstraintParameterParser($services),
236 236
 			$statementGuidParser,
237
-			ConstraintsServices::getLoggingHelper( $services ),
238
-			$config->get( 'WBQualityConstraintsCheckQualifiers' ),
239
-			$config->get( 'WBQualityConstraintsCheckReferences' ),
240
-			$config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
237
+			ConstraintsServices::getLoggingHelper($services),
238
+			$config->get('WBQualityConstraintsCheckQualifiers'),
239
+			$config->get('WBQualityConstraintsCheckReferences'),
240
+			$config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
241 241
 		);
242 242
 	},
243 243
 
244
-	ConstraintsServices::RESULTS_SOURCE => function( MediaWikiServices $services ) {
244
+	ConstraintsServices::RESULTS_SOURCE => function(MediaWikiServices $services) {
245 245
 		$config = $services->getMainConfig();
246 246
 		$resultsSource = new CheckingResultsSource(
247
-			ConstraintsServices::getDelegatingConstraintChecker( $services )
247
+			ConstraintsServices::getDelegatingConstraintChecker($services)
248 248
 		);
249 249
 
250 250
 		$cacheCheckConstraintsResults = false;
251 251
 
252
-		if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
252
+		if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
253 253
 			$cacheCheckConstraintsResults = true;
254 254
 			// check that we can use getLocalRepoWikiPageMetaDataAccessor()
255 255
 			// TODO we should always be able to cache constraint check results (T244726)
256 256
 			$repo = WikibaseRepo::getDefaultInstance();
257
-			foreach ( $repo->getEntitySourceDefinitions()->getSources() as $entitySource ) {
258
-				if ( $entitySource->getDatabaseName() !== false ) {
259
-					LoggerFactory::getInstance( 'WikibaseQualityConstraints' )->warning(
260
-						'Cannot cache constraint check results for non-local source: ' .
257
+			foreach ($repo->getEntitySourceDefinitions()->getSources() as $entitySource) {
258
+				if ($entitySource->getDatabaseName() !== false) {
259
+					LoggerFactory::getInstance('WikibaseQualityConstraints')->warning(
260
+						'Cannot cache constraint check results for non-local source: '.
261 261
 						$entitySource->getSourceName()
262 262
 					);
263 263
 					$cacheCheckConstraintsResults = false;
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 			}
267 267
 		}
268 268
 
269
-		if ( $cacheCheckConstraintsResults ) {
269
+		if ($cacheCheckConstraintsResults) {
270 270
 			$possiblyStaleConstraintTypes = [
271
-				$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
272
-				$config->get( 'WBQualityConstraintsTypeConstraintId' ),
273
-				$config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
274
-				$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
271
+				$config->get('WBQualityConstraintsCommonsLinkConstraintId'),
272
+				$config->get('WBQualityConstraintsTypeConstraintId'),
273
+				$config->get('WBQualityConstraintsValueTypeConstraintId'),
274
+				$config->get('WBQualityConstraintsDistinctValuesConstraintId'),
275 275
 			];
276 276
 			// TODO in the future, get EntityIdParser and WikiPageEntityMetaDataAccessor from $services?
277 277
 			$repo = WikibaseRepo::getDefaultInstance();
@@ -281,14 +281,14 @@  discard block
 block discarded – undo
281 281
 			$resultsSource = new CachingResultsSource(
282 282
 				$resultsSource,
283 283
 				ResultsCache::getDefaultInstance(),
284
-				ConstraintsServices::getCheckResultSerializer( $services ),
285
-				ConstraintsServices::getCheckResultDeserializer( $services ),
284
+				ConstraintsServices::getCheckResultSerializer($services),
285
+				ConstraintsServices::getCheckResultDeserializer($services),
286 286
 				$wikiPageEntityMetaDataAccessor,
287 287
 				$entityIdParser,
288
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
288
+				$config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
289 289
 				$possiblyStaleConstraintTypes,
290
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
291
-				ConstraintsServices::getLoggingHelper( $services )
290
+				$config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
291
+				ConstraintsServices::getLoggingHelper($services)
292 292
 			);
293 293
 		}
294 294
 
Please login to merge, or discard this patch.
src/WikibaseQualityConstraintsHooks.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -28,25 +28,25 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @param DatabaseUpdater $updater
30 30
 	 */
31
-	public static function onCreateSchema( DatabaseUpdater $updater ) {
31
+	public static function onCreateSchema(DatabaseUpdater $updater) {
32 32
 		$updater->addExtensionTable(
33 33
 			'wbqc_constraints',
34
-			__DIR__ . '/../sql/create_wbqc_constraints.sql'
34
+			__DIR__.'/../sql/create_wbqc_constraints.sql'
35 35
 		);
36 36
 		$updater->addExtensionField(
37 37
 			'wbqc_constraints',
38 38
 			'constraint_id',
39
-			__DIR__ . '/../sql/patch-wbqc_constraints-constraint_id.sql'
39
+			__DIR__.'/../sql/patch-wbqc_constraints-constraint_id.sql'
40 40
 		);
41 41
 		$updater->addExtensionIndex(
42 42
 			'wbqc_constraints',
43 43
 			'wbqc_constraints_guid_uniq',
44
-			__DIR__ . '/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
44
+			__DIR__.'/../sql/patch-wbqc_constraints-wbqc_constraints_guid_uniq.sql'
45 45
 		);
46 46
 	}
47 47
 
48
-	public static function onWikibaseChange( Change $change ) {
49
-		if ( !( $change instanceof EntityChange ) ) {
48
+	public static function onWikibaseChange(Change $change) {
49
+		if (!($change instanceof EntityChange)) {
50 50
 			return;
51 51
 		}
52 52
 
@@ -55,48 +55,48 @@  discard block
 block discarded – undo
55 55
 
56 56
 		// If jobs are enabled and the results would be stored in some way run a job.
57 57
 		if (
58
-			$config->get( 'WBQualityConstraintsEnableConstraintsCheckJobs' ) &&
59
-			$config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) &&
58
+			$config->get('WBQualityConstraintsEnableConstraintsCheckJobs') &&
59
+			$config->get('WBQualityConstraintsCacheCheckConstraintsResults') &&
60 60
 			self::isSelectedForJobRunBasedOnPercentage()
61 61
 		) {
62
-			$params = [ 'entityId' => $change->getEntityId()->getSerialization() ];
62
+			$params = ['entityId' => $change->getEntityId()->getSerialization()];
63 63
 			JobQueueGroup::singleton()->push(
64
-				new JobSpecification( CheckConstraintsJob::COMMAND, $params )
64
+				new JobSpecification(CheckConstraintsJob::COMMAND, $params)
65 65
 			);
66 66
 		}
67 67
 
68
-		if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) &&
69
-			self::isConstraintStatementsChange( $config, $change )
68
+		if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') &&
69
+			self::isConstraintStatementsChange($config, $change)
70 70
 		) {
71
-			$params = [ 'propertyId' => $change->getEntityId()->getSerialization() ];
71
+			$params = ['propertyId' => $change->getEntityId()->getSerialization()];
72 72
 			$metadata = $change->getMetadata();
73
-			if ( array_key_exists( 'rev_id', $metadata ) ) {
73
+			if (array_key_exists('rev_id', $metadata)) {
74 74
 				$params['revisionId'] = $metadata['rev_id'];
75 75
 			}
76 76
 			JobQueueGroup::singleton()->push(
77
-				new JobSpecification( 'constraintsTableUpdate', $params )
77
+				new JobSpecification('constraintsTableUpdate', $params)
78 78
 			);
79 79
 		}
80 80
 	}
81 81
 
82 82
 	private static function isSelectedForJobRunBasedOnPercentage() {
83 83
 		$config = MediaWikiServices::getInstance()->getMainConfig();
84
-		$percentage = $config->get( 'WBQualityConstraintsEnableConstraintsCheckJobsRatio' );
84
+		$percentage = $config->get('WBQualityConstraintsEnableConstraintsCheckJobsRatio');
85 85
 
86
-		return mt_rand( 1, 100 ) <= $percentage;
86
+		return mt_rand(1, 100) <= $percentage;
87 87
 	}
88 88
 
89
-	public static function isConstraintStatementsChange( Config $config, Change $change ) {
90
-		if ( !( $change instanceof EntityChange ) ||
89
+	public static function isConstraintStatementsChange(Config $config, Change $change) {
90
+		if (!($change instanceof EntityChange) ||
91 91
 			 $change->getAction() !== EntityChange::UPDATE ||
92
-			 !( $change->getEntityId() instanceof PropertyId )
92
+			 !($change->getEntityId() instanceof PropertyId)
93 93
 		) {
94 94
 			return false;
95 95
 		}
96 96
 
97 97
 		$info = $change->getInfo();
98 98
 
99
-		if ( !array_key_exists( 'compactDiff', $info ) ) {
99
+		if (!array_key_exists('compactDiff', $info)) {
100 100
 			// the non-compact diff ($info['diff']) does not contain statement diffs (T110996),
101 101
 			// so we only know that the change *might* affect the constraint statements
102 102
 			return true;
@@ -105,46 +105,46 @@  discard block
 block discarded – undo
105 105
 		/** @var EntityDiffChangedAspects $aspects */
106 106
 		$aspects = $info['compactDiff'];
107 107
 
108
-		$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
109
-		return in_array( $propertyConstraintId, $aspects->getStatementChanges() );
108
+		$propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId');
109
+		return in_array($propertyConstraintId, $aspects->getStatementChanges());
110 110
 	}
111 111
 
112
-	public static function onArticlePurge( WikiPage $wikiPage ) {
112
+	public static function onArticlePurge(WikiPage $wikiPage) {
113 113
 		$repo = WikibaseRepo::getDefaultInstance();
114 114
 
115 115
 		$entityContentFactory = $repo->getEntityContentFactory();
116
-		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) {
117
-			$entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() );
118
-			if ( $entityId !== null ) {
116
+		if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) {
117
+			$entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle());
118
+			if ($entityId !== null) {
119 119
 				$resultsCache = ResultsCache::getDefaultInstance();
120
-				$resultsCache->delete( $entityId );
120
+				$resultsCache->delete($entityId);
121 121
 			}
122 122
 		}
123 123
 	}
124 124
 
125
-	public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
125
+	public static function onBeforePageDisplay(OutputPage $out, Skin $skin) {
126 126
 		$repo = WikibaseRepo::getDefaultInstance();
127 127
 
128 128
 		$lookup = $repo->getEntityNamespaceLookup();
129 129
 		$title = $out->getTitle();
130
-		if ( $title === null ) {
130
+		if ($title === null) {
131 131
 			return;
132 132
 		}
133 133
 
134
-		if ( !$lookup->isNamespaceWithEntities( $title->getNamespace() ) ) {
134
+		if (!$lookup->isNamespaceWithEntities($title->getNamespace())) {
135 135
 			return;
136 136
 		}
137
-		if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) {
137
+		if (empty($out->getJsConfigVars()['wbIsEditView'])) {
138 138
 			return;
139 139
 		}
140 140
 
141
-		$out->addModules( 'wikibase.quality.constraints.suggestions' );
141
+		$out->addModules('wikibase.quality.constraints.suggestions');
142 142
 
143
-		if ( !$out->getUser()->isLoggedIn() ) {
143
+		if (!$out->getUser()->isLoggedIn()) {
144 144
 			return;
145 145
 		}
146 146
 
147
-		$out->addModules( 'wikibase.quality.constraints.gadget' );
147
+		$out->addModules('wikibase.quality.constraints.gadget');
148 148
 	}
149 149
 
150 150
 }
Please login to merge, or discard this patch.
src/Api/CheckConstraintsRdf.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		EntityIdLookup $entityIdLookup,
48 48
 		RdfVocabulary $rdfVocabulary
49 49
 	) {
50
-		parent::__construct( $page, $context );
50
+		parent::__construct($page, $context);
51 51
 		$this->resultsSource = $resultsSource;
52 52
 		$this->entityIdLookup = $entityIdLookup;
53 53
 		$this->rdfVocabulary = $rdfVocabulary;
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param string $guid
109 109
 	 * @return string
110 110
 	 */
111
-	private function cleanupGuid( $guid ) {
112
-		return preg_replace( '/[^\w-]/', '-', $guid );
111
+	private function cleanupGuid($guid) {
112
+		return preg_replace('/[^\w-]/', '-', $guid);
113 113
 	}
114 114
 
115 115
 	/**
@@ -121,60 +121,60 @@  discard block
 block discarded – undo
121 121
 		$response = $this->getRequest()->response();
122 122
 		$this->getOutput()->disable();
123 123
 
124
-		if ( !$this->resultsSource instanceof CachingResultsSource ) {
124
+		if (!$this->resultsSource instanceof CachingResultsSource) {
125 125
 			// TODO: make configurable whether only cached results are returned
126
-			$response->statusHeader( 501 ); // Not Implemented
126
+			$response->statusHeader(501); // Not Implemented
127 127
 			return null;
128 128
 		}
129 129
 
130
-		$entityId = $this->entityIdLookup->getEntityIdForTitle( $this->getTitle() );
131
-		if ( $entityId === null ) {
132
-			$response->statusHeader( 404 ); // Not Found
130
+		$entityId = $this->entityIdLookup->getEntityIdForTitle($this->getTitle());
131
+		if ($entityId === null) {
132
+			$response->statusHeader(404); // Not Found
133 133
 			return null;
134 134
 		}
135
-		$revId = $this->getRequest()->getInt( 'revision' );
135
+		$revId = $this->getRequest()->getInt('revision');
136 136
 
137
-		$results = $this->resultsSource->getStoredResults( $entityId, $revId );
138
-		if ( $results === null ) {
139
-			$response->statusHeader( 204 ); // No Content
137
+		$results = $this->resultsSource->getStoredResults($entityId, $revId);
138
+		if ($results === null) {
139
+			$response->statusHeader(204); // No Content
140 140
 			return null;
141 141
 		}
142 142
 
143 143
 		$format = 'ttl'; // TODO: make format an option
144 144
 
145 145
 		$writerFactory = new RdfWriterFactory();
146
-		$formatName = $writerFactory->getFormatName( $format );
147
-		$contentType = $writerFactory->getMimeTypes( $formatName )[0];
146
+		$formatName = $writerFactory->getFormatName($format);
147
+		$contentType = $writerFactory->getMimeTypes($formatName)[0];
148 148
 
149
-		$writer = $writerFactory->getWriter( $formatName );
150
-		foreach ( [ RdfVocabulary::NS_STATEMENT, RdfVocabulary::NS_ONTOLOGY ] as $ns ) {
151
-			$writer->prefix( $ns, $this->rdfVocabulary->getNamespaceURI( $ns ) );
149
+		$writer = $writerFactory->getWriter($formatName);
150
+		foreach ([RdfVocabulary::NS_STATEMENT, RdfVocabulary::NS_ONTOLOGY] as $ns) {
151
+			$writer->prefix($ns, $this->rdfVocabulary->getNamespaceURI($ns));
152 152
 		}
153 153
 		$writer->start();
154 154
 		$writtenAny = false;
155 155
 
156
-		foreach ( $results->getArray() as $checkResult ) {
157
-			if ( $checkResult instanceof NullResult ) {
156
+		foreach ($results->getArray() as $checkResult) {
157
+			if ($checkResult instanceof NullResult) {
158 158
 				continue;
159 159
 			}
160
-			if ( $checkResult->getStatus() === CheckResult::STATUS_BAD_PARAMETERS ) {
160
+			if ($checkResult->getStatus() === CheckResult::STATUS_BAD_PARAMETERS) {
161 161
 				continue;
162 162
 			}
163 163
 			$writtenAny = true;
164
-			$writer->about( RdfVocabulary::NS_STATEMENT,
165
-				$this->cleanupGuid( $checkResult->getContextCursor()->getStatementGuid() ) )
166
-				->say( RdfVocabulary::NS_ONTOLOGY, 'hasViolationForConstraint' )
167
-				->is( RdfVocabulary::NS_STATEMENT,
168
-					$this->cleanupGuid( $checkResult->getConstraint()->getConstraintId() ) );
164
+			$writer->about(RdfVocabulary::NS_STATEMENT,
165
+				$this->cleanupGuid($checkResult->getContextCursor()->getStatementGuid()))
166
+				->say(RdfVocabulary::NS_ONTOLOGY, 'hasViolationForConstraint')
167
+				->is(RdfVocabulary::NS_STATEMENT,
168
+					$this->cleanupGuid($checkResult->getConstraint()->getConstraintId()));
169 169
 		}
170 170
 		$writer->finish();
171
-		if ( $writtenAny ) {
172
-			$response->header( "Content-Type: $contentType; charset=UTF-8" );
171
+		if ($writtenAny) {
172
+			$response->header("Content-Type: $contentType; charset=UTF-8");
173 173
 			echo $writer->drain();
174 174
 		} else {
175 175
 			// Do not output RDF if we haven't written any actual statements. Output 204 instead
176 176
 			$writer->drain();
177
-			$response->statusHeader( 204 ); // No Content
177
+			$response->statusHeader(204); // No Content
178 178
 		}
179 179
 		return null;
180 180
 	}
Please login to merge, or discard this patch.
maintenance/ImportConstraintEntities.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 use Wikibase\Repo\WikibaseRepo;
17 17
 
18 18
 // @codeCoverageIgnoreStart
19
-$basePath = getenv( "MW_INSTALL_PATH" ) !== false
20
-	? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../..";
19
+$basePath = getenv("MW_INSTALL_PATH") !== false
20
+	? getenv("MW_INSTALL_PATH") : __DIR__."/../../..";
21 21
 
22
-require_once $basePath . "/maintenance/Maintenance.php";
22
+require_once $basePath."/maintenance/Maintenance.php";
23 23
 // @codeCoverageIgnoreEnd
24 24
 
25 25
 /**
@@ -53,20 +53,20 @@  discard block
 block discarded – undo
53 53
 		parent::__construct();
54 54
 
55 55
 		$this->addDescription(
56
-			'Import entities needed for constraint checks ' .
56
+			'Import entities needed for constraint checks '.
57 57
 			'from Wikidata into the local repository.'
58 58
 		);
59 59
 		$this->addOption(
60 60
 			'config-format',
61
-			'The format in which the resulting configuration will be omitted: ' .
62
-			'"globals" for directly settings global variables, suitable for inclusion in LocalSettings.php (default), ' .
61
+			'The format in which the resulting configuration will be omitted: '.
62
+			'"globals" for directly settings global variables, suitable for inclusion in LocalSettings.php (default), '.
63 63
 			'or "wgConf" for printing parts of arrays suitable for inclusion in $wgConf->settings.'
64 64
 		);
65 65
 		$this->addOption(
66 66
 			'dry-run',
67 67
 			'Don’t actually import entities, just print which ones would be imported.'
68 68
 		);
69
-		$this->requireExtension( 'WikibaseQualityConstraints' );
69
+		$this->requireExtension('WikibaseQualityConstraints');
70 70
 	}
71 71
 
72 72
 	/**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 		$this->entitySerializer = $repo->getAllTypesEntitySerializer();
78 78
 		$this->entityDeserializer = $repo->getInternalFormatEntityDeserializer();
79 79
 		$this->entityStore = $repo->getEntityStore();
80
-		if ( !$this->getOption( 'dry-run', false ) ) {
81
-			$this->user = User::newSystemUser( 'WikibaseQualityConstraints importer' );
80
+		if (!$this->getOption('dry-run', false)) {
81
+			$this->user = User::newSystemUser('WikibaseQualityConstraints importer');
82 82
 		}
83 83
 	}
84 84
 
@@ -87,21 +87,21 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$configUpdates = [];
89 89
 
90
-		$extensionJsonFile = __DIR__ . '/../extension.json';
91
-		$extensionJsonText = file_get_contents( $extensionJsonFile );
92
-		$extensionJson = json_decode( $extensionJsonText, /* assoc = */ true );
90
+		$extensionJsonFile = __DIR__.'/../extension.json';
91
+		$extensionJsonText = file_get_contents($extensionJsonFile);
92
+		$extensionJson = json_decode($extensionJsonText, /* assoc = */ true);
93 93
 		// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
94
-		$wikidataEntityIds = $this->getEntitiesToImport( $extensionJson['config'], $this->getConfig() );
94
+		$wikidataEntityIds = $this->getEntitiesToImport($extensionJson['config'], $this->getConfig());
95 95
 
96
-		foreach ( $wikidataEntityIds as $key => $wikidataEntityId ) {
97
-			$localEntityId = $this->importEntityFromWikidata( $wikidataEntityId );
96
+		foreach ($wikidataEntityIds as $key => $wikidataEntityId) {
97
+			$localEntityId = $this->importEntityFromWikidata($wikidataEntityId);
98 98
 			$configUpdates[$key] = [
99 99
 				'wikidata' => $wikidataEntityId,
100 100
 				'local' => $localEntityId,
101 101
 			];
102 102
 		}
103 103
 
104
-		$this->outputConfigUpdates( $configUpdates );
104
+		$this->outputConfigUpdates($configUpdates);
105 105
 	}
106 106
 
107 107
 	/**
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 	 * @param Config $wikiConfig
110 110
 	 * @return string[]
111 111
 	 */
112
-	private function getEntitiesToImport( array $extensionJsonConfig, Config $wikiConfig ) {
112
+	private function getEntitiesToImport(array $extensionJsonConfig, Config $wikiConfig) {
113 113
 		$wikidataEntityIds = [];
114 114
 
115
-		foreach ( $extensionJsonConfig as $key => $value ) {
116
-			if ( !preg_match( '/Id$/', $key ) ) {
115
+		foreach ($extensionJsonConfig as $key => $value) {
116
+			if (!preg_match('/Id$/', $key)) {
117 117
 				continue;
118 118
 			}
119 119
 
120 120
 			$wikidataEntityId = $value['value'];
121
-			$localEntityId = $wikiConfig->get( $key );
121
+			$localEntityId = $wikiConfig->get($key);
122 122
 
123
-			if ( $localEntityId === $wikidataEntityId ) {
123
+			if ($localEntityId === $wikidataEntityId) {
124 124
 				$wikidataEntityIds[$key] = $wikidataEntityId;
125 125
 			}
126 126
 		}
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	 * @param string $wikidataEntityId
133 133
 	 * @return string local entity ID
134 134
 	 */
135
-	private function importEntityFromWikidata( $wikidataEntityId ) {
135
+	private function importEntityFromWikidata($wikidataEntityId) {
136 136
 		$wikidataEntityUrl = "https://www.wikidata.org/wiki/Special:EntityData/$wikidataEntityId.json";
137
-		$wikidataEntitiesJson = MediaWikiServices::getInstance()->getHttpRequestFactory()->get( $wikidataEntityUrl );
138
-		return $this->importEntityFromJson( $wikidataEntityId, $wikidataEntitiesJson );
137
+		$wikidataEntitiesJson = MediaWikiServices::getInstance()->getHttpRequestFactory()->get($wikidataEntityUrl);
138
+		return $this->importEntityFromJson($wikidataEntityId, $wikidataEntitiesJson);
139 139
 	}
140 140
 
141 141
 	/**
@@ -143,24 +143,24 @@  discard block
 block discarded – undo
143 143
 	 * @param string $wikidataEntitiesJson
144 144
 	 * @return string local entity ID
145 145
 	 */
146
-	private function importEntityFromJson( $wikidataEntityId, $wikidataEntitiesJson ) {
146
+	private function importEntityFromJson($wikidataEntityId, $wikidataEntitiesJson) {
147 147
 		// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
148
-		$wikidataEntityArray = json_decode( $wikidataEntitiesJson, true )['entities'][$wikidataEntityId];
149
-		$wikidataEntity = $this->entityDeserializer->deserialize( $wikidataEntityArray );
148
+		$wikidataEntityArray = json_decode($wikidataEntitiesJson, true)['entities'][$wikidataEntityId];
149
+		$wikidataEntity = $this->entityDeserializer->deserialize($wikidataEntityArray);
150 150
 
151
-		$wikidataEntity->setId( null );
151
+		$wikidataEntity->setId(null);
152 152
 
153
-		if ( $wikidataEntity instanceof StatementListProvider ) {
153
+		if ($wikidataEntity instanceof StatementListProvider) {
154 154
 			$wikidataEntity->getStatements()->clear();
155 155
 		}
156 156
 
157
-		if ( $wikidataEntity instanceof Item ) {
158
-			$wikidataEntity->setSiteLinkList( new SiteLinkList() );
157
+		if ($wikidataEntity instanceof Item) {
158
+			$wikidataEntity->setSiteLinkList(new SiteLinkList());
159 159
 		}
160 160
 
161
-		if ( $this->getOption( 'dry-run', false ) ) {
162
-			$wikidataEntityJson = json_encode( $this->entitySerializer->serialize( $wikidataEntity ) );
163
-			$this->output( $wikidataEntityJson . "\n" );
161
+		if ($this->getOption('dry-run', false)) {
162
+			$wikidataEntityJson = json_encode($this->entitySerializer->serialize($wikidataEntity));
163
+			$this->output($wikidataEntityJson."\n");
164 164
 			return "-$wikidataEntityId";
165 165
 		}
166 166
 
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
 			)->getEntity();
174 174
 
175 175
 			return $localEntity->getId()->getSerialization();
176
-		} catch ( StorageException $storageException ) {
177
-			return $this->storageExceptionToEntityId( $storageException );
176
+		} catch (StorageException $storageException) {
177
+			return $this->storageExceptionToEntityId($storageException);
178 178
 		}
179 179
 	}
180 180
 
181
-	private function storageExceptionToEntityId( StorageException $storageException ) {
181
+	private function storageExceptionToEntityId(StorageException $storageException) {
182 182
 		$message = $storageException->getMessage();
183 183
 		// example messages:
184 184
 		// * Item [[Item:Q475|Q475]] already has label "as references"
@@ -188,25 +188,25 @@  discard block
 block discarded – undo
188 188
 		// * Property [[Property:P694|P694]] already has label "instance of"
189 189
 		//   associated with language code en.
190 190
 		$pattern = '/[[|]([^][|]*)]] already has label .* associated with language code/';
191
-		if ( preg_match( $pattern, $message, $matches ) ) {
191
+		if (preg_match($pattern, $message, $matches)) {
192 192
 			return $matches[1];
193 193
 		} else {
194 194
 			throw $storageException;
195 195
 		}
196 196
 	}
197 197
 
198
-	private function outputConfigUpdates( array $configUpdates ) {
199
-		$configFormat = $this->getOption( 'config-format', 'globals' );
200
-		switch ( $configFormat ) {
198
+	private function outputConfigUpdates(array $configUpdates) {
199
+		$configFormat = $this->getOption('config-format', 'globals');
200
+		switch ($configFormat) {
201 201
 			case 'globals':
202
-				$this->outputConfigUpdatesGlobals( $configUpdates );
202
+				$this->outputConfigUpdatesGlobals($configUpdates);
203 203
 				break;
204 204
 			case 'wgConf':
205
-				$this->outputConfigUpdatesWgConf( $configUpdates );
205
+				$this->outputConfigUpdatesWgConf($configUpdates);
206 206
 				break;
207 207
 			default:
208
-				$this->error( "Invalid config format \"$configFormat\", using \"globals\"" );
209
-				$this->outputConfigUpdatesGlobals( $configUpdates );
208
+				$this->error("Invalid config format \"$configFormat\", using \"globals\"");
209
+				$this->outputConfigUpdatesGlobals($configUpdates);
210 210
 				break;
211 211
 		}
212 212
 	}
@@ -214,22 +214,22 @@  discard block
 block discarded – undo
214 214
 	/**
215 215
 	 * @param array[] $configUpdates
216 216
 	 */
217
-	private function outputConfigUpdatesGlobals( array $configUpdates ) {
218
-		foreach ( $configUpdates as $key => $value ) {
219
-			$localValueCode = var_export( $value['local'], true );
220
-			$this->output( "\$wg$key = $localValueCode;\n" );
217
+	private function outputConfigUpdatesGlobals(array $configUpdates) {
218
+		foreach ($configUpdates as $key => $value) {
219
+			$localValueCode = var_export($value['local'], true);
220
+			$this->output("\$wg$key = $localValueCode;\n");
221 221
 		}
222 222
 	}
223 223
 
224 224
 	/**
225 225
 	 * @param array[] $configUpdates
226 226
 	 */
227
-	private function outputConfigUpdatesWgConf( array $configUpdates ) {
228
-		foreach ( $configUpdates as $key => $value ) {
229
-			$keyCode = var_export( "wg$key", true );
230
-			$wikidataValueCode = var_export( $value['wikidata'], true );
231
-			$localValueCode = var_export( $value['local'], true );
232
-			$wikiIdCode = var_export( wfWikiID(), true );
227
+	private function outputConfigUpdatesWgConf(array $configUpdates) {
228
+		foreach ($configUpdates as $key => $value) {
229
+			$keyCode = var_export("wg$key", true);
230
+			$wikidataValueCode = var_export($value['wikidata'], true);
231
+			$localValueCode = var_export($value['local'], true);
232
+			$wikiIdCode = var_export(wfWikiID(), true);
233 233
 			$block = <<< EOF
234 234
 $keyCode => [
235 235
 	'default' => $wikidataValueCode,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 
240 240
 EOF;
241
-			$this->output( $block );
241
+			$this->output($block);
242 242
 		}
243 243
 	}
244 244
 
Please login to merge, or discard this patch.