@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | public static function getDefaultInstance() { |
189 | 189 | static $instance = null; |
190 | 190 | |
191 | - if ( $instance === null ) { |
|
191 | + if ($instance === null) { |
|
192 | 192 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
193 | 193 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
194 | 194 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
@@ -257,17 +257,17 @@ discard block |
||
257 | 257 | * @return DelegatingConstraintChecker |
258 | 258 | */ |
259 | 259 | public function getConstraintChecker() { |
260 | - if ( $this->delegatingConstraintChecker === null ) { |
|
260 | + if ($this->delegatingConstraintChecker === null) { |
|
261 | 261 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
262 | 262 | $this->lookup, |
263 | 263 | $this->getConstraintCheckerMap(), |
264 | - new CachingConstraintLookup( $this->getConstraintRepository() ), |
|
264 | + new CachingConstraintLookup($this->getConstraintRepository()), |
|
265 | 265 | $this->constraintParameterParser, |
266 | 266 | $this->statementGuidParser, |
267 | 267 | ConstraintsServices::getLoggingHelper(), |
268 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
269 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
270 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
268 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
269 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
270 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
271 | 271 | ); |
272 | 272 | } |
273 | 273 | |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | * @return ConstraintChecker[] |
279 | 279 | */ |
280 | 280 | private function getConstraintCheckerMap() { |
281 | - if ( $this->constraintCheckerMap === null ) { |
|
281 | + if ($this->constraintCheckerMap === null) { |
|
282 | 282 | $connectionCheckerHelper = new ConnectionCheckerHelper(); |
283 | - $rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
|
284 | - if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
|
283 | + $rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter); |
|
284 | + if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') { |
|
285 | 285 | $sparqlHelper = new SparqlHelper( |
286 | 286 | $this->config, |
287 | 287 | $this->rdfVocabulary, |
@@ -303,118 +303,118 @@ discard block |
||
303 | 303 | ); |
304 | 304 | |
305 | 305 | $this->constraintCheckerMap = [ |
306 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
306 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
307 | 307 | => new ConflictsWithChecker( |
308 | 308 | $this->lookup, |
309 | 309 | $this->constraintParameterParser, |
310 | 310 | $connectionCheckerHelper |
311 | 311 | ), |
312 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
312 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
313 | 313 | => new ItemChecker( |
314 | 314 | $this->lookup, |
315 | 315 | $this->constraintParameterParser, |
316 | 316 | $connectionCheckerHelper |
317 | 317 | ), |
318 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
318 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
319 | 319 | => new TargetRequiredClaimChecker( |
320 | 320 | $this->lookup, |
321 | 321 | $this->constraintParameterParser, |
322 | 322 | $connectionCheckerHelper |
323 | 323 | ), |
324 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
324 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
325 | 325 | => new SymmetricChecker( |
326 | 326 | $this->lookup, |
327 | 327 | $connectionCheckerHelper |
328 | 328 | ), |
329 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
329 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
330 | 330 | => new InverseChecker( |
331 | 331 | $this->lookup, |
332 | 332 | $this->constraintParameterParser, |
333 | 333 | $connectionCheckerHelper |
334 | 334 | ), |
335 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
335 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
336 | 336 | => new QualifierChecker(), |
337 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
337 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
338 | 338 | => new QualifiersChecker( |
339 | 339 | $this->constraintParameterParser |
340 | 340 | ), |
341 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
341 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
342 | 342 | => new MandatoryQualifiersChecker( |
343 | 343 | $this->constraintParameterParser |
344 | 344 | ), |
345 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
345 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
346 | 346 | => new RangeChecker( |
347 | 347 | $this->propertyDataTypeLookup, |
348 | 348 | $this->constraintParameterParser, |
349 | 349 | $rangeCheckerHelper |
350 | 350 | ), |
351 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
351 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
352 | 352 | => new DiffWithinRangeChecker( |
353 | 353 | $this->constraintParameterParser, |
354 | 354 | $rangeCheckerHelper, |
355 | 355 | $this->config |
356 | 356 | ), |
357 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
357 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
358 | 358 | => new TypeChecker( |
359 | 359 | $this->lookup, |
360 | 360 | $this->constraintParameterParser, |
361 | 361 | $typeCheckerHelper, |
362 | 362 | $this->config |
363 | 363 | ), |
364 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
364 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
365 | 365 | => new ValueTypeChecker( |
366 | 366 | $this->lookup, |
367 | 367 | $this->constraintParameterParser, |
368 | 368 | $typeCheckerHelper, |
369 | 369 | $this->config |
370 | 370 | ), |
371 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
372 | - => new SingleValueChecker( $this->constraintParameterParser ), |
|
373 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
374 | - => new MultiValueChecker( $this->constraintParameterParser ), |
|
375 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
371 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
372 | + => new SingleValueChecker($this->constraintParameterParser), |
|
373 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
374 | + => new MultiValueChecker($this->constraintParameterParser), |
|
375 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
376 | 376 | => new UniqueValueChecker( |
377 | 377 | $sparqlHelper |
378 | 378 | ), |
379 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
379 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
380 | 380 | => new FormatChecker( |
381 | 381 | $this->constraintParameterParser, |
382 | 382 | $this->config, |
383 | 383 | $sparqlHelper |
384 | 384 | ), |
385 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
385 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
386 | 386 | => new CommonsLinkChecker( |
387 | 387 | $this->constraintParameterParser, |
388 | 388 | $this->titleParser |
389 | 389 | ), |
390 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
390 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
391 | 391 | => new OneOfChecker( |
392 | 392 | $this->constraintParameterParser |
393 | 393 | ), |
394 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
394 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
395 | 395 | => new ValueOnlyChecker(), |
396 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
396 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
397 | 397 | => new ReferenceChecker(), |
398 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
398 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
399 | 399 | => new NoBoundsChecker(), |
400 | - $this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
400 | + $this->config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
401 | 401 | => new AllowedUnitsChecker( |
402 | 402 | $this->constraintParameterParser, |
403 | 403 | $this->unitConverter |
404 | 404 | ), |
405 | - $this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
406 | - => new SingleBestValueChecker( $this->constraintParameterParser ), |
|
407 | - $this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
405 | + $this->config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
406 | + => new SingleBestValueChecker($this->constraintParameterParser), |
|
407 | + $this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
408 | 408 | => new EntityTypeChecker( |
409 | 409 | $this->constraintParameterParser |
410 | 410 | ), |
411 | - $this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
411 | + $this->config->get('WBQualityConstraintsNoneOfConstraintId') |
|
412 | 412 | => new NoneOfChecker( |
413 | 413 | $this->constraintParameterParser |
414 | 414 | ), |
415 | - $this->config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
415 | + $this->config->get('WBQualityConstraintsIntegerConstraintId') |
|
416 | 416 | => new IntegerChecker(), |
417 | - $this->config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
|
417 | + $this->config->get('WBQualityConstraintsCitationNeededConstraintId') |
|
418 | 418 | => new CitationNeededChecker(), |
419 | 419 | ]; |
420 | 420 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @return ConstraintRepository |
427 | 427 | */ |
428 | 428 | public function getConstraintRepository() { |
429 | - if ( $this->constraintRepository === null ) { |
|
429 | + if ($this->constraintRepository === null) { |
|
430 | 430 | $this->constraintRepository = new ConstraintRepository(); |
431 | 431 | } |
432 | 432 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @return CheckResultSerializer |
438 | 438 | */ |
439 | 439 | public function getCheckResultSerializer() { |
440 | - if ( $this->checkResultSerializer === null ) { |
|
440 | + if ($this->checkResultSerializer === null) { |
|
441 | 441 | $this->checkResultSerializer = new CheckResultSerializer( |
442 | 442 | new ConstraintSerializer( |
443 | 443 | false // constraint parameters are not exposed |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | * @return CheckResultDeserializer |
456 | 456 | */ |
457 | 457 | public function getCheckResultDeserializer() { |
458 | - if ( $this->checkResultDeserializer === null ) { |
|
458 | + if ($this->checkResultDeserializer === null) { |
|
459 | 459 | $this->checkResultDeserializer = new CheckResultDeserializer( |
460 | 460 | new ConstraintDeserializer(), |
461 | 461 | new ContextCursorDeserializer(), |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @return WikiPageEntityMetaDataAccessor |
475 | 475 | */ |
476 | 476 | public function getWikiPageEntityMetaDataAccessor() { |
477 | - if ( $this->wikiPageEntityMetaDataAccessor === null ) { |
|
477 | + if ($this->wikiPageEntityMetaDataAccessor === null) { |
|
478 | 478 | $this->wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
479 | 479 | $this->entityNamespaceLookup |
480 | 480 | ); |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | * @return ResultsSource |
488 | 488 | */ |
489 | 489 | public function getResultsSource() { |
490 | - if ( $this->resultsSource === null ) { |
|
490 | + if ($this->resultsSource === null) { |
|
491 | 491 | $this->resultsSource = new CheckingResultsSource( |
492 | 492 | $this->getConstraintChecker() |
493 | 493 | ); |
494 | 494 | |
495 | - if ( $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
495 | + if ($this->config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
496 | 496 | $this->resultsSource = new CachingResultsSource( |
497 | 497 | $this->resultsSource, |
498 | 498 | ResultsCache::getDefaultInstance(), |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | $this->getCheckResultDeserializer(), |
501 | 501 | $this->getWikiPageEntityMetaDataAccessor(), |
502 | 502 | $this->entityIdParser, |
503 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
503 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
504 | 504 | $this->getPossiblyStaleConstraintTypes(), |
505 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
505 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
506 | 506 | ConstraintsServices::getLoggingHelper() |
507 | 507 | ); |
508 | 508 | } |
@@ -516,10 +516,10 @@ discard block |
||
516 | 516 | */ |
517 | 517 | public function getPossiblyStaleConstraintTypes() { |
518 | 518 | return [ |
519 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
520 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
521 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
522 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
519 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
520 | + $this->config->get('WBQualityConstraintsTypeConstraintId'), |
|
521 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
522 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
523 | 523 | ]; |
524 | 524 | } |
525 | 525 |
@@ -10,19 +10,19 @@ |
||
10 | 10 | */ |
11 | 11 | class ConstraintsServices { |
12 | 12 | |
13 | - private static function getService( MediaWikiServices $services = null, $name ) { |
|
14 | - if ( $services === null ) { |
|
13 | + private static function getService(MediaWikiServices $services = null, $name) { |
|
14 | + if ($services === null) { |
|
15 | 15 | $services = MediaWikiServices::getInstance(); |
16 | 16 | } |
17 | - return $services->getService( $name ); |
|
17 | + return $services->getService($name); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param MediaWikiServices|null $services |
22 | 22 | * @return LoggingHelper |
23 | 23 | */ |
24 | - public static function getLoggingHelper( MediaWikiServices $services = null ) { |
|
25 | - return self::getService( $services, 'WBQC_LoggingHelper' ); |
|
24 | + public static function getLoggingHelper(MediaWikiServices $services = null) { |
|
25 | + return self::getService($services, 'WBQC_LoggingHelper'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | } |
@@ -7,10 +7,10 @@ |
||
7 | 7 | use WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\LoggingHelper; |
8 | 8 | |
9 | 9 | return [ |
10 | - 'WBQC_LoggingHelper' => function( MediaWikiServices $services ) { |
|
10 | + 'WBQC_LoggingHelper' => function(MediaWikiServices $services) { |
|
11 | 11 | return new LoggingHelper( |
12 | 12 | $services->getStatsdDataFactory(), |
13 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
13 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
14 | 14 | $services->getMainConfig() |
15 | 15 | ); |
16 | 16 | }, |