Completed
Push — master ( d7bb4b...1f553c )
by
unknown
02:45 queued 10s
created
src/ConstraintCheck/Helper/SparqlHelper.php 1 patch
Spacing   +134 added lines, -136 removed lines patch added patch discarded remove patch
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 		$this->dataFactory = $dataFactory;
115 115
 		$this->defaultUserAgent = $defaultUserAgent;
116 116
 
117
-		$this->entityPrefix = $rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_ENTITY );
117
+		$this->entityPrefix = $rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_ENTITY);
118 118
 		$this->prefixes = <<<EOT
119
-PREFIX wd: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_ENTITY )}>
120
-PREFIX wds: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_STATEMENT )}>
121
-PREFIX wdt: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_DIRECT_CLAIM )}>
122
-PREFIX wdv: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NS_VALUE )}>
123
-PREFIX p: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_CLAIM )}>
124
-PREFIX ps: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_CLAIM_STATEMENT )}>
125
-PREFIX pq: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_QUALIFIER )}>
126
-PREFIX pqv: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_QUALIFIER_VALUE )}>
127
-PREFIX pr: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_REFERENCE )}>
128
-PREFIX prv: <{$rdfVocabulary->getNamespaceURI( RdfVocabulary::NSP_REFERENCE_VALUE )}>
119
+PREFIX wd: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_ENTITY)}>
120
+PREFIX wds: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_STATEMENT)}>
121
+PREFIX wdt: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_DIRECT_CLAIM)}>
122
+PREFIX wdv: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NS_VALUE)}>
123
+PREFIX p: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_CLAIM)}>
124
+PREFIX ps: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_CLAIM_STATEMENT)}>
125
+PREFIX pq: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_QUALIFIER)}>
126
+PREFIX pqv: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_QUALIFIER_VALUE)}>
127
+PREFIX pr: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_REFERENCE)}>
128
+PREFIX prv: <{$rdfVocabulary->getNamespaceURI(RdfVocabulary::NSP_REFERENCE_VALUE)}>
129 129
 PREFIX wikibase: <http://wikiba.se/ontology#>
130 130
 PREFIX wikibase-beta: <http://wikiba.se/ontology-beta#>
131 131
 EOT;
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @return CachedBool
141 141
 	 * @throws SparqlHelperException if the query times out or some other error occurs
142 142
 	 */
