Completed
Push — master ( 444e03...7d73fb )
by
unknown
02:09
created
src/ConstraintCheck/DelegatingConstraintChecker.php 1 patch
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 		callable $defaultResults = null
138 138
 	) {
139 139
 
140
-		$entity = $this->entityLookup->getEntity( $entityId );
141
-		if ( $entity instanceof StatementListProvider ) {
140
+		$entity = $this->entityLookup->getEntity($entityId);
141
+		if ($entity instanceof StatementListProvider) {
142 142
 			$result = $this->checkEveryStatement(
143
-				$this->entityLookup->getEntity( $entityId ),
143
+				$this->entityLookup->getEntity($entityId),
144 144
 				$constraintIds,
145 145
 				$defaultResults
146 146
 			);
147
-			$output = $this->sortResult( $result );
147
+			$output = $this->sortResult($result);
148 148
 			return $output;
149 149
 		}
150 150
 
@@ -170,19 +170,19 @@  discard block
 block discarded – undo
170 170
 		callable $defaultResults = null
171 171
 	) {
172 172
 
173
-		$parsedGuid = $this->statementGuidParser->parse( $guid );
173
+		$parsedGuid = $this->statementGuidParser->parse($guid);
174 174
 		$entityId = $parsedGuid->getEntityId();
175
-		$entity = $this->entityLookup->getEntity( $entityId );
176
-		if ( $entity instanceof StatementListProvider ) {
177
-			$statement = $entity->getStatements()->getFirstStatementWithGuid( $guid );
178
-			if ( $statement ) {
175
+		$entity = $this->entityLookup->getEntity($entityId);
176
+		if ($entity instanceof StatementListProvider) {
177
+			$statement = $entity->getStatements()->getFirstStatementWithGuid($guid);
178
+			if ($statement) {
179 179
 				$result = $this->checkStatement(
180 180
 					$entity,
181 181
 					$statement,
182 182
 					$constraintIds,
183 183
 					$defaultResults
184 184
 				);
185
-				$output = $this->sortResult( $result );
185
+				$output = $this->sortResult($result);
186 186
 				return $output;
187 187
 			}
188 188
 		}
@@ -198,23 +198,23 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @return ConstraintParameterException[]
200 200
 	 */
201
-	private function checkCommonConstraintParameters( Constraint $constraint ) {
201
+	private function checkCommonConstraintParameters(Constraint $constraint) {
202 202
 		$constraintParameters = $constraint->getConstraintParameters();
203 203
 		try {
204
-			$this->constraintParameterParser->checkError( $constraintParameters );
205
-		} catch ( ConstraintParameterException $e ) {
206
-			return [ $e ];
204
+			$this->constraintParameterParser->checkError($constraintParameters);
205
+		} catch (ConstraintParameterException $e) {
206
+			return [$e];
207 207
 		}
208 208
 
209 209
 		$problems = [];
210 210
 		try {
211
-			$this->constraintParameterParser->parseExceptionParameter( $constraintParameters );
212
-		} catch ( ConstraintParameterException $e ) {
211
+			$this->constraintParameterParser->parseExceptionParameter($constraintParameters);
212
+		} catch (ConstraintParameterException $e) {
213 213
 			$problems[] = $e;
214 214
 		}
215 215
 		try {
216
-			$this->constraintParameterParser->parseConstraintStatusParameter( $constraintParameters );
217
-		} catch ( ConstraintParameterException $e ) {
216
+			$this->constraintParameterParser->parseConstraintStatusParameter($constraintParameters);
217
+		} catch (ConstraintParameterException $e) {
218 218
 			$problems[] = $e;
219 219
 		}
220 220
 		return $problems;
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
 	 * @return ConstraintParameterException[][] first level indexed by constraint ID,
228 228
 	 * second level like checkConstraintParametersOnConstraintId (but without possibility of null)
229 229
 	 */
230
-	public function checkConstraintParametersOnPropertyId( PropertyId $propertyId ) {
231
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
230
+	public function checkConstraintParametersOnPropertyId(PropertyId $propertyId) {
231
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
232 232
 		$result = [];
233 233
 
234
-		foreach ( $constraints as $constraint ) {
235
-			$problems = $this->checkCommonConstraintParameters( $constraint );
234
+		foreach ($constraints as $constraint) {
235
+			$problems = $this->checkCommonConstraintParameters($constraint);
236 236
 
237
-			if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
237
+			if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
238 238
 				$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
239
-				$problems = array_merge( $problems, $checker->checkConstraintParameters( $constraint ) );
239
+				$problems = array_merge($problems, $checker->checkConstraintParameters($constraint));
240 240
 			}
241 241
 
242 242
 			$result[$constraint->getConstraintId()] = $problems;
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 	 * @return ConstraintParameterException[]|null list of constraint parameter exceptions
254 254
 	 * (empty means all parameters okay), or null if constraint is not found
255 255
 	 */
256
-	public function checkConstraintParametersOnConstraintId( $constraintId ) {
257
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
258
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
256
+	public function checkConstraintParametersOnConstraintId($constraintId) {
257
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
258
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
259 259
 
260
-		foreach ( $constraints as $constraint ) {
261
-			if ( $constraint->getConstraintId() === $constraintId ) {
262
-				$problems = $this->checkCommonConstraintParameters( $constraint );
260
+		foreach ($constraints as $constraint) {
261
+			if ($constraint->getConstraintId() === $constraintId) {
262
+				$problems = $this->checkCommonConstraintParameters($constraint);
263 263
 
264
-				if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
264
+				if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
265 265
 					$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
266
-					$problems = array_merge( $problems, $checker->checkConstraintParameters( $constraint ) );
266
+					$problems = array_merge($problems, $checker->checkConstraintParameters($constraint));
267 267
 				}
268 268
 
269 269
 				return $problems;
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 		$result = [];
289 289
 
290 290
 		/** @var Statement $statement */
291
-		foreach ( $entity->getStatements() as $statement ) {
292
-			$result = array_merge( $result,
291
+		foreach ($entity->getStatements() as $statement) {
292
+			$result = array_merge($result,
293 293
 				$this->checkStatement(
294 294
 					$entity,
295 295
 					$statement,
296 296
 					$constraintIds,
297 297
 					$defaultResults
298
-				) );
298
+				));
299 299
 		}
300 300
 
301 301
 		return $result;
@@ -317,32 +317,32 @@  discard block
 block discarded – undo
317 317
 	) {
318 318
 		$result = [];
319 319
 
320
-		$result = array_merge( $result,
320
+		$result = array_merge($result,
321 321
 			$this->checkConstraintsForMainSnak(
322 322
 				$entity,
323 323
 				$statement,
324 324
 				$constraintIds,
325 325
 				$defaultResults
326
-			) );
326
+			));
327 327
 
328
-		if ( $this->checkQualifiers ) {
329
-			$result = array_merge( $result,
328
+		if ($this->checkQualifiers) {
329
+			$result = array_merge($result,
330 330
 				$this->checkConstraintsForQualifiers(
331 331
 					$entity,
332 332
 					$statement,
333 333
 					$constraintIds,
334 334
 					$defaultResults
335
-				) );
335
+				));
336 336
 		}
337 337
 
338
-		if ( $this->checkReferences ) {
339
-			$result = array_merge( $result,
338
+		if ($this->checkReferences) {
339
+			$result = array_merge($result,
340 340
 				$this->checkConstraintsForReferences(
341 341
 					$entity,
342 342
 					$statement,
343 343
 					$constraintIds,
344 344
 					$defaultResults
345
-				) );
345
+				));
346 346
 		}
347 347
 
348 348
 		return $result;
@@ -357,12 +357,12 @@  discard block
 block discarded – undo
357 357
 	 * @param string[]|null $constraintIds
358 358
 	 * @return Constraint[]
359 359
 	 */
360
-	private function getConstraintsToUse( PropertyId $propertyId, array $constraintIds = null ) {
361
-		$constraints = $this->constraintLookup->queryConstraintsForProperty( $propertyId );
362
-		if ( $constraintIds !== null ) {
360
+	private function getConstraintsToUse(PropertyId $propertyId, array $constraintIds = null) {
361
+		$constraints = $this->constraintLookup->queryConstraintsForProperty($propertyId);
362
+		if ($constraintIds !== null) {
363 363
 			$constraintsToUse = [];
364
-			foreach ( $constraints as $constraint ) {
365
-				if ( in_array( $constraint->getConstraintId(), $constraintIds ) ) {
364
+			foreach ($constraints as $constraint) {
365
+				if (in_array($constraint->getConstraintId(), $constraintIds)) {
366 366
 					$constraintsToUse[] = $constraint;
367 367
 				}
368 368
 			}
@@ -386,29 +386,29 @@  discard block
 block discarded – undo
386 386
 		array $constraintIds = null,
387 387
 		callable $defaultResults = null
388 388
 	) {
389
-		$context = new MainSnakContext( $entity, $statement );
389
+		$context = new MainSnakContext($entity, $statement);
390 390
 		$constraints = $this->getConstraintsToUse(
391 391
 			$statement->getPropertyId(),
392 392
 			$constraintIds
393 393
 		);
394
-		$result = $defaultResults !== null ? $defaultResults( $context ) : [];
394
+		$result = $defaultResults !== null ? $defaultResults($context) : [];
395 395
 
396
-		foreach ( $constraints as $constraint ) {
396
+		foreach ($constraints as $constraint) {
397 397
 			$parameters = $constraint->getConstraintParameters();
398 398
 			try {
399
-				$exceptions = $this->constraintParameterParser->parseExceptionParameter( $parameters );
400
-			} catch ( ConstraintParameterException $e ) {
401
-				$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
399
+				$exceptions = $this->constraintParameterParser->parseExceptionParameter($parameters);
400
+			} catch (ConstraintParameterException $e) {
401
+				$result[] = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage());
402 402
 				continue;
403 403
 			}
404 404
 
405
-			if ( in_array( $entity->getId(), $exceptions ) ) {
406
-				$message = wfMessage( 'wbqc-exception-message' )->escaped();
407
-				$result[] = new CheckResult( $context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message );
405
+			if (in_array($entity->getId(), $exceptions)) {
406
+				$message = wfMessage('wbqc-exception-message')->escaped();
407
+				$result[] = new CheckResult($context, $constraint, [], CheckResult::STATUS_EXCEPTION, $message);
408 408
 				continue;
409 409
 			}
410 410
 
411
-			$result[] = $this->getCheckResultFor( $context, $constraint );
411
+			$result[] = $this->getCheckResultFor($context, $constraint);
412 412
 		}
413 413
 
414 414
 		return $result;
@@ -430,24 +430,24 @@  discard block
 block discarded – undo
430 430
 	) {
431 431
 		$result = [];
432 432
 
433
-		if ( in_array(
433
+		if (in_array(
434 434
 			$statement->getPropertyId()->getSerialization(),
435 435
 			$this->propertiesWithViolatingQualifiers
436
-		) ) {
436
+		)) {
437 437
 			return $result;
438 438
 		}
439 439
 
440
-		foreach ( $statement->getQualifiers() as $qualifier ) {
441
-			$qualifierContext = new QualifierContext( $entity, $statement, $qualifier );
442
-			if ( $defaultResults !== null ) {
443
-				$result = array_merge( $result, $defaultResults( $qualifierContext ) );
440
+		foreach ($statement->getQualifiers() as $qualifier) {
441
+			$qualifierContext = new QualifierContext($entity, $statement, $qualifier);
442
+			if ($defaultResults !== null) {
443
+				$result = array_merge($result, $defaultResults($qualifierContext));
444 444
 			}
445 445
 			$qualifierConstraints = $this->getConstraintsToUse(
446 446
 				$qualifierContext->getSnak()->getPropertyId(),
447 447
 				$constraintIds
448 448
 			);
449
-			foreach ( $qualifierConstraints as $qualifierConstraint ) {
450
-				$result[] = $this->getCheckResultFor( $qualifierContext, $qualifierConstraint );
449
+			foreach ($qualifierConstraints as $qualifierConstraint) {
450
+				$result[] = $this->getCheckResultFor($qualifierContext, $qualifierConstraint);
451 451
 			}
452 452
 		}
453 453
 
@@ -471,19 +471,19 @@  discard block
 block discarded – undo
471 471
 		$result = [];
472 472
 
473 473
 		/** @var Reference $reference */
474
-		foreach ( $statement->getReferences() as $reference ) {
475
-			foreach ( $reference->getSnaks() as $snak ) {
474
+		foreach ($statement->getReferences() as $reference) {
475
+			foreach ($reference->getSnaks() as $snak) {
476 476
 				$referenceContext = new ReferenceContext(
477 477
 					$entity, $statement, $reference, $snak
478 478
 				);
479
-				if ( $defaultResults !== null ) {
480
-					$result = array_merge( $result, $defaultResults( $referenceContext ) );
479
+				if ($defaultResults !== null) {
480
+					$result = array_merge($result, $defaultResults($referenceContext));
481 481
 				}
482 482
 				$referenceConstraints = $this->getConstraintsToUse(
483 483
 					$referenceContext->getSnak()->getPropertyId(),
484 484
 					$constraintIds
485 485
 				);
486
-				foreach ( $referenceConstraints as $referenceConstraint ) {
486
+				foreach ($referenceConstraints as $referenceConstraint) {
487 487
 					$result[] = $this->getCheckResultFor(
488 488
 						$referenceContext,
489 489
 						$referenceConstraint
@@ -502,70 +502,70 @@  discard block
 block discarded – undo
502 502
 	 * @throws InvalidArgumentException
503 503
 	 * @return CheckResult
504 504
 	 */
505
-	private function getCheckResultFor( Context $context, Constraint $constraint ) {
506
-		if ( array_key_exists( $constraint->getConstraintTypeItemId(), $this->checkerMap ) ) {
505
+	private function getCheckResultFor(Context $context, Constraint $constraint) {
506
+		if (array_key_exists($constraint->getConstraintTypeItemId(), $this->checkerMap)) {
507 507
 			$checker = $this->checkerMap[$constraint->getConstraintTypeItemId()];
508 508
 
509
-			$startTime = microtime( true );
509
+			$startTime = microtime(true);
510 510
 			try {
511
-				$result = $checker->checkConstraint( $context, $constraint );
512
-			} catch ( ConstraintParameterException $e ) {
513
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
514
-			} catch ( SparqlHelperException $e ) {
515
-				$message = wfMessage( 'wbqc-violation-message-sparql-error' )->escaped();
516
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
511
+				$result = $checker->checkConstraint($context, $constraint);
512
+			} catch (ConstraintParameterException $e) {
513
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage());
514
+			} catch (SparqlHelperException $e) {
515
+				$message = wfMessage('wbqc-violation-message-sparql-error')->escaped();
516
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
517 517
 			}
518
-			$endTime = microtime( true );
518
+			$endTime = microtime(true);
519 519
 
520
-			$this->addMetadata( $result );
520
+			$this->addMetadata($result);
521 521
 
522 522
 			try {
523 523
 				$constraintStatus = $this->constraintParameterParser
524
-					->parseConstraintStatusParameter( $constraint->getConstraintParameters() );
525
-			} catch ( ConstraintParameterException $e ) {
526
-				$result = new CheckResult( $context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage() );
524
+					->parseConstraintStatusParameter($constraint->getConstraintParameters());
525
+			} catch (ConstraintParameterException $e) {
526
+				$result = new CheckResult($context, $constraint, [], CheckResult::STATUS_BAD_PARAMETERS, $e->getMessage());
527 527
 				$constraintStatus = null;
528 528
 			}
529
-			if ( $constraintStatus === null ) {
529
+			if ($constraintStatus === null) {
530 530
 				// downgrade violation to warning
531
-				if ( $result->getStatus() === CheckResult::STATUS_VIOLATION ) {
532
-					$result->setStatus( CheckResult::STATUS_WARNING );
531
+				if ($result->getStatus() === CheckResult::STATUS_VIOLATION) {
532
+					$result->setStatus(CheckResult::STATUS_WARNING);
533 533
 				}
534 534
 			} else {
535
-				if ( $constraintStatus !== 'mandatory' ) {
535
+				if ($constraintStatus !== 'mandatory') {
536 536
 					// @codeCoverageIgnoreStart
537 537
 					throw new LogicException(
538
-						"Unknown constraint status '$constraintStatus', " .
538
+						"Unknown constraint status '$constraintStatus', ".
539 539
 						"only known status is 'mandatory'"
540 540
 					);
541 541
 					// @codeCoverageIgnoreEnd
542 542
 				}
543
-				$result->addParameter( 'constraint_status', $constraintStatus );
543
+				$result->addParameter('constraint_status', $constraintStatus);
544 544
 			}
545 545
 
546 546
 			$this->loggingHelper->logConstraintCheck(
547 547
 				$context,
548 548
 				$constraint,
549 549
 				$result,
550
-				get_class( $checker ),
550
+				get_class($checker),
551 551
 				$endTime - $startTime,
552 552
 				__METHOD__
553 553
 			);
554 554
 
555 555
 			return $result;
556 556
 		} else {
557
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_TODO, null );
557
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_TODO, null);
558 558
 		}
559 559
 	}
560 560
 
561
-	private function addMetadata( CheckResult $result ) {
562
-		$result->withMetadata( Metadata::merge( [
561
+	private function addMetadata(CheckResult $result) {
562
+		$result->withMetadata(Metadata::merge([
563 563
 			$result->getMetadata(),
564
-			Metadata::ofDependencyMetadata( DependencyMetadata::merge( [
565
-				DependencyMetadata::ofEntityId( $result->getEntityId() ),
566
-				DependencyMetadata::ofEntityId( $result->getConstraint()->getPropertyId() ),
567
-			] ) ),
568
-		] ) );
564
+			Metadata::ofDependencyMetadata(DependencyMetadata::merge([
565
+				DependencyMetadata::ofEntityId($result->getEntityId()),
566
+				DependencyMetadata::ofEntityId($result->getConstraint()->getPropertyId()),
567
+			])),
568
+		]));
569 569
 	}
570 570
 
571 571
 	/**
@@ -573,12 +573,12 @@  discard block
 block discarded – undo
573 573
 	 *
574 574
 	 * @return CheckResult[]
575 575
 	 */
576
-	private function sortResult( array $result ) {
577
-		if ( count( $result ) < 2 ) {
576
+	private function sortResult(array $result) {
577
+		if (count($result) < 2) {
578 578
 			return $result;
579 579
 		}
580 580
 
581
-		$sortFunction = function ( CheckResult $a, CheckResult $b ) {
581
+		$sortFunction = function(CheckResult $a, CheckResult $b) {
582 582
 			$orderNum = 0;
583 583
 			$order = [
584 584
 				CheckResult::STATUS_BAD_PARAMETERS => $orderNum++,
@@ -594,45 +594,45 @@  discard block
 block discarded – undo
594 594
 			$statusA = $a->getStatus();
595 595
 			$statusB = $b->getStatus();
596 596
 
597
-			$orderA = array_key_exists( $statusA, $order ) ? $order[ $statusA ] : $order[ 'other' ];
598
-			$orderB = array_key_exists( $statusB, $order ) ? $order[ $statusB ] : $order[ 'other' ];
597
+			$orderA = array_key_exists($statusA, $order) ? $order[$statusA] : $order['other'];
598
+			$orderB = array_key_exists($statusB, $order) ? $order[$statusB] : $order['other'];
599 599
 
600
-			if ( $orderA === $orderB ) {
600
+			if ($orderA === $orderB) {
601 601
 				$pidA = $a->getContext()->getSnak()->getPropertyId()->getSerialization();
602 602
 				$pidB = $b->getContext()->getSnak()->getPropertyId()->getSerialization();
603 603
 
604
-				if ( $pidA === $pidB ) {
604
+				if ($pidA === $pidB) {
605 605
 					$hashA = $a->getContext()->getSnak()->getHash();
606 606
 					$hashB = $b->getContext()->getSnak()->getHash();
607 607
 
608
-					if ( $hashA === $hashB ) {
609
-						if ( $a instanceof NullResult ) {
608
+					if ($hashA === $hashB) {
609
+						if ($a instanceof NullResult) {
610 610
 							return $b instanceof NullResult ? 0 : -1;
611 611
 						}
612
-						if ( $b instanceof NullResult ) {
612
+						if ($b instanceof NullResult) {
613 613
 							return $a instanceof NullResult ? 0 : 1;
614 614
 						}
615 615
 
616 616
 						$typeA = $a->getConstraint()->getConstraintTypeItemId();
617 617
 						$typeB = $b->getConstraint()->getConstraintTypeItemId();
618 618
 
619
-						if ( $typeA == $typeB ) {
619
+						if ($typeA == $typeB) {
620 620
 							return 0;
621 621
 						} else {
622
-							return ( $typeA > $typeB ) ? 1 : -1;
622
+							return ($typeA > $typeB) ? 1 : -1;
623 623
 						}
624 624
 					} else {
625
-						return ( $hashA > $hashB ) ? 1 : -1;
625
+						return ($hashA > $hashB) ? 1 : -1;
626 626
 					}
627 627
 				} else {
628
-					return ( $pidA > $pidB ) ? 1 : -1;
628
+					return ($pidA > $pidB) ? 1 : -1;
629 629
 				}
630 630
 			} else {
631
-				return ( $orderA > $orderB ) ? 1 : -1;
631
+				return ($orderA > $orderB) ? 1 : -1;
632 632
 			}
633 633
 		};
634 634
 
635
-		uasort( $result, $sortFunction );
635
+		uasort($result, $sortFunction);
636 636
 
637 637
 		return $result;
638 638
 	}
Please login to merge, or discard this patch.
src/ConstraintReportFactory.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	public static function getDefaultInstance() {
132 132
 		static $instance = null;
133 133
 
134
-		if ( $instance === null ) {
134
+		if ($instance === null) {
135 135
 			$wikibaseRepo = WikibaseRepo::getDefaultInstance();
136 136
 			$entityIdFormatter = $wikibaseRepo->getEntityIdHtmlLinkFormatterFactory()->getEntityIdFormatter(
137 137
 				$wikibaseRepo->getLanguageFallbackLabelDescriptionLookupFactory()->newLabelDescriptionLookup(
@@ -196,21 +196,21 @@  discard block
 block discarded – undo
196 196
 	 * @return DelegatingConstraintChecker
197 197
 	 */
198 198
 	public function getConstraintChecker() {
199
-		if ( $this->delegatingConstraintChecker === null ) {
199
+		if ($this->delegatingConstraintChecker === null) {
200 200
 			$this->delegatingConstraintChecker = new DelegatingConstraintChecker(
201 201
 				$this->lookup,
202 202
 				$this->getConstraintCheckerMap(),
203
-				new CachingConstraintLookup( $this->getConstraintRepository() ),
203
+				new CachingConstraintLookup($this->getConstraintRepository()),
204 204
 				$this->constraintParameterParser,
205 205
 				$this->statementGuidParser,
206 206
 				new LoggingHelper(
207 207
 					MediaWikiServices::getInstance()->getStatsdDataFactory(),
208
-					LoggerFactory::getInstance( 'WikibaseQualityConstraints' ),
208
+					LoggerFactory::getInstance('WikibaseQualityConstraints'),
209 209
 					$this->config
210 210
 				),
211
-				$this->config->get( 'WBQualityConstraintsCheckQualifiers' ),
212
-				$this->config->get( 'WBQualityConstraintsCheckReferences' ),
213
-				$this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' )
211
+				$this->config->get('WBQualityConstraintsCheckQualifiers'),
212
+				$this->config->get('WBQualityConstraintsCheckReferences'),
213
+				$this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers')
214 214
 			);
215 215
 		}
216 216
 
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 	 * @return ConstraintChecker[]
222 222
 	 */
223 223
 	private function getConstraintCheckerMap() {
224
-		if ( $this->constraintCheckerMap === null ) {
224
+		if ($this->constraintCheckerMap === null) {
225 225
 			$connectionCheckerHelper = new ConnectionCheckerHelper();
226
-			$rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter );
227
-			if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) {
226
+			$rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter);
227
+			if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') {
228 228
 				$sparqlHelper = new SparqlHelper(
229 229
 					$this->config,
230 230
 					$this->rdfVocabulary,
@@ -243,74 +243,74 @@  discard block
 block discarded – undo
243 243
 			);
244 244
 
245 245
 			$this->constraintCheckerMap = [
246
-				$this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' )
246
+				$this->config->get('WBQualityConstraintsConflictsWithConstraintId')
247 247
 					=> new ConflictsWithChecker(
248 248
 						$this->lookup,
249 249
 						$this->constraintParameterParser,
250 250
 						$connectionCheckerHelper,
251 251
 						$this->constraintParameterRenderer
252 252
 					),
253
-				$this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' )
253
+				$this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId')
254 254
 					=> new ItemChecker(
255 255
 						$this->lookup,
256 256
 						$this->constraintParameterParser,
257 257
 						$connectionCheckerHelper,
258 258
 						$this->constraintParameterRenderer
259 259
 					),
260
-				$this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' )
260
+				$this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId')
261 261
 					=> new TargetRequiredClaimChecker(
262 262
 						$this->lookup,
263 263
 						$this->constraintParameterParser,
264 264
 						$connectionCheckerHelper,
265 265
 						$this->constraintParameterRenderer
266 266
 					),
267
-				$this->config->get( 'WBQualityConstraintsSymmetricConstraintId' )
267
+				$this->config->get('WBQualityConstraintsSymmetricConstraintId')
268 268
 					=> new SymmetricChecker(
269 269
 						$this->lookup,
270 270
 						$connectionCheckerHelper,
271 271
 						$this->constraintParameterRenderer
272 272
 					),
273
-				$this->config->get( 'WBQualityConstraintsInverseConstraintId' )
273
+				$this->config->get('WBQualityConstraintsInverseConstraintId')
274 274
 					=> new InverseChecker(
275 275
 						$this->lookup,
276 276
 						$this->constraintParameterParser,
277 277
 						$connectionCheckerHelper,
278 278
 						$this->constraintParameterRenderer
279 279
 					),
280
-				$this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' )
280
+				$this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId')
281 281
 					=> new QualifierChecker(),
282
-				$this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' )
282
+				$this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId')
283 283
 					=> new QualifiersChecker(
284 284
 						$this->constraintParameterParser,
285 285
 						$this->constraintParameterRenderer
286 286
 					),
287
-				$this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' )
287
+				$this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId')
288 288
 					=> new MandatoryQualifiersChecker(
289 289
 						$this->constraintParameterParser,
290 290
 						$this->constraintParameterRenderer
291 291
 					),
292
-				$this->config->get( 'WBQualityConstraintsRangeConstraintId' )
292
+				$this->config->get('WBQualityConstraintsRangeConstraintId')
293 293
 					=> new RangeChecker(
294 294
 						$this->propertyDataTypeLookup,
295 295
 						$this->constraintParameterParser,
296 296
 						$rangeCheckerHelper,
297 297
 						$this->constraintParameterRenderer
298 298
 					),
299
-				$this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' )
299
+				$this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId')
300 300
 					=> new DiffWithinRangeChecker(
301 301
 						$this->constraintParameterParser,
302 302
 						$rangeCheckerHelper,
303 303
 						$this->constraintParameterRenderer,
304 304
 						$this->config
305 305
 					),
306
-				$this->config->get( 'WBQualityConstraintsTypeConstraintId' )
306
+				$this->config->get('WBQualityConstraintsTypeConstraintId')
307 307
 					=> new TypeChecker(
308 308
 						$this->lookup,
309 309
 						$this->constraintParameterParser,
310 310
 						$typeCheckerHelper,
311 311
 						$this->config
312 312
 					),
313
-				$this->config->get( 'WBQualityConstraintsValueTypeConstraintId' )
313
+				$this->config->get('WBQualityConstraintsValueTypeConstraintId')
314 314
 					=> new ValueTypeChecker(
315 315
 						$this->lookup,
316 316
 						$this->constraintParameterParser,
@@ -318,36 +318,36 @@  discard block
 block discarded – undo
318 318
 						$typeCheckerHelper,
319 319
 						$this->config
320 320
 					),
321
-				$this->config->get( 'WBQualityConstraintsSingleValueConstraintId' )
321
+				$this->config->get('WBQualityConstraintsSingleValueConstraintId')
322 322
 					=> new SingleValueChecker(),
323
-				$this->config->get( 'WBQualityConstraintsMultiValueConstraintId' )
323
+				$this->config->get('WBQualityConstraintsMultiValueConstraintId')
324 324
 					=> new MultiValueChecker(),
325
-				$this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' )
325
+				$this->config->get('WBQualityConstraintsDistinctValuesConstraintId')
326 326
 					=> new UniqueValueChecker(
327 327
 						$this->constraintParameterRenderer,
328 328
 						$sparqlHelper
329 329
 					),
330
-				$this->config->get( 'WBQualityConstraintsFormatConstraintId' )
330
+				$this->config->get('WBQualityConstraintsFormatConstraintId')
331 331
 					=> new FormatChecker(
332 332
 						$this->constraintParameterParser,
333 333
 						$this->constraintParameterRenderer,
334 334
 						$this->config,
335 335
 						$sparqlHelper
336 336
 					),
337
-				$this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' )
337
+				$this->config->get('WBQualityConstraintsCommonsLinkConstraintId')
338 338
 					=> new CommonsLinkChecker(
339 339
 						$this->constraintParameterParser,
340 340
 						$this->constraintParameterRenderer,
341 341
 						$this->titleParser
342 342
 					),
343
-				$this->config->get( 'WBQualityConstraintsOneOfConstraintId' )
343
+				$this->config->get('WBQualityConstraintsOneOfConstraintId')
344 344
 					=> new OneOfChecker(
345 345
 						$this->constraintParameterParser,
346 346
 						$this->constraintParameterRenderer
347 347
 					),
348
-				$this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' )
348
+				$this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId')
349 349
 					=> new ValueOnlyChecker(),
350
-				$this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' )
350
+				$this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId')
351 351
 					=> new ReferenceChecker(),
352 352
 			];
353 353
 		}
@@ -359,26 +359,26 @@  discard block
 block discarded – undo
359 359
 	 * @return array[]
360 360
 	 */
361 361
 	public function getConstraintParameterMap() {
362
-		if ( $this->constraintParameterMap === null ) {
362
+		if ($this->constraintParameterMap === null) {
363 363
 			$this->constraintParameterMap = [
364
-				'Commons link' => [ 'namespace' ],
365
-				'Conflicts with' => [ 'property', 'item' ],
366
-				'Diff within range' => [ 'property', 'minimum_quantity', 'maximum_quantity' ],
367
-				'Format' => [ 'pattern' ],
368
-				'Inverse' => [ 'property' ],
369
-				'Item' => [ 'property', 'item' ],
370
-				'Mandatory qualifiers' => [ 'property' ],
364
+				'Commons link' => ['namespace'],
365
+				'Conflicts with' => ['property', 'item'],
366
+				'Diff within range' => ['property', 'minimum_quantity', 'maximum_quantity'],
367
+				'Format' => ['pattern'],
368
+				'Inverse' => ['property'],
369
+				'Item' => ['property', 'item'],
370
+				'Mandatory qualifiers' => ['property'],
371 371
 				'Multi value' => [],
372
-				'One of' => [ 'item' ],
372
+				'One of' => ['item'],
373 373
 				'Qualifier' => [],
374
-				'Qualifiers' => [ 'property' ],
375
-				'Range' => [ 'minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date' ],
374
+				'Qualifiers' => ['property'],
375
+				'Range' => ['minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date'],
376 376
 				'Single value' => [],
377 377
 				'Symmetric' => [],
378
-				'Target required claim' => [ 'property', 'item' ],
379
-				'Type' => [ 'class', 'relation' ],
378
+				'Target required claim' => ['property', 'item'],
379
+				'Type' => ['class', 'relation'],
380 380
 				'Unique value' => [],
381
-				'Value type' => [ 'class', 'relation' ]
381
+				'Value type' => ['class', 'relation']
382 382
 			];
383 383
 		}
384 384
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @return ConstraintRepository
390 390
 	 */
391 391
 	public function getConstraintRepository() {
392
-		if ( $this->constraintRepository === null ) {
392
+		if ($this->constraintRepository === null) {
393 393
 			$this->constraintRepository = new ConstraintRepository();
394 394
 		}
395 395
 
Please login to merge, or discard this patch.