@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public static function getDefaultInstance() { |
152 | 152 | static $instance = null; |
153 | 153 | |
154 | - if ( $instance === null ) { |
|
154 | + if ($instance === null) { |
|
155 | 155 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
156 | 156 | $entityIdFormatter = $wikibaseRepo->getEntityIdHtmlLinkFormatterFactory()->getEntityIdFormatter( |
157 | 157 | $wikibaseRepo->getLanguageFallbackLabelDescriptionLookupFactory()->newLabelDescriptionLookup( |
@@ -231,21 +231,21 @@ discard block |
||
231 | 231 | * @return DelegatingConstraintChecker |
232 | 232 | */ |
233 | 233 | public function getConstraintChecker() { |
234 | - if ( $this->delegatingConstraintChecker === null ) { |
|
234 | + if ($this->delegatingConstraintChecker === null) { |
|
235 | 235 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
236 | 236 | $this->lookup, |
237 | 237 | $this->getConstraintCheckerMap(), |
238 | - new CachingConstraintLookup( $this->getConstraintRepository() ), |
|
238 | + new CachingConstraintLookup($this->getConstraintRepository()), |
|
239 | 239 | $this->constraintParameterParser, |
240 | 240 | $this->statementGuidParser, |
241 | 241 | new LoggingHelper( |
242 | 242 | $this->dataFactory, |
243 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
243 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
244 | 244 | $this->config |
245 | 245 | ), |
246 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
247 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
248 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
246 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
247 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
248 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
249 | 249 | ); |
250 | 250 | } |
251 | 251 | |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * @return ConstraintChecker[] |
257 | 257 | */ |
258 | 258 | private function getConstraintCheckerMap() { |
259 | - if ( $this->constraintCheckerMap === null ) { |
|
259 | + if ($this->constraintCheckerMap === null) { |
|
260 | 260 | $connectionCheckerHelper = new ConnectionCheckerHelper(); |
261 | - $rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
|
262 | - if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
|
261 | + $rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter); |
|
262 | + if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') { |
|
263 | 263 | $sparqlHelper = new SparqlHelper( |
264 | 264 | $this->config, |
265 | 265 | $this->rdfVocabulary, |
@@ -282,74 +282,74 @@ discard block |
||
282 | 282 | ); |
283 | 283 | |
284 | 284 | $this->constraintCheckerMap = [ |
285 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
285 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
286 | 286 | => new ConflictsWithChecker( |
287 | 287 | $this->lookup, |
288 | 288 | $this->constraintParameterParser, |
289 | 289 | $connectionCheckerHelper, |
290 | 290 | $this->constraintParameterRenderer |
291 | 291 | ), |
292 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
292 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
293 | 293 | => new ItemChecker( |
294 | 294 | $this->lookup, |
295 | 295 | $this->constraintParameterParser, |
296 | 296 | $connectionCheckerHelper, |
297 | 297 | $this->constraintParameterRenderer |
298 | 298 | ), |
299 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
299 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
300 | 300 | => new TargetRequiredClaimChecker( |
301 | 301 | $this->lookup, |
302 | 302 | $this->constraintParameterParser, |
303 | 303 | $connectionCheckerHelper, |
304 | 304 | $this->constraintParameterRenderer |
305 | 305 | ), |
306 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
306 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
307 | 307 | => new SymmetricChecker( |
308 | 308 | $this->lookup, |
309 | 309 | $connectionCheckerHelper, |
310 | 310 | $this->constraintParameterRenderer |
311 | 311 | ), |
312 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
312 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
313 | 313 | => new InverseChecker( |
314 | 314 | $this->lookup, |
315 | 315 | $this->constraintParameterParser, |
316 | 316 | $connectionCheckerHelper, |
317 | 317 | $this->constraintParameterRenderer |
318 | 318 | ), |
319 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
319 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
320 | 320 | => new QualifierChecker(), |
321 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
321 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
322 | 322 | => new QualifiersChecker( |
323 | 323 | $this->constraintParameterParser, |
324 | 324 | $this->constraintParameterRenderer |
325 | 325 | ), |
326 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
326 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
327 | 327 | => new MandatoryQualifiersChecker( |
328 | 328 | $this->constraintParameterParser, |
329 | 329 | $this->constraintParameterRenderer |
330 | 330 | ), |
331 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
331 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
332 | 332 | => new RangeChecker( |
333 | 333 | $this->propertyDataTypeLookup, |
334 | 334 | $this->constraintParameterParser, |
335 | 335 | $rangeCheckerHelper, |
336 | 336 | $this->constraintParameterRenderer |
337 | 337 | ), |
338 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
338 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
339 | 339 | => new DiffWithinRangeChecker( |
340 | 340 | $this->constraintParameterParser, |
341 | 341 | $rangeCheckerHelper, |
342 | 342 | $this->constraintParameterRenderer, |
343 | 343 | $this->config |
344 | 344 | ), |
345 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
345 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
346 | 346 | => new TypeChecker( |
347 | 347 | $this->lookup, |
348 | 348 | $this->constraintParameterParser, |
349 | 349 | $typeCheckerHelper, |
350 | 350 | $this->config |
351 | 351 | ), |
352 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
352 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
353 | 353 | => new ValueTypeChecker( |
354 | 354 | $this->lookup, |
355 | 355 | $this->constraintParameterParser, |
@@ -357,38 +357,38 @@ discard block |
||
357 | 357 | $typeCheckerHelper, |
358 | 358 | $this->config |
359 | 359 | ), |
360 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
360 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
361 | 361 | => new SingleValueChecker(), |
362 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
362 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
363 | 363 | => new MultiValueChecker(), |
364 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
364 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
365 | 365 | => new UniqueValueChecker( |
366 | 366 | $this->constraintParameterRenderer, |
367 | 367 | $sparqlHelper |
368 | 368 | ), |
369 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
369 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
370 | 370 | => new FormatChecker( |
371 | 371 | $this->constraintParameterParser, |
372 | 372 | $this->constraintParameterRenderer, |
373 | 373 | $this->config, |
374 | 374 | $sparqlHelper |
375 | 375 | ), |
376 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
376 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
377 | 377 | => new CommonsLinkChecker( |
378 | 378 | $this->constraintParameterParser, |
379 | 379 | $this->constraintParameterRenderer, |
380 | 380 | $this->titleParser |
381 | 381 | ), |
382 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
382 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
383 | 383 | => new OneOfChecker( |
384 | 384 | $this->constraintParameterParser, |
385 | 385 | $this->constraintParameterRenderer |
386 | 386 | ), |
387 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
387 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
388 | 388 | => new ValueOnlyChecker(), |
389 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
389 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
390 | 390 | => new ReferenceChecker(), |
391 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
391 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
392 | 392 | => new NoBoundsChecker(), |
393 | 393 | ]; |
394 | 394 | } |
@@ -400,26 +400,26 @@ discard block |
||
400 | 400 | * @return array[] |
401 | 401 | */ |
402 | 402 | public function getConstraintParameterMap() { |
403 | - if ( $this->constraintParameterMap === null ) { |
|
403 | + if ($this->constraintParameterMap === null) { |
|
404 | 404 | $this->constraintParameterMap = [ |
405 | - 'Commons link' => [ 'namespace' ], |
|
406 | - 'Conflicts with' => [ 'property', 'item' ], |
|
407 | - 'Diff within range' => [ 'property', 'minimum_quantity', 'maximum_quantity' ], |
|
408 | - 'Format' => [ 'pattern' ], |
|
409 | - 'Inverse' => [ 'property' ], |
|
410 | - 'Item' => [ 'property', 'item' ], |
|
411 | - 'Mandatory qualifiers' => [ 'property' ], |
|
405 | + 'Commons link' => ['namespace'], |
|
406 | + 'Conflicts with' => ['property', 'item'], |
|
407 | + 'Diff within range' => ['property', 'minimum_quantity', 'maximum_quantity'], |
|
408 | + 'Format' => ['pattern'], |
|
409 | + 'Inverse' => ['property'], |
|
410 | + 'Item' => ['property', 'item'], |
|
411 | + 'Mandatory qualifiers' => ['property'], |
|
412 | 412 | 'Multi value' => [], |
413 | - 'One of' => [ 'item' ], |
|
413 | + 'One of' => ['item'], |
|
414 | 414 | 'Qualifier' => [], |
415 | - 'Qualifiers' => [ 'property' ], |
|
416 | - 'Range' => [ 'minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date' ], |
|
415 | + 'Qualifiers' => ['property'], |
|
416 | + 'Range' => ['minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date'], |
|
417 | 417 | 'Single value' => [], |
418 | 418 | 'Symmetric' => [], |
419 | - 'Target required claim' => [ 'property', 'item' ], |
|
420 | - 'Type' => [ 'class', 'relation' ], |
|
419 | + 'Target required claim' => ['property', 'item'], |
|
420 | + 'Type' => ['class', 'relation'], |
|
421 | 421 | 'Unique value' => [], |
422 | - 'Value type' => [ 'class', 'relation' ] |
|
422 | + 'Value type' => ['class', 'relation'] |
|
423 | 423 | ]; |
424 | 424 | } |
425 | 425 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @return ConstraintRepository |
431 | 431 | */ |
432 | 432 | public function getConstraintRepository() { |
433 | - if ( $this->constraintRepository === null ) { |
|
433 | + if ($this->constraintRepository === null) { |
|
434 | 434 | $this->constraintRepository = new ConstraintRepository(); |
435 | 435 | } |
436 | 436 |
@@ -39,17 +39,17 @@ discard block |
||
39 | 39 | ]; |
40 | 40 | } |
41 | 41 | |
42 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
43 | - if ( $context->getSnak()->getType() !== 'value' ) { |
|
44 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
42 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
43 | + if ($context->getSnak()->getType() !== 'value') { |
|
44 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** @var PropertyValueSnak $snak */ |
48 | 48 | $snak = $context->getSnak(); |
49 | 49 | |
50 | - if ( $snak->getDataValue() instanceof QuantityValue ) { |
|
51 | - $message = ( new ViolationMessage( 'wbqc-violation-message-noBounds' ) ) |
|
52 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ); |
|
50 | + if ($snak->getDataValue() instanceof QuantityValue) { |
|
51 | + $message = (new ViolationMessage('wbqc-violation-message-noBounds')) |
|
52 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY); |
|
53 | 53 | return new CheckResult( |
54 | 54 | $context, |
55 | 55 | $constraint, |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
62 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
63 | 63 | } |
64 | 64 | |
65 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
65 | + public function checkConstraintParameters(Constraint $constraint) { |
|
66 | 66 | // no parameters |
67 | 67 | return []; |
68 | 68 | } |