Completed
Push — master ( 1a1840...6d8e1d )
by
unknown
06:19
created
src/Specials/SpecialConstraintReport.php 1 patch
Spacing   +115 added lines, -116 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		Config $config,
135 135
 		IBufferingStatsdDataFactory $dataFactory
136 136
 	) {
137
-		parent::__construct( 'ConstraintReport' );
137
+		parent::__construct('ConstraintReport');
138 138
 
139 139
 		$this->entityLookup = $entityLookup;
140 140
 		$this->entityTitleLookup = $entityTitleLookup;
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 		$language = $this->getLanguage();
144 144
 
145 145
 		$formatterOptions = new FormatterOptions();
146
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() );
146
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode());
147 147
 		$this->dataValueFormatter = $valueFormatterFactory->getValueFormatter(
148 148
 			SnakFormatter::FORMAT_HTML,
149 149
 			$formatterOptions
150 150
 		);
151 151
 
152
-		$labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup( $language );
152
+		$labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup($language);
153 153
 
154 154
 		$this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter(
155 155
 			$labelLookup
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * @return array
183 183
 	 */
184 184
 	private function getModules() {
185
-		return [ 'SpecialConstraintReportPage' ];
185
+		return ['SpecialConstraintReportPage'];
186 186
 	}
187 187
 
188 188
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return string
201 201
 	 */
202 202
 	public function getDescription() {
203
-		return $this->msg( 'wbqc-constraintreport' )->escaped();
203
+		return $this->msg('wbqc-constraintreport')->escaped();
204 204
 	}
205 205
 
206 206
 	/**
@@ -212,42 +212,42 @@  discard block
 block discarded – undo
212 212
 	 * @throws EntityIdParsingException
213 213
 	 * @throws UnexpectedValueException
214 214
 	 */
215
-	public function execute( $subPage ) {
215
+	public function execute($subPage) {
216 216
 		$out = $this->getOutput();
217 217
 
218
-		$postRequest = $this->getContext()->getRequest()->getVal( 'entityid' );
219
-		if ( $postRequest ) {
220
-			$out->redirect( $this->getPageTitle( strtoupper( $postRequest ) )->getLocalURL() );
218
+		$postRequest = $this->getContext()->getRequest()->getVal('entityid');
219
+		if ($postRequest) {
220
+			$out->redirect($this->getPageTitle(strtoupper($postRequest))->getLocalURL());
221 221
 			return;
222 222
 		}
223 223
 
224
-		$out->addModules( $this->getModules() );
224
+		$out->addModules($this->getModules());
225 225
 
226 226
 		$this->setHeaders();
227 227
 
228
-		$out->addHTML( $this->getExplanationText() );
228
+		$out->addHTML($this->getExplanationText());
229 229
 		$this->buildEntityIdForm();
230 230
 
231
-		if ( !$subPage ) {
231
+		if (!$subPage) {
232 232
 			return;
233 233
 		}
234 234
 
235
-		if ( !is_string( $subPage ) ) {
236
-			throw new InvalidArgumentException( '$subPage must be string.' );
235
+		if (!is_string($subPage)) {
236
+			throw new InvalidArgumentException('$subPage must be string.');
237 237
 		}
238 238
 
239 239
 		try {
240
-			$entityId = $this->entityIdParser->parse( $subPage );
241
-		} catch ( EntityIdParsingException $e ) {
240
+			$entityId = $this->entityIdParser->parse($subPage);
241
+		} catch (EntityIdParsingException $e) {
242 242
 			$out->addHTML(
243
-				$this->buildNotice( 'wbqc-constraintreport-invalid-entity-id', true )
243
+				$this->buildNotice('wbqc-constraintreport-invalid-entity-id', true)
244 244
 			);
245 245
 			return;
246 246
 		}
247 247
 
248
-		if ( !$this->entityLookup->hasEntity( $entityId ) ) {
248
+		if (!$this->entityLookup->hasEntity($entityId)) {
249 249
 			$out->addHTML(
250
-				$this->buildNotice( 'wbqc-constraintreport-not-existent-entity', true )
250
+				$this->buildNotice('wbqc-constraintreport-not-existent-entity', true)
251 251
 			);
252 252
 			return;
253 253
 		}
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 		$this->dataFactory->increment(
256 256
 			'wikibase.quality.constraints.specials.specialConstraintReport.executeCheck'
257 257
 		);
258
-		$results = $this->constraintChecker->checkAgainstConstraintsOnEntityId( $entityId );
258
+		$results = $this->constraintChecker->checkAgainstConstraintsOnEntityId($entityId);
259 259
 
260
-		if ( count( $results ) > 0 ) {
260
+		if (count($results) > 0) {
261 261
 			$out->addHTML(
262
-				$this->buildResultHeader( $entityId )
263
-				. $this->buildSummary( $results )
264
-				. $this->buildResultTable( $entityId, $results )
262
+				$this->buildResultHeader($entityId)
263
+				. $this->buildSummary($results)
264
+				. $this->buildResultTable($entityId, $results)
265 265
 			);
266 266
 		} else {
267 267
 			$out->addHTML(
268
-				$this->buildResultHeader( $entityId )
269
-				. $this->buildNotice( 'wbqc-constraintreport-empty-result' )
268
+				$this->buildResultHeader($entityId)
269
+				. $this->buildNotice('wbqc-constraintreport-empty-result')
270 270
 			);
271 271
 		}
272 272
 	}
@@ -282,15 +282,15 @@  discard block
 block discarded – undo
282 282
 				'name' => 'entityid',
283 283
 				'label-message' => 'wbqc-constraintreport-form-entityid-label',
284 284
 				'cssclass' => 'wbqc-constraintreport-form-entity-id',
285
-				'placeholder' => $this->msg( 'wbqc-constraintreport-form-entityid-placeholder' )->escaped()
285
+				'placeholder' => $this->msg('wbqc-constraintreport-form-entityid-placeholder')->escaped()
286 286
 			]
287 287
 		];
288
-		$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form' );
289
-		$htmlForm->setSubmitText( $this->msg( 'wbqc-constraintreport-form-submit-label' )->escaped() );
290
-		$htmlForm->setSubmitCallback( function() {
288
+		$htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form');
289
+		$htmlForm->setSubmitText($this->msg('wbqc-constraintreport-form-submit-label')->escaped());
290
+		$htmlForm->setSubmitCallback(function() {
291 291
 			return false;
292 292
 		} );
293
-		$htmlForm->setMethod( 'post' );
293
+		$htmlForm->setMethod('post');
294 294
 		$htmlForm->show();
295 295
 	}
296 296
 
@@ -304,16 +304,16 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @return string HTML
306 306
 	 */
307
-	private function buildNotice( $messageKey, $error = false ) {
308
-		if ( !is_string( $messageKey ) ) {
309
-			throw new InvalidArgumentException( '$message must be string.' );
307
+	private function buildNotice($messageKey, $error = false) {
308
+		if (!is_string($messageKey)) {
309
+			throw new InvalidArgumentException('$message must be string.');
310 310
 		}
311
-		if ( !is_bool( $error ) ) {
312
-			throw new InvalidArgumentException( '$error must be bool.' );
311
+		if (!is_bool($error)) {
312
+			throw new InvalidArgumentException('$error must be bool.');
313 313
 		}
314 314
 
315 315
 		$cssClasses = 'wbqc-constraintreport-notice';
316
-		if ( $error ) {
316
+		if ($error) {
317 317
 			$cssClasses .= ' wbqc-constraintreport-notice-error';
318 318
 		}
319 319
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 				[
323 323
 					'class' => $cssClasses
324 324
 				],
325
-				$this->msg( $messageKey )->escaped()
325
+				$this->msg($messageKey)->escaped()
326 326
 			);
327 327
 	}
328 328
 
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 	private function getExplanationText() {
333 333
 		return Html::rawElement(
334 334
 			'div',
335
-			[ 'class' => 'wbqc-explanation' ],
335
+			['class' => 'wbqc-explanation'],
336 336
 			Html::rawElement(
337 337
 				'p',
338 338
 				[],
339
-				$this->msg( 'wbqc-constraintreport-explanation-part-one' )->escaped()
339
+				$this->msg('wbqc-constraintreport-explanation-part-one')->escaped()
340 340
 			)
341 341
 			. Html::rawElement(
342 342
 				'p',
343 343
 				[],
344
-				$this->msg( 'wbqc-constraintreport-explanation-part-two' )->escaped()
344
+				$this->msg('wbqc-constraintreport-explanation-part-two')->escaped()
345 345
 			)
346 346
 		);
347 347
 	}
@@ -352,82 +352,81 @@  discard block
 block discarded – undo
352 352
 	 *
353 353
 	 * @return string HTML
354 354
 	 */
355
-	private function buildResultTable( EntityId $entityId, array $results ) {
355
+	private function buildResultTable(EntityId $entityId, array $results) {
356 356
 		// Set table headers
357 357
 		$table = new HtmlTableBuilder(
358 358
 			[
359 359
 				new HtmlTableHeaderBuilder(
360
-					$this->msg( 'wbqc-constraintreport-result-table-header-status' )->escaped(),
360
+					$this->msg('wbqc-constraintreport-result-table-header-status')->escaped(),
361 361
 					true
362 362
 				),
363 363
 				new HtmlTableHeaderBuilder(
364
-					$this->msg( 'wbqc-constraintreport-result-table-header-claim' )->escaped(),
364
+					$this->msg('wbqc-constraintreport-result-table-header-claim')->escaped(),
365 365
 					true
366 366
 				),
367 367
 				new HtmlTableHeaderBuilder(
368
-					$this->msg( 'wbqc-constraintreport-result-table-header-constraint' )->escaped(),
368
+					$this->msg('wbqc-constraintreport-result-table-header-constraint')->escaped(),
369 369
 					true
370 370
 				)
371 371
 			]
372 372
 		);
373 373
 
374
-		foreach ( $results as $result ) {
375
-			$table = $this->appendToResultTable( $table, $entityId, $result );
374
+		foreach ($results as $result) {
375
+			$table = $this->appendToResultTable($table, $entityId, $result);
376 376
 		}
377 377
 
378 378
 		return $table->toHtml();
379 379
 	}
380 380
 
381
-	private function appendToResultTable( HtmlTableBuilder $table, EntityId $entityId, CheckResult $result ) {
381
+	private function appendToResultTable(HtmlTableBuilder $table, EntityId $entityId, CheckResult $result) {
382 382
 		// Status column
383 383
 		$statusColumn = $this->buildTooltipElement(
384
-			$this->formatStatus( $result->getStatus() ),
384
+			$this->formatStatus($result->getStatus()),
385 385
 			$result->getMessage() !== null ?
386
-				$this->violationMessageRenderer->render( $result->getMessage() ) :
387
-				null,
386
+				$this->violationMessageRenderer->render($result->getMessage()) : null,
388 387
 			'[?]'
389 388
 		);
390 389
 
391 390
 		// Claim column
392 391
 		$property = $this->entityIdLabelFormatter->formatEntityId(
393
-			new PropertyId( $result->getContextCursor()->getSnakPropertyId() )
392
+			new PropertyId($result->getContextCursor()->getSnakPropertyId())
394 393
 		);
395 394
 		$value = null;
396 395
 		$snakType = $result->getSnakType();
397
-		if ( $snakType === 'value' ) {
396
+		if ($snakType === 'value') {
398 397
 			$dataValue = $result->getDataValue();
399
-			if ( $dataValue !== null ) {
400
-				$value = $this->constraintParameterRenderer->formatValue( $dataValue );
398
+			if ($dataValue !== null) {
399
+				$value = $this->constraintParameterRenderer->formatValue($dataValue);
401 400
 			}
402
-		} elseif ( $snakType !== null ) {
403
-			$value = htmlspecialchars( $snakType );
401
+		} elseif ($snakType !== null) {
402
+			$value = htmlspecialchars($snakType);
404 403
 		}
405
-		if ( $value === null ) {
404
+		if ($value === null) {
406 405
 			// incomplete CheckResult – this should never happen
407
-			$value = $this->msg( 'unknown-error' )->escaped();
406
+			$value = $this->msg('unknown-error')->escaped();
408 407
 		}
409 408
 
410 409
 		$claimColumn = $this->getClaimLink(
411 410
 			$entityId,
412
-			new PropertyId( $result->getContextCursor()->getSnakPropertyId() ),
413
-			$property . ': ' . $value
411
+			new PropertyId($result->getContextCursor()->getSnakPropertyId()),
412
+			$property.': '.$value
414 413
 		);
415 414
 
416 415
 		// Constraint column
417 416
 		$constraintTypeItemId = $result->getConstraint()->getConstraintTypeItemId();
418 417
 		try {
419
-			$constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $constraintTypeItemId ) );
420
-		} catch ( InvalidArgumentException $e ) {
421
-			$constraintTypeLabel = htmlspecialchars( $constraintTypeItemId );
418
+			$constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($constraintTypeItemId));
419
+		} catch (InvalidArgumentException $e) {
420
+			$constraintTypeLabel = htmlspecialchars($constraintTypeItemId);
422 421
 		}
423 422
 		$constraintLink = $this->getClaimLink(
424
-			new PropertyId( $result->getContextCursor()->getSnakPropertyId() ),
425
-			new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ),
423
+			new PropertyId($result->getContextCursor()->getSnakPropertyId()),
424
+			new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')),
426 425
 			$constraintTypeLabel
427 426
 		);
428 427
 		$constraintColumn = $this->buildExpandableElement(
429 428
 			$constraintLink,
430
-			$this->constraintParameterRenderer->formatParameters( $result->getParameters() ),
429
+			$this->constraintParameterRenderer->formatParameters($result->getParameters()),
431 430
 			'[...]'
432 431
 		);
433 432
 
@@ -462,15 +461,15 @@  discard block
 block discarded – undo
462 461
 	 *
463 462
 	 * @return string HTML
464 463
 	 */
465
-	protected function buildResultHeader( EntityId $entityId ) {
466
-		$entityLink = sprintf( '%s (%s)',
467
-							   $this->entityIdLinkFormatter->formatEntityId( $entityId ),
468
-							   htmlspecialchars( $entityId->getSerialization() ) );
464
+	protected function buildResultHeader(EntityId $entityId) {
465
+		$entityLink = sprintf('%s (%s)',
466
+							   $this->entityIdLinkFormatter->formatEntityId($entityId),
467
+							   htmlspecialchars($entityId->getSerialization()));
469 468
 
470 469
 		return Html::rawElement(
471 470
 			'h3',
472 471
 			[],
473
-			sprintf( '%s %s', $this->msg( 'wbqc-constraintreport-result-headline' )->escaped(), $entityLink )
472
+			sprintf('%s %s', $this->msg('wbqc-constraintreport-result-headline')->escaped(), $entityLink)
474 473
 		);
475 474
 	}
476 475
 
@@ -481,24 +480,24 @@  discard block
 block discarded – undo
481 480
 	 *
482 481
 	 * @return string HTML
483 482
 	 */
484
-	protected function buildSummary( array $results ) {
483
+	protected function buildSummary(array $results) {
485 484
 		$statuses = [];
486
-		foreach ( $results as $result ) {
487
-			$status = strtolower( $result->getStatus() );
488
-			$statuses[$status] = isset( $statuses[$status] ) ? $statuses[$status] + 1 : 1;
485
+		foreach ($results as $result) {
486
+			$status = strtolower($result->getStatus());
487
+			$statuses[$status] = isset($statuses[$status]) ? $statuses[$status] + 1 : 1;
489 488
 		}
490 489
 
491 490
 		$statusElements = [];
492
-		foreach ( $statuses as $status => $count ) {
493
-			if ( $count > 0 ) {
491
+		foreach ($statuses as $status => $count) {
492
+			if ($count > 0) {
494 493
 				$statusElements[] =
495
-					$this->formatStatus( $status )
494
+					$this->formatStatus($status)
496 495
 					. ': '
497 496
 					. $count;
498 497
 			}
499 498
 		}
500 499
 
501
-		return Html::rawElement( 'p', [], implode( ', ', $statusElements ) );
500
+		return Html::rawElement('p', [], implode(', ', $statusElements));
502 501
 	}
503 502
 
504 503
 	/**
@@ -513,15 +512,15 @@  discard block
 block discarded – undo
513 512
 	 *
514 513
 	 * @return string HTML
515 514
 	 */
516
-	protected function buildTooltipElement( $content, $tooltipContent, $indicator ) {
517
-		if ( !is_string( $content ) ) {
518
-			throw new InvalidArgumentException( '$content has to be string.' );
515
+	protected function buildTooltipElement($content, $tooltipContent, $indicator) {
516
+		if (!is_string($content)) {
517
+			throw new InvalidArgumentException('$content has to be string.');
519 518
 		}
520
-		if ( $tooltipContent && ( !is_string( $tooltipContent ) ) ) {
521
-			throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' );
519
+		if ($tooltipContent && (!is_string($tooltipContent))) {
520
+			throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.');
522 521
 		}
523 522
 
524
-		if ( empty( $tooltipContent ) ) {
523
+		if (empty($tooltipContent)) {
525 524
 			return $content;
526 525
 		}
527 526
 
@@ -538,13 +537,13 @@  discard block
 block discarded – undo
538 537
 			[
539 538
 				'class' => 'wbqc-indicator'
540 539
 			],
541
-			htmlspecialchars( $indicator ) . $tooltip
540
+			htmlspecialchars($indicator).$tooltip
542 541
 		);
543 542
 
544 543
 		return Html::rawElement(
545 544
 			'span',
546 545
 			[],
547
-			sprintf( '%s %s', $content, $tooltipIndicator )
546
+			sprintf('%s %s', $content, $tooltipIndicator)
548 547
 		);
549 548
 	}
550 549
 
@@ -560,15 +559,15 @@  discard block
 block discarded – undo
560 559
 	 *
561 560
 	 * @return string HTML
562 561
 	 */
563
-	protected function buildExpandableElement( $content, $expandableContent, $indicator ) {
564
-		if ( !is_string( $content ) ) {
565
-			throw new InvalidArgumentException( '$content has to be string.' );
562
+	protected function buildExpandableElement($content, $expandableContent, $indicator) {
563
+		if (!is_string($content)) {
564
+			throw new InvalidArgumentException('$content has to be string.');
566 565
 		}
567
-		if ( $expandableContent && ( !is_string( $expandableContent ) ) ) {
568
-			throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' );
566
+		if ($expandableContent && (!is_string($expandableContent))) {
567
+			throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.');
569 568
 		}
570 569
 
571
-		if ( empty( $expandableContent ) ) {
570
+		if (empty($expandableContent)) {
572 571
 			return $content;
573 572
 		}
574 573
 
@@ -588,7 +587,7 @@  discard block
 block discarded – undo
588 587
 			$expandableContent
589 588
 		);
590 589
 
591
-		return sprintf( '%s %s %s', $content, $tooltipIndicator, $expandableContent );
590
+		return sprintf('%s %s %s', $content, $tooltipIndicator, $expandableContent);
592 591
 	}
593 592
 
594 593
 	/**
@@ -600,16 +599,16 @@  discard block
 block discarded – undo
600 599
 	 *
601 600
 	 * @return string HTML
602 601
 	 */
603
-	private function formatStatus( $status ) {
604
-		$messageName = "wbqc-constraintreport-status-" . strtolower( $status );
602
+	private function formatStatus($status) {
603
+		$messageName = "wbqc-constraintreport-status-".strtolower($status);
605 604
 
606 605
 		$formattedStatus =
607 606
 			Html::element(
608 607
 				'span',
609 608
 				[
610
-					'class' => 'wbqc-status wbqc-status-' . $status
609
+					'class' => 'wbqc-status wbqc-status-'.$status
611 610
 				],
612
-				$this->msg( $messageName )->text()
611
+				$this->msg($messageName)->text()
613 612
 			);
614 613
 
615 614
 		return $formattedStatus;
@@ -625,26 +624,26 @@  discard block
 block discarded – undo
625 624
 	 *
626 625
 	 * @return string HTML
627 626
 	 */
628
-	protected function formatDataValues( $dataValues, $separator = ', ' ) {
629
-		if ( $dataValues instanceof DataValue ) {
630
-			$dataValues = [ $dataValues ];
631
-		} elseif ( !is_array( $dataValues ) ) {
632
-			throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' );
627
+	protected function formatDataValues($dataValues, $separator = ', ') {
628
+		if ($dataValues instanceof DataValue) {
629
+			$dataValues = [$dataValues];
630
+		} elseif (!is_array($dataValues)) {
631
+			throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.');
633 632
 		}
634 633
 
635 634
 		$formattedDataValues = [];
636
-		foreach ( $dataValues as $dataValue ) {
637
-			if ( !( $dataValue instanceof DataValue ) ) {
638
-				throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' );
635
+		foreach ($dataValues as $dataValue) {
636
+			if (!($dataValue instanceof DataValue)) {
637
+				throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.');
639 638
 			}
640
-			if ( $dataValue instanceof EntityIdValue ) {
641
-				$formattedDataValues[ ] = $this->entityIdLabelFormatter->formatEntityId( $dataValue->getEntityId() );
639
+			if ($dataValue instanceof EntityIdValue) {
640
+				$formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId($dataValue->getEntityId());
642 641
 			} else {
643
-				$formattedDataValues[ ] = $this->dataValueFormatter->format( $dataValue );
642
+				$formattedDataValues[] = $this->dataValueFormatter->format($dataValue);
644 643
 			}
645 644
 		}
646 645
 
647
-		return implode( $separator, $formattedDataValues );
646
+		return implode($separator, $formattedDataValues);
648 647
 	}
649 648
 
650 649
 	/**
@@ -656,11 +655,11 @@  discard block
 block discarded – undo
656 655
 	 *
657 656
 	 * @return string HTML
658 657
 	 */
659
-	private function getClaimLink( EntityId $entityId, PropertyId $propertyId, $text ) {
658
+	private function getClaimLink(EntityId $entityId, PropertyId $propertyId, $text) {
660 659
 		return Html::rawElement(
661 660
 			'a',
662 661
 			[
663
-				'href' => $this->getClaimUrl( $entityId, $propertyId ),
662
+				'href' => $this->getClaimUrl($entityId, $propertyId),
664 663
 				'target' => '_blank'
665 664
 			],
666 665
 			$text
@@ -675,9 +674,9 @@  discard block
 block discarded – undo
675 674
 	 *
676 675
 	 * @return string
677 676
 	 */
678
-	private function getClaimUrl( EntityId $entityId, PropertyId $propertyId ) {
679
-		$title = $this->entityTitleLookup->getTitleForId( $entityId );
680
-		$entityUrl = sprintf( '%s#%s', $title->getLocalURL(), $propertyId->getSerialization() );
677
+	private function getClaimUrl(EntityId $entityId, PropertyId $propertyId) {
678
+		$title = $this->entityTitleLookup->getTitleForId($entityId);
679
+		$entityUrl = sprintf('%s#%s', $title->getLocalURL(), $propertyId->getSerialization());
681 680
 
682 681
 		return $entityUrl;
683 682
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/QualifierContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		Statement $statement,
24 24
 		Snak $snak
25 25
 	) {
26
-		parent::__construct( $entity, $snak );
26
+		parent::__construct($entity, $snak);
27 27
 		$this->statement = $statement;
28 28
 	}
29 29
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function getSnakGroup() {
35 35
 		$snaks = $this->statement->getQualifiers();
36
-		return array_values( $snaks->getArrayCopy() );
36
+		return array_values($snaks->getArrayCopy());
37 37
 	}
38 38
 
39 39
 	public function getCursor() {
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContext.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	private $statement;
22 22
 
23
-	public function __construct( EntityDocument $entity, Statement $statement ) {
24
-		Assert::parameterType( StatementListProvider::class, $entity, '$entity' );
25
-		parent::__construct( $entity, $statement->getMainSnak() );
23
+	public function __construct(EntityDocument $entity, Statement $statement) {
24
+		Assert::parameterType(StatementListProvider::class, $entity, '$entity');
25
+		parent::__construct($entity, $statement->getMainSnak());
26 26
 
27 27
 		$this->statement = $statement;
28 28
 	}
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		/** @var StatementList $statements */
44 44
 		$statements = $this->entity->getStatements();
45 45
 		return $statements
46
-			->getByRank( [ Statement::RANK_NORMAL, Statement::RANK_PREFERRED ] )
46
+			->getByRank([Statement::RANK_NORMAL, Statement::RANK_PREFERRED])
47 47
 			->getMainSnaks();
48 48
 	}
49 49
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ReferenceContext.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		Reference $reference,
31 31
 		Snak $snak
32 32
 	) {
33
-		parent::__construct( $entity, $snak );
33
+		parent::__construct($entity, $snak);
34 34
 		$this->statement = $statement;
35 35
 		$this->reference = $reference;
36 36
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	public function getSnakGroup() {
43 43
 		$snaks = $this->reference->getSnaks();
44
-		return array_values( $snaks->getArrayCopy() );
44
+		return array_values($snaks->getArrayCopy());
45 45
 	}
46 46
 
47 47
 	public function getCursor() {
Please login to merge, or discard this patch.
src/WikibaseQualityConstraintsHooks.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -28,36 +28,36 @@  discard block
 block discarded – undo
28 28
 	/**
29 29
 	 * @param DatabaseUpdater $updater
30 30
 	 */
31
-	public static function onCreateSchema( DatabaseUpdater $updater ) {
32
-		$updater->addExtensionTable( 'wbqc_constraints', __DIR__ . '/../sql/create_wbqc_constraints.sql' );
33
-		$updater->addExtensionField( 'wbqc_constraints', 'constraint_id', __DIR__ . '/../sql/patch-wbqc_constraints-constraint_id.sql' );
31
+	public static function onCreateSchema(DatabaseUpdater $updater) {
32
+		$updater->addExtensionTable('wbqc_constraints', __DIR__.'/../sql/create_wbqc_constraints.sql');
33
+		$updater->addExtensionField('wbqc_constraints', 'constraint_id', __DIR__.'/../sql/patch-wbqc_constraints-constraint_id.sql');
34 34
 	}
35 35
 
36
-	public static function onWikibaseChange( Change $change ) {
36
+	public static function onWikibaseChange(Change $change) {
37 37
 		$config = MediaWikiServices::getInstance()->getMainConfig();
38
-		if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) &&
39
-			self::isConstraintStatementsChange( $config, $change )
38
+		if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') &&
39
+			self::isConstraintStatementsChange($config, $change)
40 40
 		) {
41 41
 			/** @var EntityChange $change */
42 42
 			$title = Title::newMainPage();
43
-			$params = [ 'propertyId' => $change->getEntityId()->getSerialization() ];
43
+			$params = ['propertyId' => $change->getEntityId()->getSerialization()];
44 44
 			JobQueueGroup::singleton()->push(
45
-				new JobSpecification( 'constraintsTableUpdate', $params, [], $title )
45
+				new JobSpecification('constraintsTableUpdate', $params, [], $title)
46 46
 			);
47 47
 		}
48 48
 	}
49 49
 
50
-	public static function isConstraintStatementsChange( Config $config, Change $change ) {
51
-		if ( !( $change instanceof EntityChange ) ||
50
+	public static function isConstraintStatementsChange(Config $config, Change $change) {
51
+		if (!($change instanceof EntityChange) ||
52 52
 			 $change->getAction() !== EntityChange::UPDATE ||
53
-			 !( $change->getEntityId() instanceof PropertyId )
53
+			 !($change->getEntityId() instanceof PropertyId)
54 54
 		) {
55 55
 			return false;
56 56
 		}
57 57
 
58 58
 		$info = $change->getInfo();
59 59
 
60
-		if ( !array_key_exists( 'compactDiff', $info ) ) {
60
+		if (!array_key_exists('compactDiff', $info)) {
61 61
 			// the non-compact diff ($info['diff']) does not contain statement diffs (T110996),
62 62
 			// so we only know that the change *might* affect the constraint statements
63 63
 			return true;
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
 		/** @var EntityDiffChangedAspects $aspects */
67 67
 		$aspects = $info['compactDiff'];
68 68
 
69
-		$propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' );
70
-		return in_array( $propertyConstraintId, $aspects->getStatementChanges() );
69
+		$propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId');
70
+		return in_array($propertyConstraintId, $aspects->getStatementChanges());
71 71
 	}
72 72
 
73
-	public static function onArticlePurge( WikiPage $wikiPage ) {
73
+	public static function onArticlePurge(WikiPage $wikiPage) {
74 74
 		$repo = WikibaseRepo::getDefaultInstance();
75 75
 
76 76
 		$entityContentFactory = $repo->getEntityContentFactory();
77
-		if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) {
78
-			$entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() );
77
+		if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) {
78
+			$entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle());
79 79
 			$resultsCache = ResultsCache::getDefaultInstance();
80
-			$resultsCache->delete( $entityId );
80
+			$resultsCache->delete($entityId);
81 81
 		}
82 82
 	}
83 83
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 * @param int $timestamp UTC timestamp (seconds since the Epoch)
87 87
 	 * @return bool
88 88
 	 */
89
-	public static function isGadgetEnabledForUserName( $userName, $timestamp ) {
89
+	public static function isGadgetEnabledForUserName($userName, $timestamp) {
90 90
 		$initial = $userName[0];
91 91
 
92
-		if ( $initial === 'Z' ) {
92
+		if ($initial === 'Z') {
93 93
 			$firstWeek = 0;
94
-		} elseif ( $initial >= 'W' && $initial < 'Z' ) {
94
+		} elseif ($initial >= 'W' && $initial < 'Z') {
95 95
 			$firstWeek = 1;
96
-		} elseif ( $initial >= 'T' && $initial < 'W' ) {
96
+		} elseif ($initial >= 'T' && $initial < 'W') {
97 97
 			$firstWeek = 2;
98
-		} elseif ( $initial >= 'N' && $initial < 'T' ) {
98
+		} elseif ($initial >= 'N' && $initial < 'T') {
99 99
 			$firstWeek = 3;
100
-		} elseif ( $initial >= 'E' && $initial < 'N' ) {
100
+		} elseif ($initial >= 'E' && $initial < 'N') {
101 101
 			$firstWeek = 4;
102 102
 		} else {
103 103
 			$firstWeek = 5;
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 		return $timestamp >= $threshold;
116 116
 	}
117 117
 
118
-	public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
118
+	public static function onBeforePageDisplay(OutputPage $out, Skin $skin) {
119 119
 		$repo = WikibaseRepo::getDefaultInstance();
120 120
 
121 121
 		$lookup = $repo->getEntityNamespaceLookup();
122 122
 		$title = $out->getTitle();
123
-		if ( $title === null ) {
123
+		if ($title === null) {
124 124
 			return;
125 125
 		}
126 126
 
127
-		if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) {
127
+		if (!$lookup->isEntityNamespace($title->getNamespace())) {
128 128
 			return;
129 129
 		}
130
-		if ( !$out->getUser()->isLoggedIn() ) {
130
+		if (!$out->getUser()->isLoggedIn()) {
131 131
 			return;
132 132
 		}
133
-		if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) {
133
+		if (empty($out->getJsConfigVars()['wbIsEditView'])) {
134 134
 			return;
135 135
 		}
136 136
 
137
-		if ( self::isGadgetEnabledForUserName( $out->getUser()->getName(), time() ) ) {
138
-			$out->addModules( 'wikibase.quality.constraints.gadget' );
137
+		if (self::isGadgetEnabledForUserName($out->getUser()->getName(), time())) {
138
+			$out->addModules('wikibase.quality.constraints.gadget');
139 139
 		}
140 140
 	}
141 141
 
Please login to merge, or discard this patch.
src/Api/CachingResultsBuilder.php 1 patch
Spacing   +68 added lines, -69 removed lines patch added patch discarded remove patch
@@ -151,30 +151,30 @@  discard block
 block discarded – undo
151 151
 	) {
152 152
 		$results = [];
153 153
 		$metadatas = [];
154
-		if ( $this->canUseStoredResults( $entityIds, $claimIds, $constraintIds, $statuses ) ) {
154
+		if ($this->canUseStoredResults($entityIds, $claimIds, $constraintIds, $statuses)) {
155 155
 			$storedEntityIds = [];
156
-			foreach ( $entityIds as $entityId ) {
157
-				$storedResults = $this->getStoredResults( $entityId );
158
-				if ( $storedResults !== null ) {
159
-					$this->loggingHelper->logCheckConstraintsCacheHit( $entityId );
156
+			foreach ($entityIds as $entityId) {
157
+				$storedResults = $this->getStoredResults($entityId);
158
+				if ($storedResults !== null) {
159
+					$this->loggingHelper->logCheckConstraintsCacheHit($entityId);
160 160
 					$results += $storedResults->getArray();
161 161
 					$metadatas[] = $storedResults->getMetadata();
162 162
 					$storedEntityIds[] = $entityId;
163 163
 				}
164 164
 			}
165
-			$entityIds = array_values( array_diff( $entityIds, $storedEntityIds ) );
165
+			$entityIds = array_values(array_diff($entityIds, $storedEntityIds));
166 166
 		}
167
-		if ( $entityIds !== [] || $claimIds !== [] ) {
168
-			if ( $entityIds !== [] ) {
169
-				$this->loggingHelper->logCheckConstraintsCacheMisses( $entityIds );
167
+		if ($entityIds !== [] || $claimIds !== []) {
168
+			if ($entityIds !== []) {
169
+				$this->loggingHelper->logCheckConstraintsCacheMisses($entityIds);
170 170
 			}
171
-			$response = $this->getAndStoreResults( $entityIds, $claimIds, $constraintIds, $statuses );
171
+			$response = $this->getAndStoreResults($entityIds, $claimIds, $constraintIds, $statuses);
172 172
 			$results += $response->getArray();
173 173
 			$metadatas[] = $response->getMetadata();
174 174
 		}
175 175
 		return new CachedCheckConstraintsResponse(
176 176
 			$results,
177
-			Metadata::merge( $metadatas )
177
+			Metadata::merge($metadatas)
178 178
 		);
179 179
 	}
180 180
 
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 		array $constraintIds = null,
204 204
 		array $statuses
205 205
 	) {
206
-		if ( $claimIds !== [] ) {
206
+		if ($claimIds !== []) {
207 207
 			return false;
208 208
 		}
209
-		if ( $constraintIds !== null ) {
209
+		if ($constraintIds !== null) {
210 210
 			return false;
211 211
 		}
212
-		if ( $statuses != $this->cachedStatuses ) {
212
+		if ($statuses != $this->cachedStatuses) {
213 213
 			return false;
214 214
 		}
215 215
 		return true;
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 		array $constraintIds = null,
229 229
 		array $statuses
230 230
 	) {
231
-		$results = $this->resultsBuilder->getResults( $entityIds, $claimIds, $constraintIds, $statuses );
231
+		$results = $this->resultsBuilder->getResults($entityIds, $claimIds, $constraintIds, $statuses);
232 232
 
233
-		if ( $this->canStoreResults( $entityIds, $claimIds, $constraintIds, $statuses ) ) {
234
-			foreach ( $entityIds as $entityId ) {
233
+		if ($this->canStoreResults($entityIds, $claimIds, $constraintIds, $statuses)) {
234
+			foreach ($entityIds as $entityId) {
235 235
 				$latestRevisionIds = $this->getLatestRevisionIds(
236 236
 					$results->getMetadata()->getDependencyMetadata()->getEntityIds()
237 237
 				);
238
-				if ( $latestRevisionIds === null ) {
238
+				if ($latestRevisionIds === null) {
239 239
 					continue;
240 240
 				}
241 241
 				$value = [
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 					'latestRevisionIds' => $latestRevisionIds,
244 244
 				];
245 245
 				$futureTime = $results->getMetadata()->getDependencyMetadata()->getFutureTime();
246
-				if ( $futureTime !== null ) {
246
+				if ($futureTime !== null) {
247 247
 					$value['futureTime'] = $futureTime->getArrayValue();
248 248
 				}
249
-				$this->cache->set( $entityId, $value, $this->ttlInSeconds );
249
+				$this->cache->set($entityId, $value, $this->ttlInSeconds);
250 250
 			}
251 251
 		}
252 252
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 		array $constraintIds = null,
279 279
 		array $statuses
280 280
 	) {
281
-		if ( $constraintIds !== null ) {
281
+		if ($constraintIds !== null) {
282 282
 			return false;
283 283
 		}
284
-		if ( $statuses != $this->cachedStatuses ) {
284
+		if ($statuses != $this->cachedStatuses) {
285 285
 			return false;
286 286
 		}
287 287
 		return true;
@@ -294,45 +294,44 @@  discard block
 block discarded – undo
294 294
 	public function getStoredResults(
295 295
 		EntityId $entityId
296 296
 	) {
297
-		$value = $this->cache->get( $entityId, $curTTL, [], $asOf );
298
-		$now = call_user_func( $this->microtime, true );
297
+		$value = $this->cache->get($entityId, $curTTL, [], $asOf);
298
+		$now = call_user_func($this->microtime, true);
299 299
 
300
-		if ( $value === false ) {
300
+		if ($value === false) {
301 301
 			return null;
302 302
 		}
303 303
 
304
-		$ageInSeconds = (int)ceil( $now - $asOf );
304
+		$ageInSeconds = (int) ceil($now - $asOf);
305 305
 
306 306
 		$dependedEntityIds = array_map(
307
-			[ $this->entityIdParser, "parse" ],
308
-			array_keys( $value['latestRevisionIds'] )
307
+			[$this->entityIdParser, "parse"],
308
+			array_keys($value['latestRevisionIds'])
309 309
 		);
310 310
 
311
-		if ( $value['latestRevisionIds'] !== $this->getLatestRevisionIds( $dependedEntityIds ) ) {
311
+		if ($value['latestRevisionIds'] !== $this->getLatestRevisionIds($dependedEntityIds)) {
312 312
 			return null;
313 313
 		}
314 314
 
315
-		if ( array_key_exists( 'futureTime', $value ) ) {
316
-			$futureTime = TimeValue::newFromArray( $value['futureTime'] );
317
-			if ( !$this->timeValueComparer->isFutureTime( $futureTime ) ) {
315
+		if (array_key_exists('futureTime', $value)) {
316
+			$futureTime = TimeValue::newFromArray($value['futureTime']);
317
+			if (!$this->timeValueComparer->isFutureTime($futureTime)) {
318 318
 				return null;
319 319
 			}
320
-			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime( $futureTime );
320
+			$futureTimeDependencyMetadata = DependencyMetadata::ofFutureTime($futureTime);
321 321
 		} else {
322 322
 			$futureTimeDependencyMetadata = DependencyMetadata::blank();
323 323
 		}
324 324
 
325 325
 		$cachingMetadata = $ageInSeconds > 0 ?
326
-			CachingMetadata::ofMaximumAgeInSeconds( $ageInSeconds ) :
327
-			CachingMetadata::fresh();
326
+			CachingMetadata::ofMaximumAgeInSeconds($ageInSeconds) : CachingMetadata::fresh();
328 327
 
329
-		if ( is_array( $value['results'] ) ) {
330
-			array_walk( $value['results'], [ $this, 'updateCachingMetadata' ], $cachingMetadata );
328
+		if (is_array($value['results'])) {
329
+			array_walk($value['results'], [$this, 'updateCachingMetadata'], $cachingMetadata);
331 330
 		}
332 331
 
333 332
 		return new CachedCheckConstraintsResponse(
334
-			[ $entityId->getSerialization() => $value['results'] ],
335
-			$this->mergeStoredMetadata( $cachingMetadata, $dependedEntityIds, $futureTimeDependencyMetadata )
333
+			[$entityId->getSerialization() => $value['results']],
334
+			$this->mergeStoredMetadata($cachingMetadata, $dependedEntityIds, $futureTimeDependencyMetadata)
336 335
 		);
337 336
 	}
338 337
 
@@ -347,19 +346,19 @@  discard block
 block discarded – undo
347 346
 		array $dependedEntityIds,
348 347
 		DependencyMetadata $futureTimeDependencyMetadata = null
349 348
 	) {
350
-		return Metadata::merge( [
351
-			Metadata::ofCachingMetadata( $cachingMetadata ),
352
-			Metadata::ofDependencyMetadata( array_reduce(
349
+		return Metadata::merge([
350
+			Metadata::ofCachingMetadata($cachingMetadata),
351
+			Metadata::ofDependencyMetadata(array_reduce(
353 352
 				$dependedEntityIds,
354
-				function( DependencyMetadata $metadata, EntityId $entityId ) {
355
-					return DependencyMetadata::merge( [
353
+				function(DependencyMetadata $metadata, EntityId $entityId) {
354
+					return DependencyMetadata::merge([
356 355
 						$metadata,
357
-						DependencyMetadata::ofEntityId( $entityId )
358
-					] );
356
+						DependencyMetadata::ofEntityId($entityId)
357
+					]);
359 358
 				},
360 359
 				$futureTimeDependencyMetadata
361
-			) )
362
-		] );
360
+			))
361
+		]);
363 362
 	}
364 363
 
365 364
 	/**
@@ -367,14 +366,14 @@  discard block
 block discarded – undo
367 366
 	 * @return int[]|null array from entity ID serializations to revision ID,
368 367
 	 * or null to indicate that not all revision IDs could be loaded
369 368
 	 */
370
-	private function getLatestRevisionIds( array $entityIds ) {
371
-		if ( $entityIds === [] ) {
369
+	private function getLatestRevisionIds(array $entityIds) {
370
+		if ($entityIds === []) {
372 371
 			$this->loggingHelper->logEmptyDependencyMetadata();
373 372
 			return [];
374 373
 		}
375
-		if ( count( $entityIds ) > $this->maxRevisionIds ) {
374
+		if (count($entityIds) > $this->maxRevisionIds) {
376 375
 			// one of those entities will probably be edited soon, so might as well skip caching
377
-			$this->loggingHelper->logHugeDependencyMetadata( $entityIds, $this->maxRevisionIds );
376
+			$this->loggingHelper->logHugeDependencyMetadata($entityIds, $this->maxRevisionIds);
378 377
 			return null;
379 378
 		}
380 379
 
@@ -382,7 +381,7 @@  discard block
 block discarded – undo
382 381
 			$entityIds,
383 382
 			EntityRevisionLookup::LATEST_FROM_REPLICA
384 383
 		);
385
-		if ( $this->hasFalseElements( $latestRevisionIds ) ) {
384
+		if ($this->hasFalseElements($latestRevisionIds)) {
386 385
 			return null;
387 386
 		}
388 387
 		return $latestRevisionIds;
@@ -392,31 +391,31 @@  discard block
 block discarded – undo
392 391
 	 * @param array $array
393 392
 	 * @return bool
394 393
 	 */
395
-	private function hasFalseElements( array $array ) {
396
-		return in_array( false, $array, true );
394
+	private function hasFalseElements(array $array) {
395
+		return in_array(false, $array, true);
397 396
 	}
398 397
 
399
-	public function updateCachingMetadata( &$element, $key, CachingMetadata $cachingMetadata ) {
400
-		if ( $key === 'cached' ) {
401
-			$element = CachingMetadata::merge( [
398
+	public function updateCachingMetadata(&$element, $key, CachingMetadata $cachingMetadata) {
399
+		if ($key === 'cached') {
400
+			$element = CachingMetadata::merge([
402 401
 				$cachingMetadata,
403
-				CachingMetadata::ofArray( $element ),
404
-			] )->toArray();
402
+				CachingMetadata::ofArray($element),
403
+			])->toArray();
405 404
 		}
406 405
 		if (
407
-			is_array( $element ) &&
408
-			array_key_exists( 'constraint', $element ) &&
409
-			in_array( $element['constraint']['type'], $this->possiblyStaleConstraintTypes, true )
406
+			is_array($element) &&
407
+			array_key_exists('constraint', $element) &&
408
+			in_array($element['constraint']['type'], $this->possiblyStaleConstraintTypes, true)
410 409
 		) {
411
-			$element['cached'] = CachingMetadata::merge( [
410
+			$element['cached'] = CachingMetadata::merge([
412 411
 				$cachingMetadata,
413 412
 				CachingMetadata::ofArray(
414
-					array_key_exists( 'cached', $element ) ? $element['cached'] : null
413
+					array_key_exists('cached', $element) ? $element['cached'] : null
415 414
 				),
416
-			] )->toArray();
415
+			])->toArray();
417 416
 		}
418
-		if ( is_array( $element ) ) {
419
-			array_walk( $element, [ $this, __FUNCTION__ ], $cachingMetadata );
417
+		if (is_array($element)) {
418
+			array_walk($element, [$this, __FUNCTION__], $cachingMetadata);
420 419
 		}
421 420
 	}
422 421
 
@@ -425,7 +424,7 @@  discard block
 block discarded – undo
425 424
 	 *
426 425
 	 * @param callable $microtime
427 426
 	 */
428
-	public function setMicrotimeFunction( callable $microtime ) {
427
+	public function setMicrotimeFunction(callable $microtime) {
429 428
 		$this->microtime = $microtime;
430 429
 	}
431 430
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ReferenceContextCursor.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,43 +92,43 @@
 block discarded – undo
92 92
 		return $this->referenceHash;
93 93
 	}
94 94
 
95
-	protected function &getMainArray( array &$container ) {
96
-		$statementArray = &$this->getStatementArray( $container );
95
+	protected function &getMainArray(array &$container) {
96
+		$statementArray = &$this->getStatementArray($container);
97 97
 
98
-		if ( !array_key_exists( 'references', $statementArray ) ) {
98
+		if (!array_key_exists('references', $statementArray)) {
99 99
 			$statementArray['references'] = [];
100 100
 		}
101 101
 		$referencesArray = &$statementArray['references'];
102 102
 
103 103
 		$referenceHash = $this->getReferenceHash();
104
-		foreach ( $referencesArray as &$potentialReferenceArray ) {
105
-			if ( $potentialReferenceArray['hash'] === $referenceHash ) {
104
+		foreach ($referencesArray as &$potentialReferenceArray) {
105
+			if ($potentialReferenceArray['hash'] === $referenceHash) {
106 106
 				$referenceArray = &$potentialReferenceArray;
107 107
 				break;
108 108
 			}
109 109
 		}
110
-		if ( !isset( $referenceArray ) ) {
111
-			$referenceArray = [ 'hash' => $referenceHash, 'snaks' => [] ];
110
+		if (!isset($referenceArray)) {
111
+			$referenceArray = ['hash' => $referenceHash, 'snaks' => []];
112 112
 			$referencesArray[] = &$referenceArray;
113 113
 		}
114 114
 
115 115
 		$snaksArray = &$referenceArray['snaks'];
116 116
 
117 117
 		$snakPropertyId = $this->getSnakPropertyId();
118
-		if ( !array_key_exists( $snakPropertyId, $snaksArray ) ) {
118
+		if (!array_key_exists($snakPropertyId, $snaksArray)) {
119 119
 			$snaksArray[$snakPropertyId] = [];
120 120
 		}
121 121
 		$propertyArray = &$snaksArray[$snakPropertyId];
122 122
 
123 123
 		$snakHash = $this->getSnakHash();
124
-		foreach ( $propertyArray as &$potentialSnakArray ) {
125
-			if ( $potentialSnakArray['hash'] === $snakHash ) {
124
+		foreach ($propertyArray as &$potentialSnakArray) {
125
+			if ($potentialSnakArray['hash'] === $snakHash) {
126 126
 				$snakArray = &$potentialSnakArray;
127 127
 				break;
128 128
 			}
129 129
 		}
130
-		if ( !isset( $snakArray ) ) {
131
-			$snakArray = [ 'hash' => $snakHash ];
130
+		if (!isset($snakArray)) {
131
+			$snakArray = ['hash' => $snakHash];
132 132
 			$propertyArray[] = &$snakArray;
133 133
 		}
134 134
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/QualifierContextCursor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -80,29 +80,29 @@
 block discarded – undo
80 80
 		return $this->snakHash;
81 81
 	}
82 82
 
83
-	protected function &getMainArray( array &$container ) {
84
-		$statementArray = &$this->getStatementArray( $container );
83
+	protected function &getMainArray(array &$container) {
84
+		$statementArray = &$this->getStatementArray($container);
85 85
 
86
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
86
+		if (!array_key_exists('qualifiers', $statementArray)) {
87 87
 			$statementArray['qualifiers'] = [];
88 88
 		}
89 89
 		$qualifiersArray = &$statementArray['qualifiers'];
90 90
 
91 91
 		$snakPropertyId = $this->getSnakPropertyId();
92
-		if ( !array_key_exists( $snakPropertyId, $qualifiersArray ) ) {
92
+		if (!array_key_exists($snakPropertyId, $qualifiersArray)) {
93 93
 			$qualifiersArray[$snakPropertyId] = [];
94 94
 		}
95 95
 		$propertyArray = &$qualifiersArray[$snakPropertyId];
96 96
 
97 97
 		$snakHash = $this->getSnakHash();
98
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
99
-			if ( $potentialQualifierArray['hash'] === $snakHash ) {
98
+		foreach ($propertyArray as &$potentialQualifierArray) {
99
+			if ($potentialQualifierArray['hash'] === $snakHash) {
100 100
 				$qualifierArray = &$potentialQualifierArray;
101 101
 				break;
102 102
 			}
103 103
 		}
104
-		if ( !isset( $qualifierArray ) ) {
105
-			$qualifierArray = [ 'hash' => $snakHash ];
104
+		if (!isset($qualifierArray)) {
105
+			$qualifierArray = ['hash' => $snakHash];
106 106
 			$propertyArray[] = &$qualifierArray;
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/MainSnakContextCursor.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,12 +72,12 @@
 block discarded – undo
72 72
 		return $this->snakHash;
73 73
 	}
74 74
 
75
-	protected function &getMainArray( array &$container ) {
76
-		$statementArray = &$this->getStatementArray( $container );
75
+	protected function &getMainArray(array &$container) {
76
+		$statementArray = &$this->getStatementArray($container);
77 77
 
78
-		if ( !array_key_exists( 'mainsnak', $statementArray ) ) {
78
+		if (!array_key_exists('mainsnak', $statementArray)) {
79 79
 			$snakHash = $this->getSnakHash();
80
-			$statementArray['mainsnak'] = [ 'hash' => $snakHash ];
80
+			$statementArray['mainsnak'] = ['hash' => $snakHash];
81 81
 		}
82 82
 		$mainsnakArray = &$statementArray['mainsnak'];
83 83
 
Please login to merge, or discard this patch.