Completed
Push — master ( 32936a...86defd )
by
unknown
02:03
created
includes/ConstraintLookup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,6 +14,6 @@
 block discarded – undo
14 14
 	 *
15 15
 	 * @return Constraint[]
16 16
 	 */
17
-	public function queryConstraintsForProperty( PropertyId $propertyId );
17
+	public function queryConstraintsForProperty(PropertyId $propertyId);
18 18
 
19 19
 }
Please login to merge, or discard this patch.
WikibaseQualityConstraints.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( function_exists( 'wfLoadExtension' ) ) {
4
-	wfLoadExtension( 'WikibaseQualityConstraints', __DIR__ . '/extension.json' );
3
+if (function_exists('wfLoadExtension')) {
4
+	wfLoadExtension('WikibaseQualityConstraints', __DIR__.'/extension.json');
5 5
 	// Keep i18n globals so mergeMessageFileList.php doesn't break
6
-	$wgMessagesDirs['WikibaseQualityConstraints'] = __DIR__ . '/i18n';
7
-	$wgExtensionMessagesFiles['WikibaseQualityConstraintsAlias'] = __DIR__ . '/WikibaseQualityConstraints.alias.php';
6
+	$wgMessagesDirs['WikibaseQualityConstraints'] = __DIR__.'/i18n';
7
+	$wgExtensionMessagesFiles['WikibaseQualityConstraintsAlias'] = __DIR__.'/WikibaseQualityConstraints.alias.php';
8 8
 	/* wfWarn(
9 9
 		'Deprecated PHP entry point used for WikibaseQualityConstraints extension. ' .
10 10
 		'Please use wfLoadExtension instead, ' .
@@ -12,5 +12,5 @@  discard block
 block discarded – undo
12 12
 	); */
13 13
 	return;
14 14
 } else {
15
-	die( 'This version of the WikibaseQualityConstraints extension requires MediaWiki 1.25+' );
15
+	die('This version of the WikibaseQualityConstraints extension requires MediaWiki 1.25+');
16 16
 }
Please login to merge, or discard this patch.
includes/CachingConstraintLookup.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @var ConstraintLookup $lookup The lookup to which all queries are delegated.
28 28
 	 */
29
-	public function __construct( ConstraintLookup $lookup ) {
29
+	public function __construct(ConstraintLookup $lookup) {
30 30
 		$this->lookup = $lookup;
31 31
 	}
32 32
 
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @return Constraint[]
37 37
 	 */
38
-	public function queryConstraintsForProperty( PropertyId $propertyId ) {
38
+	public function queryConstraintsForProperty(PropertyId $propertyId) {
39 39
 		$id = $propertyId->getSerialization();
40
-		if ( !array_key_exists( $id, $this->cache ) ) {
41
-			$this->cache[$id] = $this->lookup->queryConstraintsForProperty( $propertyId );
40
+		if (!array_key_exists($id, $this->cache)) {
41
+			$this->cache[$id] = $this->lookup->queryConstraintsForProperty($propertyId);
42 42
 		}
43 43
 		return $this->cache[$id];
44 44
 	}
Please login to merge, or discard this patch.
specials/SpecialConstraintReport.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
 	/**
163 163
 	 * Returns array of modules that should be added
164 164
 	 *
165
-	 * @return array
165
+	 * @return string[]
166 166
 	 */
167 167
 	private function getModules() {
168 168
 		return [ 'SpecialConstraintReportPage' ];
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		DelegatingConstraintChecker $constraintChecker,
132 132
 		Config $config
133 133
 	) {
134
-		parent::__construct( 'ConstraintReport' );
134
+		parent::__construct('ConstraintReport');
135 135
 
136 136
 		$this->entityLookup = $entityLookup;
137 137
 		$this->entityTitleLookup = $entityTitleLookup;
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 		$language = $this->getLanguage();
141 141
 
142 142
 		$formatterOptions = new FormatterOptions();
143
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() );
143
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode());
144 144
 		$this->dataValueFormatter = $valueFormatterFactory->getValueFormatter(
145 145
 			SnakFormatter::FORMAT_HTML,
146 146
 			$formatterOptions
147 147
 		);
148 148
 
149
-		$labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup( $language );
149
+		$labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup($language);
150 150
 
151 151
 		$this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter(
152 152
 			$labelLookup
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		$this->constraintChecker = $constraintChecker;
160 160
 
161
-		$this->constraintParameterRenderer = new ConstraintParameterRenderer( $this->entityIdLabelFormatter, $this->dataValueFormatter );
161
+		$this->constraintParameterRenderer = new ConstraintParameterRenderer($this->entityIdLabelFormatter, $this->dataValueFormatter);
162 162
 
163 163
 		$this->config = $config;
164 164
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return array
170 170
 	 */
171 171
 	private function getModules() {
172
-		return [ 'SpecialConstraintReportPage' ];
172
+		return ['SpecialConstraintReportPage'];
173 173
 	}
174 174
 
175 175
 	/**
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @return string
188 188
 	 */
189 189
 	public function getDescription() {
190
-		return $this->msg( 'wbqc-constraintreport' )->escaped();
190
+		return $this->msg('wbqc-constraintreport')->escaped();
191 191
 	}
192 192
 
193 193
 	/**
@@ -199,60 +199,60 @@  discard block
 block discarded – undo
199 199
 	 * @throws EntityIdParsingException
200 200
 	 * @throws UnexpectedValueException
201 201
 	 */
202
-	public function execute( $subPage ) {
202
+	public function execute($subPage) {
203 203
 		$out = $this->getOutput();
204 204
 
205
-		$postRequest = $this->getContext()->getRequest()->getVal( 'entityid' );
206
-		if ( $postRequest ) {
207
-			$out->redirect( $this->getPageTitle( strtoupper( $postRequest ) )->getLocalURL() );
205
+		$postRequest = $this->getContext()->getRequest()->getVal('entityid');
206
+		if ($postRequest) {
207
+			$out->redirect($this->getPageTitle(strtoupper($postRequest))->getLocalURL());
208 208
 			return;
209 209
 		}
210 210
 
211
-		$out->addModules( $this->getModules() );
211
+		$out->addModules($this->getModules());
212 212
 
213 213
 		$this->setHeaders();
214 214
 
215
-		$out->addHTML( $this->getExplanationText() );
215
+		$out->addHTML($this->getExplanationText());
216 216
 		$this->buildEntityIdForm();
217 217
 
218
-		if ( !$subPage ) {
218
+		if (!$subPage) {
219 219
 			return;
220 220
 		}
221 221
 
222
-		if ( !is_string( $subPage ) ) {
223
-			throw new InvalidArgumentException( '$subPage must be string.' );
222
+		if (!is_string($subPage)) {
223
+			throw new InvalidArgumentException('$subPage must be string.');
224 224
 		}
225 225
 
226 226
 		try {
227
-			$entityId = $this->entityIdParser->parse( $subPage );
228
-		} catch ( EntityIdParsingException $e ) {
227
+			$entityId = $this->entityIdParser->parse($subPage);
228
+		} catch (EntityIdParsingException $e) {
229 229
 			$out->addHTML(
230
-				$this->buildNotice( 'wbqc-constraintreport-invalid-entity-id', true )
230
+				$this->buildNotice('wbqc-constraintreport-invalid-entity-id', true)
231 231
 			);
232 232
 			return;
233 233
 		}
234 234
 
235
-		if ( !$this->entityLookup->hasEntity( $entityId ) ) {
235
+		if (!$this->entityLookup->hasEntity($entityId)) {
236 236
 			$out->addHTML(
237
-				$this->buildNotice( 'wbqc-constraintreport-not-existent-entity', true )
237
+				$this->buildNotice('wbqc-constraintreport-not-existent-entity', true)
238 238
 			);
239 239
 			return;
240 240
 		}
241 241
 
242 242
 		MediaWikiServices::getInstance()->getStatsdDataFactory()
243
-			->increment( 'wikibase.quality.constraints.specials.specialConstraintReport.executeCheck' );
244
-		$results = $this->constraintChecker->checkAgainstConstraintsOnEntityId( $entityId );
243
+			->increment('wikibase.quality.constraints.specials.specialConstraintReport.executeCheck');
244
+		$results = $this->constraintChecker->checkAgainstConstraintsOnEntityId($entityId);
245 245
 
246
-		if ( count( $results ) > 0 ) {
246
+		if (count($results) > 0) {
247 247
 			$out->addHTML(
248
-				$this->buildResultHeader( $entityId )
249
-				. $this->buildSummary( $results )
250
-				. $this->buildResultTable( $entityId, $results )
248
+				$this->buildResultHeader($entityId)
249
+				. $this->buildSummary($results)
250
+				. $this->buildResultTable($entityId, $results)
251 251
 			);
252 252
 		} else {
253 253
 			$out->addHTML(
254
-				$this->buildResultHeader( $entityId )
255
-				. $this->buildNotice( 'wbqc-constraintreport-empty-result' )
254
+				$this->buildResultHeader($entityId)
255
+				. $this->buildNotice('wbqc-constraintreport-empty-result')
256 256
 			);
257 257
 		}
258 258
 	}
@@ -268,15 +268,15 @@  discard block
 block discarded – undo
268 268
 				'name' => 'entityid',
269 269
 				'label-message' => 'wbqc-constraintreport-form-entityid-label',
270 270
 				'cssclass' => 'wbqc-constraintreport-form-entity-id',
271
-				'placeholder' => $this->msg( 'wbqc-constraintreport-form-entityid-placeholder' )->escaped()
271
+				'placeholder' => $this->msg('wbqc-constraintreport-form-entityid-placeholder')->escaped()
272 272
 			]
273 273
 		];
274
-		$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form' );
275
-		$htmlForm->setSubmitText( $this->msg( 'wbqc-constraintreport-form-submit-label' )->escaped() );
276
-		$htmlForm->setSubmitCallback( function() {
274
+		$htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form');
275
+		$htmlForm->setSubmitText($this->msg('wbqc-constraintreport-form-submit-label')->escaped());
276
+		$htmlForm->setSubmitCallback(function() {
277 277
 			return false;
278 278
 		} );
279
-		$htmlForm->setMethod( 'post' );
279
+		$htmlForm->setMethod('post');
280 280
 		$htmlForm->show();
281 281
 	}
282 282
 
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return string HTML
292 292
 	 */
293
-	private function buildNotice( $messageKey, $error = false ) {
294
-		if ( !is_string( $messageKey ) ) {
295
-			throw new InvalidArgumentException( '$message must be string.' );
293
+	private function buildNotice($messageKey, $error = false) {
294
+		if (!is_string($messageKey)) {
295
+			throw new InvalidArgumentException('$message must be string.');
296 296
 		}
297
-		if ( !is_bool( $error ) ) {
298
-			throw new InvalidArgumentException( '$error must be bool.' );
297
+		if (!is_bool($error)) {
298
+			throw new InvalidArgumentException('$error must be bool.');
299 299
 		}
300 300
 
301 301
 		$cssClasses = 'wbqc-constraintreport-notice';
302
-		if ( $error ) {
302
+		if ($error) {
303 303
 			$cssClasses .= ' wbqc-constraintreport-notice-error';
304 304
 		}
305 305
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 				[
309 309
 					'class' => $cssClasses
310 310
 				],
311
-				$this->msg( $messageKey )->escaped()
311
+				$this->msg($messageKey)->escaped()
312 312
 			);
313 313
 	}
314 314
 
@@ -318,16 +318,16 @@  discard block
 block discarded – undo
318 318
 	private function getExplanationText() {
319 319
 		return Html::rawElement(
320 320
 			'div',
321
-			[ 'class' => 'wbqc-explanation' ],
321
+			['class' => 'wbqc-explanation'],
322 322
 			Html::rawElement(
323 323
 				'p',
324 324
 				[],
325
-				$this->msg( 'wbqc-constraintreport-explanation-part-one' )->escaped()
325
+				$this->msg('wbqc-constraintreport-explanation-part-one')->escaped()
326 326
 			)
327 327
 			. Html::rawElement(
328 328
 				'p',
329 329
 				[],
330
-				$this->msg( 'wbqc-constraintreport-explanation-part-two' )->escaped()
330
+				$this->msg('wbqc-constraintreport-explanation-part-two')->escaped()
331 331
 			)
332 332
 		);
333 333
 	}
@@ -338,69 +338,69 @@  discard block
 block discarded – undo
338 338
 	 *
339 339
 	 * @return string HTML
340 340
 	 */
341
-	private function buildResultTable( EntityId $entityId, array $results ) {
341
+	private function buildResultTable(EntityId $entityId, array $results) {
342 342
 		// Set table headers
343 343
 		$table = new HtmlTableBuilder(
344 344
 			[
345 345
 				new HtmlTableHeaderBuilder(
346
-					$this->msg( 'wbqc-constraintreport-result-table-header-status' )->escaped(),
346
+					$this->msg('wbqc-constraintreport-result-table-header-status')->escaped(),
347 347
 					true
348 348
 				),
349 349
 				new HtmlTableHeaderBuilder(
350
-					$this->msg( 'wbqc-constraintreport-result-table-header-claim' )->escaped(),
350
+					$this->msg('wbqc-constraintreport-result-table-header-claim')->escaped(),
351 351
 					true
352 352
 				),
353 353
 				new HtmlTableHeaderBuilder(
354
-					$this->msg( 'wbqc-constraintreport-result-table-header-constraint' )->escaped(),
354
+					$this->msg('wbqc-constraintreport-result-table-header-constraint')->escaped(),
355 355
 					true
356 356
 				)
357 357
 			]
358 358
 		);
359 359
 
360
-		foreach ( $results as $result ) {
361
-			$table = $this->appendToResultTable( $table, $entityId, $result );
360
+		foreach ($results as $result) {
361
+			$table = $this->appendToResultTable($table, $entityId, $result);
362 362
 		}
363 363
 
364 364
 		return $table->toHtml();
365 365
 	}
366 366
 
367
-	private function appendToResultTable( HtmlTableBuilder $table, EntityId $entityId, CheckResult $result ) {
367
+	private function appendToResultTable(HtmlTableBuilder $table, EntityId $entityId, CheckResult $result) {
368 368
 		// Status column
369 369
 		$statusColumn = $this->buildTooltipElement(
370
-			$this->formatStatus( $result->getStatus() ),
370
+			$this->formatStatus($result->getStatus()),
371 371
 			$result->getMessage(),
372 372
 			'[?]'
373 373
 		);
374 374
 
375 375
 		// Claim column
376
-		$property = $this->entityIdLabelFormatter->formatEntityId( $result->getContext()->getSnak()->getPropertyId() );
377
-		if ( $result->getSnakType() === 'value' ) {
378
-			$value = $this->constraintParameterRenderer->formatValue( $result->getDataValue() );
376
+		$property = $this->entityIdLabelFormatter->formatEntityId($result->getContext()->getSnak()->getPropertyId());
377
+		if ($result->getSnakType() === 'value') {
378
+			$value = $this->constraintParameterRenderer->formatValue($result->getDataValue());
379 379
 		} else {
380
-			$value = htmlspecialchars( $result->getSnakType() );
380
+			$value = htmlspecialchars($result->getSnakType());
381 381
 		}
382 382
 
383 383
 		$claimColumn = $this->getClaimLink(
384 384
 			$entityId,
385 385
 			$result->getContext()->getSnak()->getPropertyId(),
386
-			$property . ': ' . $value
386
+			$property.': '.$value
387 387
 		);
388 388
 
389 389
 		// Constraint column
390 390
 		$constraintTypeItemId = $result->getConstraint()->getConstraintTypeItemId();
391 391
 		try {
392
-			$constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $constraintTypeItemId ) );
393
-		} catch ( InvalidArgumentException $e ) {
394
-			$constraintTypeLabel = htmlspecialchars( $constraintTypeItemId );
392
+			$constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($constraintTypeItemId));
393
+		} catch (InvalidArgumentException $e) {
394
+			$constraintTypeLabel = htmlspecialchars($constraintTypeItemId);
395 395
 		}
396 396
 		$constraintLink = $this->getClaimLink(
397 397
 			$result->getContext()->getSnak()->getPropertyId(),
398
-			new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ),
398
+			new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')),
399 399
 			$constraintTypeLabel
400 400
 		);
401 401
 		$constraintColumn = $this->buildExpandableElement(
402 402
 			$constraintLink,
403
-			$this->constraintParameterRenderer->formatParameters( $result->getParameters() ),
403
+			$this->constraintParameterRenderer->formatParameters($result->getParameters()),
404 404
 			'[...]'
405 405
 		);
406 406
 
@@ -435,15 +435,15 @@  discard block
 block discarded – undo
435 435
 	 *
436 436
 	 * @return string HTML
437 437
 	 */
438
-	protected function buildResultHeader( EntityId $entityId ) {
439
-		$entityLink = sprintf( '%s (%s)',
440
-							   $this->entityIdLinkFormatter->formatEntityId( $entityId ),
441
-							   htmlspecialchars( $entityId->getSerialization() ) );
438
+	protected function buildResultHeader(EntityId $entityId) {
439
+		$entityLink = sprintf('%s (%s)',
440
+							   $this->entityIdLinkFormatter->formatEntityId($entityId),
441
+							   htmlspecialchars($entityId->getSerialization()));
442 442
 
443 443
 		return Html::rawElement(
444 444
 			'h3',
445 445
 			[],
446
-			sprintf( '%s %s', $this->msg( 'wbqc-constraintreport-result-headline' )->escaped(), $entityLink )
446
+			sprintf('%s %s', $this->msg('wbqc-constraintreport-result-headline')->escaped(), $entityLink)
447 447
 		);
448 448
 	}
449 449
 
@@ -454,24 +454,24 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @return string HTML
456 456
 	 */
457
-	protected function buildSummary( array $results ) {
457
+	protected function buildSummary(array $results) {
458 458
 		$statuses = [];
459
-		foreach ( $results as $result ) {
460
-			$status = strtolower( $result->getStatus() );
461
-			$statuses[$status] = isset( $statuses[$status] ) ? $statuses[$status] + 1 : 1;
459
+		foreach ($results as $result) {
460
+			$status = strtolower($result->getStatus());
461
+			$statuses[$status] = isset($statuses[$status]) ? $statuses[$status] + 1 : 1;
462 462
 		}
463 463
 
464 464
 		$statusElements = [];
465
-		foreach ( $statuses as $status => $count ) {
466
-			if ( $count > 0 ) {
465
+		foreach ($statuses as $status => $count) {
466
+			if ($count > 0) {
467 467
 				$statusElements[] =
468
-					$this->formatStatus( $status )
468
+					$this->formatStatus($status)
469 469
 					. ': '
470 470
 					. $count;
471 471
 			}
472 472
 		}
473 473
 
474
-		return Html::rawElement( 'p', [], implode( ', ', $statusElements ) );
474
+		return Html::rawElement('p', [], implode(', ', $statusElements));
475 475
 	}
476 476
 
477 477
 	/**
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 	 *
487 487
 	 * @return string HTML
488 488
 	 */
489
-	protected function buildTooltipElement( $content, $tooltipContent, $indicator ) {
490
-		if ( !is_string( $content ) ) {
491
-			throw new InvalidArgumentException( '$content has to be string.' );
489
+	protected function buildTooltipElement($content, $tooltipContent, $indicator) {
490
+		if (!is_string($content)) {
491
+			throw new InvalidArgumentException('$content has to be string.');
492 492
 		}
493
-		if ( $tooltipContent && ( !is_string( $tooltipContent ) ) ) {
494
-			throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' );
493
+		if ($tooltipContent && (!is_string($tooltipContent))) {
494
+			throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.');
495 495
 		}
496 496
 
497
-		if ( empty( $tooltipContent ) ) {
497
+		if (empty($tooltipContent)) {
498 498
 			return $content;
499 499
 		}
500 500
 
@@ -511,13 +511,13 @@  discard block
 block discarded – undo
511 511
 			[
512 512
 				'class' => 'wbqc-indicator'
513 513
 			],
514
-			htmlspecialchars( $indicator ) . $tooltip
514
+			htmlspecialchars($indicator).$tooltip
515 515
 		);
516 516
 
517 517
 		return Html::rawElement(
518 518
 			'span',
519 519
 			[],
520
-			sprintf( '%s %s', $content, $tooltipIndicator )
520
+			sprintf('%s %s', $content, $tooltipIndicator)
521 521
 		);
522 522
 	}
523 523
 
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
 	 *
534 534
 	 * @return string HTML
535 535
 	 */
536
-	protected function buildExpandableElement( $content, $expandableContent, $indicator ) {
537
-		if ( !is_string( $content ) ) {
538
-			throw new InvalidArgumentException( '$content has to be string.' );
536
+	protected function buildExpandableElement($content, $expandableContent, $indicator) {
537
+		if (!is_string($content)) {
538
+			throw new InvalidArgumentException('$content has to be string.');
539 539
 		}
540
-		if ( $expandableContent && ( !is_string( $expandableContent ) ) ) {
541
-			throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' );
540
+		if ($expandableContent && (!is_string($expandableContent))) {
541
+			throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.');
542 542
 		}
543 543
 
544
-		if ( empty( $expandableContent ) ) {
544
+		if (empty($expandableContent)) {
545 545
 			return $content;
546 546
 		}
547 547
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		);
563 563
 
564 564
 		return
565
-			sprintf( '%s %s %s', $content, $tooltipIndicator, $expandableContent );
565
+			sprintf('%s %s %s', $content, $tooltipIndicator, $expandableContent);
566 566
 	}
567 567
 
568 568
 	/**
@@ -574,16 +574,16 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @return string HTML
576 576
 	 */
577
-	private function formatStatus( $status ) {
578
-		$messageName = "wbqc-constraintreport-status-" . strtolower( $status );
577
+	private function formatStatus($status) {
578
+		$messageName = "wbqc-constraintreport-status-".strtolower($status);
579 579
 
580 580
 		$formattedStatus =
581 581
 			Html::element(
582 582
 				'span',
583 583
 				[
584
-					'class' => 'wbqc-status wbqc-status-' . $status
584
+					'class' => 'wbqc-status wbqc-status-'.$status
585 585
 				],
586
-				$this->msg( $messageName )->text()
586
+				$this->msg($messageName)->text()
587 587
 			);
588 588
 
589 589
 		return $formattedStatus;
@@ -599,26 +599,26 @@  discard block
 block discarded – undo
599 599
 	 *
600 600
 	 * @return string HTML
601 601
 	 */
602
-	protected function formatDataValues( $dataValues, $separator = ', ' ) {
603
-		if ( $dataValues instanceof DataValue ) {
604
-			$dataValues = [ $dataValues ];
605
-		} elseif ( !is_array( $dataValues ) ) {
606
-			throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' );
602
+	protected function formatDataValues($dataValues, $separator = ', ') {
603
+		if ($dataValues instanceof DataValue) {
604
+			$dataValues = [$dataValues];
605
+		} elseif (!is_array($dataValues)) {
606
+			throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.');
607 607
 		}
608 608
 
609 609
 		$formattedDataValues = [];
610
-		foreach ( $dataValues as $dataValue ) {
611
-			if ( !( $dataValue instanceof DataValue ) ) {
612
-				throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' );
610
+		foreach ($dataValues as $dataValue) {
611
+			if (!($dataValue instanceof DataValue)) {
612
+				throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.');
613 613
 			}
614
-			if ( $dataValue instanceof EntityIdValue ) {
615
-				$formattedDataValues[ ] = $this->entityIdLabelFormatter->formatEntityId( $dataValue->getEntityId() );
614
+			if ($dataValue instanceof EntityIdValue) {
615
+				$formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId($dataValue->getEntityId());
616 616
 			} else {
617
-				$formattedDataValues[ ] = $this->dataValueFormatter->format( $dataValue );
617
+				$formattedDataValues[] = $this->dataValueFormatter->format($dataValue);
618 618
 			}
619 619
 		}
620 620
 
621
-		return implode( $separator, $formattedDataValues );
621
+		return implode($separator, $formattedDataValues);
622 622
 	}
623 623
 
624 624
 	/**
@@ -630,12 +630,12 @@  discard block
 block discarded – undo
630 630
 	 *
631 631
 	 * @return string HTML
632 632
 	 */
633
-	private function getClaimLink( EntityId $entityId, PropertyId $propertyId, $text ) {
633
+	private function getClaimLink(EntityId $entityId, PropertyId $propertyId, $text) {
634 634
 		return
635 635
 			Html::rawElement(
636 636
 				'a',
637 637
 				[
638
-					'href' => $this->getClaimUrl( $entityId, $propertyId ),
638
+					'href' => $this->getClaimUrl($entityId, $propertyId),
639 639
 					'target' => '_blank'
640 640
 				],
641 641
 				$text
@@ -650,9 +650,9 @@  discard block
 block discarded – undo
650 650
 	 *
651 651
 	 * @return string
652 652
 	 */
653
-	private function getClaimUrl( EntityId $entityId, PropertyId $propertyId ) {
654
-		$title = $this->entityTitleLookup->getTitleForId( $entityId );
655
-		$entityUrl = sprintf( '%s#%s', $title->getLocalURL(), $propertyId->getSerialization() );
653
+	private function getClaimUrl(EntityId $entityId, PropertyId $propertyId) {
654
+		$title = $this->entityTitleLookup->getTitleForId($entityId);
655
+		$entityUrl = sprintf('%s#%s', $title->getLocalURL(), $propertyId->getSerialization());
656 656
 
657 657
 		return $entityUrl;
658 658
 	}
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/ValueCountCheckerHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 	 *
25 25
 	 * @return int[]
26 26
 	 */
27
-	public function getPropertyCount( StatementList $statements ) {
28
-		if ( !isset( $this->propertyCount ) ) {
27
+	public function getPropertyCount(StatementList $statements) {
28
+		if (!isset($this->propertyCount)) {
29 29
 			$this->propertyCount = [];
30 30
 
31 31
 			/** @var Statement $statement */
32
-			foreach ( $statements as $statement ) {
32
+			foreach ($statements as $statement) {
33 33
 				$counter = $statement->getRank() === Statement::RANK_DEPRECATED ? 0 : 1;
34
-				if ( array_key_exists( $statement->getPropertyId()->getSerialization(), $this->propertyCount ) ) {
34
+				if (array_key_exists($statement->getPropertyId()->getSerialization(), $this->propertyCount)) {
35 35
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] += $counter;
36 36
 				} else {
37 37
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] = $counter;
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/ConstraintParameterException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 	/**
17 17
 	 * @param string $message HTML
18 18
 	 */
19
-	public function __construct( $message ) {
20
-		parent::__construct( $message );
19
+	public function __construct($message) {
20
+		parent::__construct($message);
21 21
 	}
22 22
 
23 23
 }
Please login to merge, or discard this patch.
includes/ConstraintCheck/Helper/SparqlHelperException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 class SparqlHelperException extends RuntimeException {
11 11
 
12 12
 	public function __construct() {
13
-		parent::__construct( 'The SPARQL query endpoint returned an error.' );
13
+		parent::__construct('The SPARQL query endpoint returned an error.');
14 14
 	}
15 15
 
16 16
 }
Please login to merge, or discard this patch.
WikibaseQualityConstraints.alias.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
 
11 11
 /** English (English) */
12 12
 $specialPageAliases['en'] = [
13
-	'ConstraintReport' => [ 'ConstraintReport', 'Constraint Report' ],
13
+	'ConstraintReport' => ['ConstraintReport', 'Constraint Report'],
14 14
 ];
Please login to merge, or discard this patch.
api/CheckConstraintParameters.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 *
60 60
 	 * @return self
61 61
 	 */
62
-	public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) {
62
+	public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') {
63 63
 		$constraintReportFactory = ConstraintReportFactory::getDefaultInstance();
64 64
 		$repo = WikibaseRepo::getDefaultInstance();
65
-		$helperFactory = $repo->getApiHelperFactory( RequestContext::getMain() );
65
+		$helperFactory = $repo->getApiHelperFactory(RequestContext::getMain());
66 66
 		return new self(
67 67
 			$main,
68 68
 			$name,
@@ -89,53 +89,53 @@  discard block
 block discarded – undo
89 89
 		DelegatingConstraintChecker $delegatingConstraintChecker,
90 90
 		StatementGuidParser $statementGuidParser
91 91
 	) {
92
-		parent::__construct( $main, $name, $prefix );
92
+		parent::__construct($main, $name, $prefix);
93 93
 
94
-		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this );
94
+		$this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this);
95 95
 		$this->delegatingConstraintChecker = $delegatingConstraintChecker;
96 96
 		$this->statementGuidParser = $statementGuidParser;
97 97
 	}
98 98
 
99 99
 	public function execute() {
100 100
 		MediaWikiServices::getInstance()->getStatsdDataFactory()
101
-			->increment( 'wikibase.quality.constraints.api.checkConstraintParameters.execute' );
101
+			->increment('wikibase.quality.constraints.api.checkConstraintParameters.execute');
102 102
 
103 103
 		$params = $this->extractRequestParams();
104 104
 		$result = $this->getResult();
105 105
 
106
-		$propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] );
107
-		$constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] );
106
+		$propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]);
107
+		$constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]);
108 108
 
109
-		$this->checkPropertyIds( $propertyIds, $result );
110
-		$this->checkConstraintIds( $constraintIds, $result );
109
+		$this->checkPropertyIds($propertyIds, $result);
110
+		$this->checkConstraintIds($constraintIds, $result);
111 111
 
112
-		$result->addValue( null, 'success', 1 );
112
+		$result->addValue(null, 'success', 1);
113 113
 	}
114 114
 
115 115
 	/**
116 116
 	 * @param array|null $propertyIdSerializations
117 117
 	 * @return PropertyId[]
118 118
 	 */
119
-	private function parsePropertyIds( $propertyIdSerializations ) {
120
-		if ( $propertyIdSerializations === null ) {
119
+	private function parsePropertyIds($propertyIdSerializations) {
120
+		if ($propertyIdSerializations === null) {
121 121
 			return [];
122
-		} elseif ( empty( $propertyIdSerializations ) ) {
122
+		} elseif (empty($propertyIdSerializations)) {
123 123
 			$this->apiErrorReporter->dieError(
124
-				'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.',
124
+				'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.',
125 125
 				'no-data'
126 126
 			);
127 127
 		}
128 128
 
129 129
 		return array_map(
130
-			function( $propertyIdSerialization ) {
130
+			function($propertyIdSerialization) {
131 131
 				try {
132
-					return new PropertyId( $propertyIdSerialization );
133
-				} catch ( InvalidArgumentException $e ) {
132
+					return new PropertyId($propertyIdSerialization);
133
+				} catch (InvalidArgumentException $e) {
134 134
 					$this->apiErrorReporter->dieError(
135 135
 						"Invalid id: $propertyIdSerialization",
136 136
 						'invalid-property-id',
137 137
 						0, // default argument
138
-						[ self::PARAM_PROPERTY_ID => $propertyIdSerialization ]
138
+						[self::PARAM_PROPERTY_ID => $propertyIdSerialization]
139 139
 					);
140 140
 				}
141 141
 			},
@@ -147,35 +147,35 @@  discard block
 block discarded – undo
147 147
 	 * @param array|null $constraintIds
148 148
 	 * @return string[]
149 149
 	 */
150
-	private function parseConstraintIds( $constraintIds ) {
151
-		if ( $constraintIds === null ) {
150
+	private function parseConstraintIds($constraintIds) {
151
+		if ($constraintIds === null) {
152 152
 			return [];
153
-		} elseif ( empty( $constraintIds ) ) {
153
+		} elseif (empty($constraintIds)) {
154 154
 			$this->apiErrorReporter->dieError(
155
-				'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.',
155
+				'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.',
156 156
 				'no-data'
157 157
 			);
158 158
 		}
159 159
 
160 160
 		return array_map(
161
-			function( $constraintId ) {
161
+			function($constraintId) {
162 162
 				try {
163
-					$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
164
-					if ( !$propertyId instanceof PropertyId ) {
163
+					$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
164
+					if (!$propertyId instanceof PropertyId) {
165 165
 						$this->apiErrorReporter->dieError(
166 166
 							"Invalid property ID: {$propertyId->getSerialization()}",
167 167
 							'invalid-property-id',
168 168
 							0, // default argument
169
-							[ self::PARAM_CONSTRAINT_ID => $constraintId ]
169
+							[self::PARAM_CONSTRAINT_ID => $constraintId]
170 170
 						);
171 171
 					}
172 172
 					return $constraintId;
173
-				} catch ( StatementGuidParsingException $e ) {
173
+				} catch (StatementGuidParsingException $e) {
174 174
 					$this->apiErrorReporter->dieError(
175 175
 						"Invalid statement GUID: $constraintId",
176 176
 						'invalid-guid',
177 177
 						0, // default argument
178
-						[ self::PARAM_CONSTRAINT_ID => $constraintId ]
178
+						[self::PARAM_CONSTRAINT_ID => $constraintId]
179 179
 					);
180 180
 				}
181 181
 			},
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 	 * @param PropertyId[] $propertyIds
188 188
 	 * @param ApiResult $result
189 189
 	 */
190
-	private function checkPropertyIds( array $propertyIds, ApiResult $result ) {
191
-		foreach ( $propertyIds as $propertyId ) {
192
-			$result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' );
193
-			$allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId( $propertyId );
194
-			foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) {
195
-				$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
190
+	private function checkPropertyIds(array $propertyIds, ApiResult $result) {
191
+		foreach ($propertyIds as $propertyId) {
192
+			$result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc');
193
+			$allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId($propertyId);
194
+			foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) {
195
+				$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
196 196
 			}
197 197
 		}
198 198
 	}
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
 	 * @param string[] $constraintIds
202 202
 	 * @param ApiResult $result
203 203
 	 */
204
-	private function checkConstraintIds( array $constraintIds, ApiResult $result ) {
205
-		foreach ( $constraintIds as $constraintId ) {
206
-			if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) {
204
+	private function checkConstraintIds(array $constraintIds, ApiResult $result) {
205
+		foreach ($constraintIds as $constraintId) {
206
+			if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) {
207 207
 				// already checked as part of checkPropertyIds()
208 208
 				continue;
209 209
 			}
210
-			$constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId( $constraintId );
211
-			$this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result );
210
+			$constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId($constraintId);
211
+			$this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result);
212 212
 		}
213 213
 	}
214 214
 
@@ -216,17 +216,17 @@  discard block
 block discarded – undo
216 216
 	 * @param PropertyId $propertyId
217 217
 	 * @return string[]
218 218
 	 */
219
-	private function getResultPathForPropertyId( PropertyId $propertyId ) {
220
-		return [ $this->getModuleName(), $propertyId->getSerialization() ];
219
+	private function getResultPathForPropertyId(PropertyId $propertyId) {
220
+		return [$this->getModuleName(), $propertyId->getSerialization()];
221 221
 	}
222 222
 
223 223
 	/**
224 224
 	 * @param string $constraintId
225 225
 	 * @return string[]
226 226
 	 */
227
-	private function getResultPathForConstraintId( $constraintId ) {
228
-		$propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId();
229
-		return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] );
227
+	private function getResultPathForConstraintId($constraintId) {
228
+		$propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId();
229
+		return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]);
230 230
 	}
231 231
 
232 232
 	/**
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param ConstraintParameterException[]|null $constraintParameterExceptions
237 237
 	 * @param ApiResult $result
238 238
 	 */
239
-	private function addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, ApiResult $result ) {
240
-		$path = $this->getResultPathForConstraintId( $constraintId );
241
-		if ( $constraintParameterExceptions === null ) {
239
+	private function addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, ApiResult $result) {
240
+		$path = $this->getResultPathForConstraintId($constraintId);
241
+		if ($constraintParameterExceptions === null) {
242 242
 			$result->addValue(
243 243
 				$path,
244 244
 				self::KEY_STATUS,
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 			$result->addValue(
249 249
 				$path,
250 250
 				self::KEY_STATUS,
251
-				empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
251
+				empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY
252 252
 			);
253 253
 			$result->addValue(
254 254
 				$path,
255 255
 				self::KEY_PROBLEMS,
256
-				array_map( [ $this, 'formatConstraintParameterException' ], $constraintParameterExceptions )
256
+				array_map([$this, 'formatConstraintParameterException'], $constraintParameterExceptions)
257 257
 			);
258 258
 		}
259 259
 	}
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param ConstraintParameterException $e
265 265
 	 * @return array
266 266
 	 */
267
-	private function formatConstraintParameterException( ConstraintParameterException $e ) {
267
+	private function formatConstraintParameterException(ConstraintParameterException $e) {
268 268
 		return [
269 269
 			self::KEY_MESSAGE_HTML => $e->getMessage(),
270 270
 		];
Please login to merge, or discard this patch.