@@ -10,35 +10,35 @@ |
||
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 | /** |
29 | 29 | * @param MediaWikiServices|null $services |
30 | 30 | * @return ConstraintRepository |
31 | 31 | */ |
32 | - public static function getConstraintRepository( MediaWikiServices $services = null ) { |
|
33 | - return self::getService( $services, 'WBQC_ConstraintRepository' ); |
|
32 | + public static function getConstraintRepository(MediaWikiServices $services = null) { |
|
33 | + return self::getService($services, 'WBQC_ConstraintRepository'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @param MediaWikiServices|null $services |
38 | 38 | * @return ConstraintLookup |
39 | 39 | */ |
40 | - public static function getConstraintLookup( MediaWikiServices $services = null ) { |
|
41 | - return self::getService( $services, 'WBQC_ConstraintLookup' ); |
|
40 | + public static function getConstraintLookup(MediaWikiServices $services = null) { |
|
41 | + return self::getService($services, 'WBQC_ConstraintLookup'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | public static function getDefaultInstance() { |
184 | 184 | static $instance = null; |
185 | 185 | |
186 | - if ( $instance === null ) { |
|
186 | + if ($instance === null) { |
|
187 | 187 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
188 | 188 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
189 | 189 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @return DelegatingConstraintChecker |
253 | 253 | */ |
254 | 254 | public function getConstraintChecker() { |
255 | - if ( $this->delegatingConstraintChecker === null ) { |
|
255 | + if ($this->delegatingConstraintChecker === null) { |
|
256 | 256 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
257 | 257 | $this->lookup, |
258 | 258 | $this->getConstraintCheckerMap(), |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | $this->constraintParameterParser, |
261 | 261 | $this->statementGuidParser, |
262 | 262 | ConstraintsServices::getLoggingHelper(), |
263 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
264 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
265 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
263 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
264 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
265 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
266 | 266 | ); |
267 | 267 | } |
268 | 268 | |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @return ConstraintChecker[] |
274 | 274 | */ |
275 | 275 | private function getConstraintCheckerMap() { |
276 | - if ( $this->constraintCheckerMap === null ) { |
|
276 | + if ($this->constraintCheckerMap === null) { |
|
277 | 277 | $connectionCheckerHelper = new ConnectionCheckerHelper(); |
278 | - $rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
|
279 | - if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
|
278 | + $rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter); |
|
279 | + if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') { |
|
280 | 280 | $sparqlHelper = new SparqlHelper( |
281 | 281 | $this->config, |
282 | 282 | $this->rdfVocabulary, |
@@ -298,118 +298,118 @@ discard block |
||
298 | 298 | ); |
299 | 299 | |
300 | 300 | $this->constraintCheckerMap = [ |
301 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
301 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
302 | 302 | => new ConflictsWithChecker( |
303 | 303 | $this->lookup, |
304 | 304 | $this->constraintParameterParser, |
305 | 305 | $connectionCheckerHelper |
306 | 306 | ), |
307 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
307 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
308 | 308 | => new ItemChecker( |
309 | 309 | $this->lookup, |
310 | 310 | $this->constraintParameterParser, |
311 | 311 | $connectionCheckerHelper |
312 | 312 | ), |
313 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
313 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
314 | 314 | => new TargetRequiredClaimChecker( |
315 | 315 | $this->lookup, |
316 | 316 | $this->constraintParameterParser, |
317 | 317 | $connectionCheckerHelper |
318 | 318 | ), |
319 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
319 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
320 | 320 | => new SymmetricChecker( |
321 | 321 | $this->lookup, |
322 | 322 | $connectionCheckerHelper |
323 | 323 | ), |
324 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
324 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
325 | 325 | => new InverseChecker( |
326 | 326 | $this->lookup, |
327 | 327 | $this->constraintParameterParser, |
328 | 328 | $connectionCheckerHelper |
329 | 329 | ), |
330 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
330 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
331 | 331 | => new QualifierChecker(), |
332 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
332 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
333 | 333 | => new QualifiersChecker( |
334 | 334 | $this->constraintParameterParser |
335 | 335 | ), |
336 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
336 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
337 | 337 | => new MandatoryQualifiersChecker( |
338 | 338 | $this->constraintParameterParser |
339 | 339 | ), |
340 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
340 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
341 | 341 | => new RangeChecker( |
342 | 342 | $this->propertyDataTypeLookup, |
343 | 343 | $this->constraintParameterParser, |
344 | 344 | $rangeCheckerHelper |
345 | 345 | ), |
346 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
346 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
347 | 347 | => new DiffWithinRangeChecker( |
348 | 348 | $this->constraintParameterParser, |
349 | 349 | $rangeCheckerHelper, |
350 | 350 | $this->config |
351 | 351 | ), |
352 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
352 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
353 | 353 | => new TypeChecker( |
354 | 354 | $this->lookup, |
355 | 355 | $this->constraintParameterParser, |
356 | 356 | $typeCheckerHelper, |
357 | 357 | $this->config |
358 | 358 | ), |
359 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
359 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
360 | 360 | => new ValueTypeChecker( |
361 | 361 | $this->lookup, |
362 | 362 | $this->constraintParameterParser, |
363 | 363 | $typeCheckerHelper, |
364 | 364 | $this->config |
365 | 365 | ), |
366 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
367 | - => new SingleValueChecker( $this->constraintParameterParser ), |
|
368 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
369 | - => new MultiValueChecker( $this->constraintParameterParser ), |
|
370 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
366 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
367 | + => new SingleValueChecker($this->constraintParameterParser), |
|
368 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
369 | + => new MultiValueChecker($this->constraintParameterParser), |
|
370 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
371 | 371 | => new UniqueValueChecker( |
372 | 372 | $sparqlHelper |
373 | 373 | ), |
374 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
374 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
375 | 375 | => new FormatChecker( |
376 | 376 | $this->constraintParameterParser, |
377 | 377 | $this->config, |
378 | 378 | $sparqlHelper |
379 | 379 | ), |
380 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
380 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
381 | 381 | => new CommonsLinkChecker( |
382 | 382 | $this->constraintParameterParser, |
383 | 383 | $this->titleParser |
384 | 384 | ), |
385 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
385 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
386 | 386 | => new OneOfChecker( |
387 | 387 | $this->constraintParameterParser |
388 | 388 | ), |
389 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
389 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
390 | 390 | => new ValueOnlyChecker(), |
391 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
391 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
392 | 392 | => new ReferenceChecker(), |
393 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
393 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
394 | 394 | => new NoBoundsChecker(), |
395 | - $this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
395 | + $this->config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
396 | 396 | => new AllowedUnitsChecker( |
397 | 397 | $this->constraintParameterParser, |
398 | 398 | $this->unitConverter |
399 | 399 | ), |
400 | - $this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
401 | - => new SingleBestValueChecker( $this->constraintParameterParser ), |
|
402 | - $this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
400 | + $this->config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
401 | + => new SingleBestValueChecker($this->constraintParameterParser), |
|
402 | + $this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
403 | 403 | => new EntityTypeChecker( |
404 | 404 | $this->constraintParameterParser |
405 | 405 | ), |
406 | - $this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
406 | + $this->config->get('WBQualityConstraintsNoneOfConstraintId') |
|
407 | 407 | => new NoneOfChecker( |
408 | 408 | $this->constraintParameterParser |
409 | 409 | ), |
410 | - $this->config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
410 | + $this->config->get('WBQualityConstraintsIntegerConstraintId') |
|
411 | 411 | => new IntegerChecker(), |
412 | - $this->config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
|
412 | + $this->config->get('WBQualityConstraintsCitationNeededConstraintId') |
|
413 | 413 | => new CitationNeededChecker(), |
414 | 414 | ]; |
415 | 415 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | * @return CheckResultSerializer |
422 | 422 | */ |
423 | 423 | public function getCheckResultSerializer() { |
424 | - if ( $this->checkResultSerializer === null ) { |
|
424 | + if ($this->checkResultSerializer === null) { |
|
425 | 425 | $this->checkResultSerializer = new CheckResultSerializer( |
426 | 426 | new ConstraintSerializer( |
427 | 427 | false // constraint parameters are not exposed |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * @return CheckResultDeserializer |
440 | 440 | */ |
441 | 441 | public function getCheckResultDeserializer() { |
442 | - if ( $this->checkResultDeserializer === null ) { |
|
442 | + if ($this->checkResultDeserializer === null) { |
|
443 | 443 | $this->checkResultDeserializer = new CheckResultDeserializer( |
444 | 444 | new ConstraintDeserializer(), |
445 | 445 | new ContextCursorDeserializer(), |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @return WikiPageEntityMetaDataAccessor |
459 | 459 | */ |
460 | 460 | public function getWikiPageEntityMetaDataAccessor() { |
461 | - if ( $this->wikiPageEntityMetaDataAccessor === null ) { |
|
461 | + if ($this->wikiPageEntityMetaDataAccessor === null) { |
|
462 | 462 | $this->wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
463 | 463 | $this->entityNamespaceLookup |
464 | 464 | ); |
@@ -471,12 +471,12 @@ discard block |
||
471 | 471 | * @return ResultsSource |
472 | 472 | */ |
473 | 473 | public function getResultsSource() { |
474 | - if ( $this->resultsSource === null ) { |
|
474 | + if ($this->resultsSource === null) { |
|
475 | 475 | $this->resultsSource = new CheckingResultsSource( |
476 | 476 | $this->getConstraintChecker() |
477 | 477 | ); |
478 | 478 | |
479 | - if ( $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
479 | + if ($this->config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
480 | 480 | $this->resultsSource = new CachingResultsSource( |
481 | 481 | $this->resultsSource, |
482 | 482 | ResultsCache::getDefaultInstance(), |
@@ -484,9 +484,9 @@ discard block |
||
484 | 484 | $this->getCheckResultDeserializer(), |
485 | 485 | $this->getWikiPageEntityMetaDataAccessor(), |
486 | 486 | $this->entityIdParser, |
487 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
487 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
488 | 488 | $this->getPossiblyStaleConstraintTypes(), |
489 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
489 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
490 | 490 | ConstraintsServices::getLoggingHelper() |
491 | 491 | ); |
492 | 492 | } |
@@ -500,10 +500,10 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function getPossiblyStaleConstraintTypes() { |
502 | 502 | return [ |
503 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
504 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
505 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
506 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
503 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
504 | + $this->config->get('WBQualityConstraintsTypeConstraintId'), |
|
505 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
506 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
507 | 507 | ]; |
508 | 508 | } |
509 | 509 |
@@ -7,20 +7,20 @@ |
||
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 | }, |
17 | 17 | |
18 | - 'WBQC_ConstraintRepository' => function( MediaWikiServices $services ) { |
|
18 | + 'WBQC_ConstraintRepository' => function(MediaWikiServices $services) { |
|
19 | 19 | return new ConstraintRepository(); |
20 | 20 | }, |
21 | 21 | |
22 | - 'WBQC_ConstraintLookup' => function( MediaWikiServices $services ) { |
|
23 | - $constraintRepository = ConstraintsServices::getConstraintRepository( $services ); |
|
24 | - return new CachingConstraintLookup( $constraintRepository ); |
|
22 | + 'WBQC_ConstraintLookup' => function(MediaWikiServices $services) { |
|
23 | + $constraintRepository = ConstraintsServices::getConstraintRepository($services); |
|
24 | + return new CachingConstraintLookup($constraintRepository); |
|
25 | 25 | }, |
26 | 26 | ]; |