143
-	public function hasType( $id, array $classes, $withInstance ) {
144
-		$instanceOfId = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
145
-		$subclassOfId = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
143
+	public function hasType($id, array $classes, $withInstance) {
144
+		$instanceOfId = $this->config->get('WBQualityConstraintsInstanceOfId');
145
+		$subclassOfId = $this->config->get('WBQualityConstraintsSubclassOfId');
146 146
 
147
-		$path = ( $withInstance ? "wdt:$instanceOfId/" : "" ) . "wdt:$subclassOfId*";
147
+		$path = ($withInstance ? "wdt:$instanceOfId/" : "")."wdt:$subclassOfId*";
148 148
 
149 149
 		$metadatas = [];
150 150
 
151
-		foreach ( array_chunk( $classes, 20 ) as $classesChunk ) {
152
-			$classesValues = implode( ' ', array_map(
153
-				function( $class ) {
154
-					return 'wd:' . $class;
151
+		foreach (array_chunk($classes, 20) as $classesChunk) {
152
+			$classesValues = implode(' ', array_map(
153
+				function($class) {
154
+					return 'wd:'.$class;
155 155
 				},
156 156
 				$classesChunk
157
-			) );
157
+			));
158 158
 
159 159
 			$query = <<<EOF
160 160
 ASK {
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 EOF;
166 166
 			// TODO hint:gearing is a workaround for T168973 and can hopefully be removed eventually
167 167
 
168
-			$result = $this->runQuery( $query );
168
+			$result = $this->runQuery($query);
169 169
 			$metadatas[] = $result->getMetadata();
170
-			if ( $result->getArray()['boolean'] ) {
170
+			if ($result->getArray()['boolean']) {
171 171
 				return new CachedBool(
172 172
 					true,
173
-					Metadata::merge( $metadatas )
173
+					Metadata::merge($metadatas)
174 174
 				);
175 175
 			}
176 176
 		}
177 177
 
178 178
 		return new CachedBool(
179 179
 			false,
180
-			Metadata::merge( $metadatas )
180
+			Metadata::merge($metadatas)
181 181
 		);
182 182
 	}
183 183
 
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 		$ignoreDeprecatedStatements
194 194
 	) {
195 195
 		$pid = $statement->getPropertyId()->serialize();
196
-		$guid = str_replace( '$', '-', $statement->getGuid() );
196
+		$guid = str_replace('$', '-', $statement->getGuid());
197 197
 
198 198
 		$deprecatedFilter = '';
199
-		if ( $ignoreDeprecatedStatements ) {
199
+		if ($ignoreDeprecatedStatements) {
200 200
 			$deprecatedFilter .= 'MINUS { ?otherStatement wikibase:rank wikibase:DeprecatedRank. }';
201 201
 			$deprecatedFilter .= 'MINUS { ?otherStatement wikibase-beta:rank wikibase-beta:DeprecatedRank. }';
202 202
 		}
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 LIMIT 10
217 217
 EOF;
218 218
 
219
-		$result = $this->runQuery( $query );
219
+		$result = $this->runQuery($query);
220 220
 
221
-		return $this->getOtherEntities( $result );
221
+		return $this->getOtherEntities($result);
222 222
 	}
223 223
 
224 224
 	/**
@@ -243,16 +243,15 @@  discard block
 block discarded – undo
243 243
 		$dataType = $this->propertyDataTypeLookup->getDataTypeIdForProperty(
244 244
 			$snak->getPropertyId()
245 245
 		);
246
-		list( $value, $isFullValue ) = $this->getRdfLiteral( $dataType, $dataValue );
247
-		if ( $isFullValue ) {
246
+		list($value, $isFullValue) = $this->getRdfLiteral($dataType, $dataValue);
247
+		if ($isFullValue) {
248 248
 			$prefix .= 'v';
249 249
 		}
250 250
 		$path = $type === Context::TYPE_QUALIFIER ?
251
-			"$prefix:$pid" :
252
-			"prov:wasDerivedFrom/$prefix:$pid";
251
+			"$prefix:$pid" : "prov:wasDerivedFrom/$prefix:$pid";
253 252
 
254 253
 		$deprecatedFilter = '';
255
-		if ( $ignoreDeprecatedStatements ) {
254
+		if ($ignoreDeprecatedStatements) {
256 255
 			$deprecatedFilter = <<< EOF
257 256
   MINUS { ?otherStatement wikibase:rank wikibase:DeprecatedRank. }
258 257
   MINUS { ?otherStatement wikibase-beta:rank wikibase-beta:DeprecatedRank. }
@@ -273,9 +272,9 @@  discard block
 block discarded – undo
273 272
 LIMIT 10
274 273
 EOF;
275 274
 
276
-		$result = $this->runQuery( $query );
275
+		$result = $this->runQuery($query);
277 276
 
278
-		return $this->getOtherEntities( $result );
277
+		return $this->getOtherEntities($result);
279 278
 	}
280 279
 
281 280
 	/**
@@ -285,8 +284,8 @@  discard block
 block discarded – undo
285 284
 	 *
286 285
 	 * @return string
287 286
 	 */
288
-	private function stringLiteral( $text ) {
289
-		return '"' . strtr( $text, [ '"' => '\\"', '\\' => '\\\\' ] ) . '"';
287
+	private function stringLiteral($text) {
288
+		return '"'.strtr($text, ['"' => '\\"', '\\' => '\\\\']).'"';
290 289
 	}
291 290
 
292 291
 	/**
@@ -296,17 +295,17 @@  discard block
 block discarded – undo
296 295
 	 *
297 296
 	 * @return CachedEntityIds
298 297
 	 */
299
-	private function getOtherEntities( CachedQueryResults $results ) {
300
-		return new CachedEntityIds( array_map(
301
-			function ( $resultBindings ) {
298
+	private function getOtherEntities(CachedQueryResults $results) {
299
+		return new CachedEntityIds(array_map(
300
+			function($resultBindings) {
302 301
 				$entityIRI = $resultBindings['otherEntity']['value'];
303
-				$entityPrefixLength = strlen( $this->entityPrefix );
304
-				if ( substr( $entityIRI, 0, $entityPrefixLength ) === $this->entityPrefix ) {
302
+				$entityPrefixLength = strlen($this->entityPrefix);
303
+				if (substr($entityIRI, 0, $entityPrefixLength) === $this->entityPrefix) {
305 304
 					try {
306 305
 						return $this->entityIdParser->parse(
307
-							substr( $entityIRI, $entityPrefixLength )
306
+							substr($entityIRI, $entityPrefixLength)
308 307
 						);
309
-					} catch ( EntityIdParsingException $e ) {
308
+					} catch (EntityIdParsingException $e) {
310 309
 						// fall through
311 310
 					}
312 311
 				}
@@ -314,7 +313,7 @@  discard block
 block discarded – undo
314 313
 				return null;
315 314
 			},
316 315
 			$results->getArray()['results']['bindings']
317
-		), $results->getMetadata() );
316
+		), $results->getMetadata());
318 317
 	}
319 318
 
320 319
 	// @codingStandardsIgnoreStart cyclomatic complexity of this function is too high
@@ -327,47 +326,47 @@  discard block
 block discarded – undo
327 326
 	 * @return array the literal or IRI as a string in SPARQL syntax,
328 327
 	 * and a boolean indicating whether it refers to a full value node or not
329 328
 	 */
330
-	private function getRdfLiteral( $dataType, DataValue $dataValue ) {
331
-		switch ( $dataType ) {
329
+	private function getRdfLiteral($dataType, DataValue $dataValue) {
330
+		switch ($dataType) {
332 331
 			case 'string':
333 332
 			case 'external-id':
334
-				return [ $this->stringLiteral( $dataValue->getValue() ), false ];
333
+				return [$this->stringLiteral($dataValue->getValue()), false];
335 334
 			case 'commonsMedia':
336
-				$url = $this->rdfVocabulary->getMediaFileURI( $dataValue->getValue() );
337
-				return [ '<' . $url . '>', false ];
335
+				$url = $this->rdfVocabulary->getMediaFileURI($dataValue->getValue());
336
+				return ['<'.$url.'>', false];
338 337
 			case 'geo-shape':
339
-				$url = $this->rdfVocabulary->getGeoShapeURI( $dataValue->getValue() );
340
-				return [ '<' . $url . '>', false ];
338
+				$url = $this->rdfVocabulary->getGeoShapeURI($dataValue->getValue());
339
+				return ['<'.$url.'>', false];
341 340
 			case 'tabular-data':
342
-				$url = $this->rdfVocabulary->getTabularDataURI( $dataValue->getValue() );
343
-				return [ '<' . $url . '>', false ];
341
+				$url = $this->rdfVocabulary->getTabularDataURI($dataValue->getValue());
342
+				return ['<'.$url.'>', false];
344 343
 			case 'url':
345 344
 				$url = $dataValue->getValue();
346
-				if ( !preg_match( '/^[^<>"{}\\\\|^`\\x00-\\x20]*$/D', $url ) ) {
345
+				if (!preg_match('/^[^<>"{}\\\\|^`\\x00-\\x20]*$/D', $url)) {
347 346
 					// not a valid URL for SPARQL (see SPARQL spec, production 139 IRIREF)
348 347
 					// such an URL should never reach us, so just throw
349
-					throw new InvalidArgumentException( 'invalid URL: ' . $url );
348
+					throw new InvalidArgumentException('invalid URL: '.$url);
350 349
 				}
351
-				return [ '<' . $url . '>', false ];
350
+				return ['<'.$url.'>', false];
352 351
 			case 'wikibase-item':
353 352
 			case 'wikibase-property':
354 353
 				/** @var EntityIdValue $dataValue */
355
-				return [ 'wd:' . $dataValue->getEntityId()->getSerialization(), false ];
354
+				return ['wd:'.$dataValue->getEntityId()->getSerialization(), false];
356 355
 			case 'monolingualtext':
357 356
 				/** @var MonolingualTextValue $dataValue */
358 357
 				$lang = $dataValue->getLanguageCode();
359
-				if ( !preg_match( '/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/D', $lang ) ) {
358
+				if (!preg_match('/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/D', $lang)) {
360 359
 					// not a valid language tag for SPARQL (see SPARQL spec, production 145 LANGTAG)
361 360
 					// such a language tag should never reach us, so just throw
362
-					throw new InvalidArgumentException( 'invalid language tag: ' . $lang );
361
+					throw new InvalidArgumentException('invalid language tag: '.$lang);
363 362
 				}
364
-				return [ $this->stringLiteral( $dataValue->getText() ) . '@' . $lang, false ];
363
+				return [$this->stringLiteral($dataValue->getText()).'@'.$lang, false];
365 364
 			case 'globe-coordinate':
366 365
 			case 'quantity':
367 366
 			case 'time':
368
-				return [ 'wdv:' . $dataValue->getHash(), true ];
367
+				return ['wdv:'.$dataValue->getHash(), true];
369 368
 			default:
370
-				throw new InvalidArgumentException( 'unknown data type: ' . $dataType );
369
+				throw new InvalidArgumentException('unknown data type: '.$dataType);
371 370
 		}
372 371
 	}
373 372
 	// @codingStandardsIgnoreEnd
@@ -380,44 +379,44 @@  discard block
 block discarded – undo
380 379
 	 * @throws SparqlHelperException if the query times out or some other error occurs
381 380
 	 * @throws ConstraintParameterException if the $regex is invalid
382 381
 	 */
383
-	public function matchesRegularExpression( $text, $regex ) {
382
+	public function matchesRegularExpression($text, $regex) {
384 383
 		// caching wrapper around matchesRegularExpressionWithSparql
385 384
 
386
-		$textHash = hash( 'sha256', $text );
385
+		$textHash = hash('sha256', $text);
387 386
 		$cacheKey = $this->cache->makeKey(
388 387
 			'WikibaseQualityConstraints', // extension
389 388
 			'regex', // action
390 389
 			'WDQS-Java', // regex flavor
391
-			hash( 'sha256', $regex )
390
+			hash('sha256', $regex)
392 391
 		);
393
-		$cacheMapSize = $this->config->get( 'WBQualityConstraintsFormatCacheMapSize' );
392
+		$cacheMapSize = $this->config->get('WBQualityConstraintsFormatCacheMapSize');
394 393
 
395 394
 		$cacheMapArray = $this->cache->getWithSetCallback(
396 395
 			$cacheKey,
397 396
 			WANObjectCache::TTL_DAY,
398
-			function( $cacheMapArray ) use ( $text, $regex, $textHash, $cacheMapSize ) {
397
+			function($cacheMapArray) use ($text, $regex, $textHash, $cacheMapSize) {
399 398
 				// Initialize the cache map if not set
400
-				if ( $cacheMapArray === false ) {
399
+				if ($cacheMapArray === false) {
401 400
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.init';
402
-					$this->dataFactory->increment( $key );
401
+					$this->dataFactory->increment($key);
403 402
 					return [];
404 403
 				}
405 404
 
406 405
 				$key = 'wikibase.quality.constraints.regex.cache.refresh';
407
-				$this->dataFactory->increment( $key );
408
-				$cacheMap = MapCacheLRU::newFromArray( $cacheMapArray, $cacheMapSize );
409
-				if ( $cacheMap->has( $textHash ) ) {
406
+				$this->dataFactory->increment($key);
407
+				$cacheMap = MapCacheLRU::newFromArray($cacheMapArray, $cacheMapSize);
408
+				if ($cacheMap->has($textHash)) {
410 409
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.hit';
411
-					$this->dataFactory->increment( $key );
412
-					$cacheMap->get( $textHash ); // ping cache
410
+					$this->dataFactory->increment($key);
411
+					$cacheMap->get($textHash); // ping cache
413 412
 				} else {
414 413
 					$key = 'wikibase.quality.constraints.regex.cache.refresh.miss';
415
-					$this->dataFactory->increment( $key );
414
+					$this->dataFactory->increment($key);
416 415
 					try {
417
-						$matches = $this->matchesRegularExpressionWithSparql( $text, $regex );
418
-					} catch ( ConstraintParameterException $e ) {
419
-						$matches = $this->serializeConstraintParameterException( $e );
420
-					} catch ( SparqlHelperException $e ) {
416
+						$matches = $this->matchesRegularExpressionWithSparql($text, $regex);
417
+					} catch (ConstraintParameterException $e) {
418
+						$matches = $this->serializeConstraintParameterException($e);
419
+					} catch (SparqlHelperException $e) {
421 420
 						// don’t cache this
422 421
 						return $cacheMap->toArray();
423 422
 					}
@@ -441,42 +440,42 @@  discard block
 block discarded – undo
441 440
 			]
442 441
 		);
443 442
 
444
-		if ( isset( $cacheMapArray[$textHash] ) ) {
443
+		if (isset($cacheMapArray[$textHash])) {
445 444
 			$key = 'wikibase.quality.constraints.regex.cache.hit';
446
-			$this->dataFactory->increment( $key );
445
+			$this->dataFactory->increment($key);
447 446
 			$matches = $cacheMapArray[$textHash];
448
-			if ( is_bool( $matches ) ) {
447
+			if (is_bool($matches)) {
449 448
 				return $matches;
450
-			} elseif ( is_array( $matches ) &&
451
-				$matches['type'] == ConstraintParameterException::class ) {
452
-				throw $this->deserializeConstraintParameterException( $matches );
449
+			} elseif (is_array($matches) &&
450
+				$matches['type'] == ConstraintParameterException::class) {
451
+				throw $this->deserializeConstraintParameterException($matches);
453 452
 			} else {
454 453
 				throw new MWException(
455
-					'Value of unknown type in object cache (' .
456
-					'cache key: ' . $cacheKey . ', ' .
457
-					'cache map key: ' . $textHash . ', ' .
458
-					'value type: ' . gettype( $matches ) . ')'
454
+					'Value of unknown type in object cache ('.
455
+					'cache key: '.$cacheKey.', '.
456
+					'cache map key: '.$textHash.', '.
457
+					'value type: '.gettype($matches).')'
459 458
 				);
460 459
 			}
461 460
 		} else {
462 461
 			$key = 'wikibase.quality.constraints.regex.cache.miss';
463
-			$this->dataFactory->increment( $key );
464
-			return $this->matchesRegularExpressionWithSparql( $text, $regex );
462
+			$this->dataFactory->increment($key);
463
+			return $this->matchesRegularExpressionWithSparql($text, $regex);
465 464
 		}
466 465
 	}
467 466
 
468
-	private function serializeConstraintParameterException( ConstraintParameterException $cpe ) {
467
+	private function serializeConstraintParameterException(ConstraintParameterException $cpe) {
469 468
 		return [
470 469
 			'type' => ConstraintParameterException::class,
471
-			'violationMessage' => $this->violationMessageSerializer->serialize( $cpe->getViolationMessage() ),
470
+			'violationMessage' => $this->violationMessageSerializer->serialize($cpe->getViolationMessage()),
472 471
 		];
473 472
 	}
474 473
 
475
-	private function deserializeConstraintParameterException( array $serialization ) {
474
+	private function deserializeConstraintParameterException(array $serialization) {
476 475
 		$message = $this->violationMessageDeserializer->deserialize(
477 476
 			$serialization['violationMessage']
478 477
 		);
479
-		return new ConstraintParameterException( $message );
478
+		return new ConstraintParameterException($message);
480 479
 	}
481 480
 
482 481
 	/**
@@ -490,25 +489,25 @@  discard block
 block discarded – undo
490 489
 	 * @throws SparqlHelperException if the query times out or some other error occurs
491 490
 	 * @throws ConstraintParameterException if the $regex is invalid
492 491
 	 */
493
-	public function matchesRegularExpressionWithSparql( $text, $regex ) {
494
-		$textStringLiteral = $this->stringLiteral( $text );
495
-		$regexStringLiteral = $this->stringLiteral( '^(?:' . $regex . ')$' );
492
+	public function matchesRegularExpressionWithSparql($text, $regex) {
493
+		$textStringLiteral = $this->stringLiteral($text);
494
+		$regexStringLiteral = $this->stringLiteral('^(?:'.$regex.')$');
496 495
 
497 496
 		$query = <<<EOF
498 497
 SELECT (REGEX($textStringLiteral, $regexStringLiteral) AS ?matches) {}
499 498
 EOF;
500 499
 
501
-		$result = $this->runQuery( $query );
500
+		$result = $this->runQuery($query);
502 501
 
503 502
 		$vars = $result->getArray()['results']['bindings'][0];
504
-		if ( array_key_exists( 'matches', $vars ) ) {
503
+		if (array_key_exists('matches', $vars)) {
505 504
 			// true or false ⇒ regex okay, text matches or not
506 505
 			return $vars['matches']['value'] === 'true';
507 506
 		} else {
508 507
 			// empty result: regex broken
509 508
 			throw new ConstraintParameterException(
510
-				( new ViolationMessage( 'wbqc-violation-message-parameter-regex' ) )
511
-					->withInlineCode( $regex, Role::CONSTRAINT_PARAMETER_VALUE )
509
+				(new ViolationMessage('wbqc-violation-message-parameter-regex'))
510
+					->withInlineCode($regex, Role::CONSTRAINT_PARAMETER_VALUE)
512 511
 			);
513 512
 		}
514 513
 	}
@@ -520,14 +519,14 @@  discard block
 block discarded – undo
520 519
 	 *
521 520
 	 * @return boolean
522 521
 	 */
523
-	public function isTimeout( $responseContent ) {
524
-		$timeoutRegex = implode( '|', array_map(
525
-			function ( $fqn ) {
526
-				return preg_quote( $fqn, '/' );
522
+	public function isTimeout($responseContent) {
523
+		$timeoutRegex = implode('|', array_map(
524
+			function($fqn) {
525
+				return preg_quote($fqn, '/');
527 526
 			},
528
-			$this->config->get( 'WBQualityConstraintsSparqlTimeoutExceptionClasses' )
529
-		) );
530
-		return (bool)preg_match( '/' . $timeoutRegex . '/', $responseContent );
527
+			$this->config->get('WBQualityConstraintsSparqlTimeoutExceptionClasses')
528
+		));
529
+		return (bool) preg_match('/'.$timeoutRegex.'/', $responseContent);
531 530
 	}
532 531
 
533 532
 	/**
@@ -539,17 +538,17 @@  discard block
 block discarded – undo
539 538
 	 * @return integer|boolean the max-age (in seconds)
540 539
 	 * or a plain boolean if no max-age can be determined
541 540
 	 */
542
-	public function getCacheMaxAge( $responseHeaders ) {
541
+	public function getCacheMaxAge($responseHeaders) {
543 542
 		if (
544
-			array_key_exists( 'x-cache-status', $responseHeaders ) &&
545
-			preg_match( '/^hit(?:-.*)?$/', $responseHeaders['x-cache-status'][0] )
543
+			array_key_exists('x-cache-status', $responseHeaders) &&
544
+			preg_match('/^hit(?:-.*)?$/', $responseHeaders['x-cache-status'][0])
546 545
 		) {
547 546
 			$maxage = [];
548 547
 			if (
549
-				array_key_exists( 'cache-control', $responseHeaders ) &&
550
-				preg_match( '/\bmax-age=(\d+)\b/', $responseHeaders['cache-control'][0], $maxage )
548
+				array_key_exists('cache-control', $responseHeaders) &&
549
+				preg_match('/\bmax-age=(\d+)\b/', $responseHeaders['cache-control'][0], $maxage)
551 550
 			) {
552
-				return intval( $maxage[1] );
551
+				return intval($maxage[1]);
553 552
 			} else {
554 553
 				return true;
555 554
 			}
@@ -567,59 +566,58 @@  discard block
 block discarded – undo
567 566
 	 *
568 567
 	 * @throws SparqlHelperException if the query times out or some other error occurs
569 568
 	 */
570
-	public function runQuery( $query ) {
571
-		$endpoint = $this->config->get( 'WBQualityConstraintsSparqlEndpoint' );
572
-		$maxQueryTimeMillis = $this->config->get( 'WBQualityConstraintsSparqlMaxMillis' );
573
-		$url = $endpoint . '?' . http_build_query(
569
+	public function runQuery($query) {
570
+		$endpoint = $this->config->get('WBQualityConstraintsSparqlEndpoint');
571
+		$maxQueryTimeMillis = $this->config->get('WBQualityConstraintsSparqlMaxMillis');
572
+		$url = $endpoint.'?'.http_build_query(
574 573
 			[
575
-				'query' => "#wbqc\n" . $this->prefixes . $query,
574
+				'query' => "#wbqc\n".$this->prefixes.$query,
576 575
 				'format' => 'json',
577 576
 				'maxQueryTimeMillis' => $maxQueryTimeMillis,
578 577
 			],
579
-			null, ini_get( 'arg_separator.output' ),
578
+			null, ini_get('arg_separator.output'),
580 579
 			// encode spaces with %20, not +
581 580
 			PHP_QUERY_RFC3986
582 581
 		);
583 582
 
584 583
 		$options = [
585 584
 			'method' => 'GET',
586
-			'timeout' => (int)round( ( $maxQueryTimeMillis + 1000 ) / 1000 ),
585
+			'timeout' => (int) round(($maxQueryTimeMillis + 1000) / 1000),
587 586
 			'connectTimeout' => 'default',
588 587
 			'userAgent' => $this->defaultUserAgent,
589 588
 		];
590
-		$request = MWHttpRequest::factory( $url, $options );
591
-		$startTime = microtime( true );
589
+		$request = MWHttpRequest::factory($url, $options);
590
+		$startTime = microtime(true);
592 591
 		$status = $request->execute();
593
-		$endTime = microtime( true );
592
+		$endTime = microtime(true);
594 593
 		$this->dataFactory->timing(
595 594
 			'wikibase.quality.constraints.sparql.timing',
596
-			( $endTime - $startTime ) * 1000
595
+			($endTime - $startTime) * 1000
597 596
 		);
598 597
 
599
-		$maxAge = $this->getCacheMaxAge( $request->getResponseHeaders() );
600
-		if ( $maxAge ) {
601
-			$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.cached' );
598
+		$maxAge = $this->getCacheMaxAge($request->getResponseHeaders());
599
+		if ($maxAge) {
600
+			$this->dataFactory->increment('wikibase.quality.constraints.sparql.cached');
602 601
 		}
603 602
 
604
-		if ( $status->isOK() ) {
603
+		if ($status->isOK()) {
605 604
 			$json = $request->getContent();
606
-			$arr = json_decode( $json, true );
605
+			$arr = json_decode($json, true);
607 606
 			return new CachedQueryResults(
608 607
 				$arr,
609 608
 				Metadata::ofCachingMetadata(
610 609
 					$maxAge ?
611
-						CachingMetadata::ofMaximumAgeInSeconds( $maxAge ) :
612
-						CachingMetadata::fresh()
610
+						CachingMetadata::ofMaximumAgeInSeconds($maxAge) : CachingMetadata::fresh()
613 611
 				)
614 612
 			);
615 613
 		} else {
616
-			$this->dataFactory->increment( 'wikibase.quality.constraints.sparql.error' );
614
+			$this->dataFactory->increment('wikibase.quality.constraints.sparql.error');
617 615
 
618 616
 			$this->dataFactory->increment(
619 617
 				"wikibase.quality.constraints.sparql.error.http.{$request->getStatus()}"
620 618
 			);
621 619
 
622
-			if ( $this->isTimeout( $request->getContent() ) ) {
620
+			if ($this->isTimeout($request->getContent())) {
623 621
 				$this->dataFactory->increment(
624 622
 					'wikibase.quality.constraints.sparql.error.timeout'
625 623
 				);
Please login to merge, or discard this patch.
src/ServiceWiring.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 use WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResultSerializer;
27 27
 
28 28
 return [
29
-	ConstraintsServices::LOGGING_HELPER => function( MediaWikiServices $services ) {
29
+	ConstraintsServices::LOGGING_HELPER => function(MediaWikiServices $services) {
30 30
 		return new LoggingHelper(
31 31
 			$services->getStatsdDataFactory(),
32
-			LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
32
+			LoggerFactory::getInstance('WikibaseQualityConstraints'),
33 33
 			$services->getMainConfig()
34 34
 		);
35 35
 	},
36 36
 
37
-	ConstraintsServices::CONSTRAINT_REPOSITORY => function( MediaWikiServices $services ) {
37
+	ConstraintsServices::CONSTRAINT_REPOSITORY => function(MediaWikiServices $services) {
38 38
 		return new ConstraintRepository();
39 39
 	},
40 40
 
41
-	ConstraintsServices::CONSTRAINT_LOOKUP => function( MediaWikiServices $services ) {
42
-		$constraintRepository = ConstraintsServices::getConstraintRepository( $services );
43
-		return new CachingConstraintLookup( $constraintRepository );
41
+	ConstraintsServices::CONSTRAINT_LOOKUP => function(MediaWikiServices $services) {
42
+		$constraintRepository = ConstraintsServices::getConstraintRepository($services);
43
+		return new CachingConstraintLookup($constraintRepository);
44 44
 	},
45 45
 
46
-	ConstraintsServices::CHECK_RESULT_SERIALIZER => function( MediaWikiServices $services ) {
46
+	ConstraintsServices::CHECK_RESULT_SERIALIZER => function(MediaWikiServices $services) {
47 47
 		return new CheckResultSerializer(
48 48
 			new ConstraintSerializer(
49 49
 				false // constraint parameters are not exposed
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		);
55 55
 	},
56 56
 
57
-	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function( MediaWikiServices $services ) {
57
+	ConstraintsServices::CHECK_RESULT_DESERIALIZER => function(MediaWikiServices $services) {
58 58
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
59 59
 		$repo = WikibaseRepo::getDefaultInstance();
60 60
 		$entityIdParser = $repo->getEntityIdParser();
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		);
72 72
 	},
73 73
 
74
-	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function( MediaWikiServices $services ) {
74
+	ConstraintsServices::VIOLATION_MESSAGE_SERIALIZER => function(MediaWikiServices $services) {
75 75
 		return new ViolationMessageSerializer();
76 76
 	},
77 77
 
78
-	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function( MediaWikiServices $services ) {
78
+	ConstraintsServices::VIOLATION_MESSAGE_DESERIALIZER => function(MediaWikiServices $services) {
79 79
 		// TODO in the future, get EntityIdParser and DataValueFactory from $services?
80 80
 		$repo = WikibaseRepo::getDefaultInstance();
81 81
 		$entityIdParser = $repo->getEntityIdParser();
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		);
88 88
 	},
89 89
 
90
-	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function( MediaWikiServices $services ) {
90
+	ConstraintsServices::CONSTRAINT_PARAMETER_PARSER => function(MediaWikiServices $services) {
91 91
 		// TODO in the future, get DeserializerFactory and concept base URIs from $services?
92 92
 		$repo = WikibaseRepo::getDefaultInstance();
93 93
 		$deserializerFactory = $repo->getBaseDataModelDeserializerFactory();
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 		);
101 101
 	},
102 102
 
103
-	ConstraintsServices::CONNECTION_CHECKER_HELPER => function( MediaWikiServices $services ) {
103
+	ConstraintsServices::CONNECTION_CHECKER_HELPER => function(MediaWikiServices $services) {
104 104
 		return new ConnectionCheckerHelper();
105 105
 	},
106 106
 
107
-	ConstraintsServices::RANGE_CHECKER_HELPER => function( MediaWikiServices $services ) {
107
+	ConstraintsServices::RANGE_CHECKER_HELPER => function(MediaWikiServices $services) {
108 108
 		// TODO in the future, get UnitConverter from $services?
109 109
 		$repo = WikibaseRepo::getDefaultInstance();
110 110
 		$unitConverter = $repo->getUnitConverter();
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		);
116 116
 	},
117 117
 
118
-	ConstraintsServices::SPARQL_HELPER => function( MediaWikiServices $services ) {
119
-		$endpoint = $services->getMainConfig()->get( 'WBQualityConstraintsSparqlEndpoint' );
120
-		if ( $endpoint === '' ) {
118
+	ConstraintsServices::SPARQL_HELPER => function(MediaWikiServices $services) {
119
+		$endpoint = $services->getMainConfig()->get('WBQualityConstraintsSparqlEndpoint');
120
+		if ($endpoint === '') {
121 121
 			return new DummySparqlHelper();
122 122
 		}
123 123
 
@@ -133,114 +133,114 @@  discard block
 block discarded – undo
133 133
 			$entityIdParser,
134 134
 			$propertyDataTypeLookup,
135 135
 			$services->getMainWANObjectCache(),
136
-			ConstraintsServices::getViolationMessageSerializer( $services ),
137
-			ConstraintsServices::getViolationMessageDeserializer( $services ),
136
+			ConstraintsServices::getViolationMessageSerializer($services),
137
+			ConstraintsServices::getViolationMessageDeserializer($services),
138 138
 			$services->getStatsdDataFactory(),
139
-			wfWikiID() . ' WikibaseQualityConstraints ' . Http::userAgent()
139
+			wfWikiID().' WikibaseQualityConstraints '.Http::userAgent()
140 140
 		);
141 141
 	},
142 142
 
143
-	ConstraintsServices::TYPE_CHECKER_HELPER => function( MediaWikiServices $services ) {
143
+	ConstraintsServices::TYPE_CHECKER_HELPER => function(MediaWikiServices $services) {
144 144
 		return new TypeCheckerHelper(
145
-			WikibaseServices::getEntityLookup( $services ),
145
+			WikibaseServices::getEntityLookup($services),
146 146
 			$services->getMainConfig(),
147
-			ConstraintsServices::getSparqlHelper( $services ),
147
+			ConstraintsServices::getSparqlHelper($services),
148 148
 			$services->getStatsdDataFactory()
149 149
 		);
150 150
 	},
151 151
 
152
-	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function( MediaWikiServices $services ) {
152
+	ConstraintsServices::DELEGATING_CONSTRAINT_CHECKER => function(MediaWikiServices $services) {
153 153
 		// TODO in the future, get StatementGuidParser from $services?
154 154
 		$repo = WikibaseRepo::getDefaultInstance();
155 155
 		$statementGuidParser = $repo->getStatementGuidParser();
156 156
 
157 157
 		$config = $services->getMainConfig();
158 158
 		$checkerMap = [
159
-			$config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
160
-				=> ConstraintCheckerServices::getConflictsWithChecker( $services ),
161
-			$config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
162
-				=> ConstraintCheckerServices::getItemChecker( $services ),
163
-			$config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
164
-				=> ConstraintCheckerServices::getTargetRequiredClaimChecker( $services ),
165
-			$config->get( 'WBQualityConstraintsSymmetricConstraintId' )
166
-				=> ConstraintCheckerServices::getSymmetricChecker( $services ),
167
-			$config->get( 'WBQualityConstraintsInverseConstraintId' )
168
-				=> ConstraintCheckerServices::getInverseChecker( $services ),
169
-			$config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
170
-				=> ConstraintCheckerServices::getQualifierChecker( $services ),
171
-			$config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
172
-				=> ConstraintCheckerServices::getQualifiersChecker( $services ),
173
-			$config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
174
-				=> ConstraintCheckerServices::getMandatoryQualifiersChecker( $services ),
175
-			$config->get( 'WBQualityConstraintsRangeConstraintId' )
176
-				=> ConstraintCheckerServices::getRangeChecker( $services ),
177
-			$config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
178
-				=> ConstraintCheckerServices::getDiffWithinRangeChecker( $services ),
179
-			$config->get( 'WBQualityConstraintsTypeConstraintId' )
180
-				=> ConstraintCheckerServices::getTypeChecker( $services ),
181
-			$config->get( 'WBQualityConstraintsValueTypeConstraintId' )
182
-				=> ConstraintCheckerServices::getValueTypeChecker( $services ),
183
-			$config->get( 'WBQualityConstraintsSingleValueConstraintId' )
184
-				=> ConstraintCheckerServices::getSingleValueChecker( $services ),
185
-			$config->get( 'WBQualityConstraintsMultiValueConstraintId' )
186
-				=> ConstraintCheckerServices::getMultiValueChecker( $services ),
187
-			$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
188
-				=> ConstraintCheckerServices::getUniqueValueChecker( $services ),
189
-			$config->get( 'WBQualityConstraintsFormatConstraintId' )
190
-				=> ConstraintCheckerServices::getFormatChecker( $services ),
191
-			$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
192
-				=> ConstraintCheckerServices::getCommonsLinkChecker( $services ),
193
-			$config->get( 'WBQualityConstraintsOneOfConstraintId' )
194
-				=> ConstraintCheckerServices::getOneOfChecker( $services ),
195
-			$config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
196
-				=> ConstraintCheckerServices::getValueOnlyChecker( $services ),
197
-			$config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
198
-				=> ConstraintCheckerServices::getReferenceChecker( $services ),
199
-			$config->get( 'WBQualityConstraintsNoBoundsConstraintId' )
200
-				=> ConstraintCheckerServices::getNoBoundsChecker( $services ),
201
-			$config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' )
202
-				=> ConstraintCheckerServices::getAllowedUnitsChecker( $services ),
203
-			$config->get( 'WBQualityConstraintsSingleBestValueConstraintId' )
204
-				=> ConstraintCheckerServices::getSingleBestValueChecker( $services ),
205
-			$config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' )
206
-				=> ConstraintCheckerServices::getEntityTypeChecker( $services ),
207
-			$config->get( 'WBQualityConstraintsNoneOfConstraintId' )
208
-				=> ConstraintCheckerServices::getNoneOfChecker( $services ),
209
-			$config->get( 'WBQualityConstraintsIntegerConstraintId' )
210
-				=> ConstraintCheckerServices::getIntegerChecker( $services ),
211
-			$config->get( 'WBQualityConstraintsCitationNeededConstraintId' )
212
-				=> ConstraintCheckerServices::getCitationNeededChecker( $services ),
213
-			$config->get( 'WBQualityConstraintsPropertyScopeConstraintId' )
214
-				=> ConstraintCheckerServices::getPropertyScopeChecker( $services ),
215
-			$config->get( 'WBQualityConstraintsContemporaryConstraintId' )
216
-				=> ConstraintCheckerServices::getContemporaryChecker( $services ),
159
+			$config->get('WBQualityConstraintsConflictsWithConstraintId')
160
+				=> ConstraintCheckerServices::getConflictsWithChecker($services),
161
+			$config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
162
+				=> ConstraintCheckerServices::getItemChecker($services),
163
+			$config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
164
+				=> ConstraintCheckerServices::getTargetRequiredClaimChecker($services),
165
+			$config->get('WBQualityConstraintsSymmetricConstraintId')
166
+				=> ConstraintCheckerServices::getSymmetricChecker($services),
167
+			$config->get('WBQualityConstraintsInverseConstraintId')
168
+				=> ConstraintCheckerServices::getInverseChecker($services),
169
+			$config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
170
+				=> ConstraintCheckerServices::getQualifierChecker($services),
171
+			$config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
172
+				=> ConstraintCheckerServices::getQualifiersChecker($services),
173
+			$config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
174
+				=> ConstraintCheckerServices::getMandatoryQualifiersChecker($services),
175
+			$config->get('WBQualityConstraintsRangeConstraintId')
176
+				=> ConstraintCheckerServices::getRangeChecker($services),
177
+			$config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
178
+				=> ConstraintCheckerServices::getDiffWithinRangeChecker($services),
179
+			$config->get('WBQualityConstraintsTypeConstraintId')
180
+				=> ConstraintCheckerServices::getTypeChecker($services),
181
+			$config->get('WBQualityConstraintsValueTypeConstraintId')
182
+				=> ConstraintCheckerServices::getValueTypeChecker($services),
183
+			$config->get('WBQualityConstraintsSingleValueConstraintId')
184
+				=> ConstraintCheckerServices::getSingleValueChecker($services),
185
+			$config->get('WBQualityConstraintsMultiValueConstraintId')
186
+				=> ConstraintCheckerServices::getMultiValueChecker($services),
187
+			$config->get('WBQualityConstraintsDistinctValuesConstraintId')
188
+				=> ConstraintCheckerServices::getUniqueValueChecker($services),
189
+			$config->get('WBQualityConstraintsFormatConstraintId')
190
+				=> ConstraintCheckerServices::getFormatChecker($services),
191
+			$config->get('WBQualityConstraintsCommonsLinkConstraintId')
192
+				=> ConstraintCheckerServices::getCommonsLinkChecker($services),
193
+			$config->get('WBQualityConstraintsOneOfConstraintId')
194
+				=> ConstraintCheckerServices::getOneOfChecker($services),
195
+			$config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
196
+				=> ConstraintCheckerServices::getValueOnlyChecker($services),
197
+			$config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
198
+				=> ConstraintCheckerServices::getReferenceChecker($services),
199
+			$config->get('WBQualityConstraintsNoBoundsConstraintId')
200
+				=> ConstraintCheckerServices::getNoBoundsChecker($services),
201
+			$config->get('WBQualityConstraintsAllowedUnitsConstraintId')
202
+				=> ConstraintCheckerServices::getAllowedUnitsChecker($services),
203
+			$config->get('WBQualityConstraintsSingleBestValueConstraintId')
204
+				=> ConstraintCheckerServices::getSingleBestValueChecker($services),
205
+			$config->get('WBQualityConstraintsAllowedEntityTypesConstraintId')
206
+				=> ConstraintCheckerServices::getEntityTypeChecker($services),
207
+			$config->get('WBQualityConstraintsNoneOfConstraintId')
208
+				=> ConstraintCheckerServices::getNoneOfChecker($services),
209
+			$config->get('WBQualityConstraintsIntegerConstraintId')
210
+				=> ConstraintCheckerServices::getIntegerChecker($services),
211
+			$config->get('WBQualityConstraintsCitationNeededConstraintId')
212
+				=> ConstraintCheckerServices::getCitationNeededChecker($services),
213
+			$config->get('WBQualityConstraintsPropertyScopeConstraintId')
214
+				=> ConstraintCheckerServices::getPropertyScopeChecker($services),
215
+			$config->get('WBQualityConstraintsContemporaryConstraintId')
216
+				=> ConstraintCheckerServices::getContemporaryChecker($services),
217 217
 		];
218 218
 
219 219
 		return new DelegatingConstraintChecker(
220
-			WikibaseServices::getEntityLookup( $services ),
220
+			WikibaseServices::getEntityLookup($services),
221 221
 			$checkerMap,
222
-			ConstraintsServices::getConstraintLookup( $services ),
223
-			ConstraintsServices::getConstraintParameterParser( $services ),
222
+			ConstraintsServices::getConstraintLookup($services),
223
+			ConstraintsServices::getConstraintParameterParser($services),
224 224
 			$statementGuidParser,
225
-			ConstraintsServices::getLoggingHelper( $services ),
226
-			$config->get( 'WBQualityConstraintsCheckQualifiers' ),
227
-			$config->get( 'WBQualityConstraintsCheckReferences' ),
228
-			$config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
225
+			ConstraintsServices::getLoggingHelper($services),
226
+			$config->get('WBQualityConstraintsCheckQualifiers'),
227
+			$config->get('WBQualityConstraintsCheckReferences'),
228
+			$config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
229 229
 		);
230 230
 	},
231 231
 
232
-	ConstraintsServices::RESULTS_SOURCE => function( MediaWikiServices $services ) {
232
+	ConstraintsServices::RESULTS_SOURCE => function(MediaWikiServices $services) {
233 233
 		$config = $services->getMainConfig();
234 234
 		$resultsSource = new CheckingResultsSource(
235
-			ConstraintsServices::getDelegatingConstraintChecker( $services )
235
+			ConstraintsServices::getDelegatingConstraintChecker($services)
236 236
 		);
237 237
 
238
-		if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) {
238
+		if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) {
239 239
 			$possiblyStaleConstraintTypes = [
240
-				$config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ),
241
-				$config->get( 'WBQualityConstraintsTypeConstraintId' ),
242
-				$config->get( 'WBQualityConstraintsValueTypeConstraintId' ),
243
-				$config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ),
240
+				$config->get('WBQualityConstraintsCommonsLinkConstraintId'),
241
+				$config->get('WBQualityConstraintsTypeConstraintId'),
242
+				$config->get('WBQualityConstraintsValueTypeConstraintId'),
243
+				$config->get('WBQualityConstraintsDistinctValuesConstraintId'),
244 244
 			];
245 245
 			// TODO in the future, get EntityIdParser and WikiPageEntityMetaDataAccessor from $services?
246 246
 			$repo = WikibaseRepo::getDefaultInstance();
@@ -249,21 +249,21 @@  discard block
 block discarded – undo
249 249
 			$wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup(
250 250
 				$entityNamespaceLookup,
251 251
 				$services->getSlotRoleStore(),
252
-				$repo->getSettings()->getSetting( 'changesDatabase' ),
252
+				$repo->getSettings()->getSetting('changesDatabase'),
253 253
 				'' // Empty string here means this only works for the local repo
254 254
 			);
255 255
 
256 256
 			$resultsSource = new CachingResultsSource(
257 257
 				$resultsSource,
258 258
 				ResultsCache::getDefaultInstance(),
259
-				ConstraintsServices::getCheckResultSerializer( $services ),
260
-				ConstraintsServices::getCheckResultDeserializer( $services ),
259
+				ConstraintsServices::getCheckResultSerializer($services),
260
+				ConstraintsServices::getCheckResultDeserializer($services),
261 261
 				$wikiPageEntityMetaDataAccessor,
262 262
 				$entityIdParser,
263
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ),
263
+				$config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'),
264 264
 				$possiblyStaleConstraintTypes,
265
-				$config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ),
266
-				ConstraintsServices::getLoggingHelper( $services )
265
+				$config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'),
266
+				ConstraintsServices::getLoggingHelper($services)
267 267
 			);
268 268
 		}
269 269
 
Please login to merge, or discard this patch.