@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | Config $config, |
134 | 134 | IBufferingStatsdDataFactory $dataFactory |
135 | 135 | ) { |
136 | - parent::__construct( 'ConstraintReport' ); |
|
136 | + parent::__construct('ConstraintReport'); |
|
137 | 137 | |
138 | 138 | $this->entityLookup = $entityLookup; |
139 | 139 | $this->entityTitleLookup = $entityTitleLookup; |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | $language = $this->getLanguage(); |
143 | 143 | |
144 | 144 | $formatterOptions = new FormatterOptions(); |
145 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
145 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
146 | 146 | $this->dataValueFormatter = $valueFormatterFactory->getValueFormatter( |
147 | 147 | SnakFormatter::FORMAT_HTML, |
148 | 148 | $formatterOptions |
149 | 149 | ); |
150 | 150 | |
151 | - $labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup( $language ); |
|
151 | + $labelLookup = $fallbackLabelDescLookupFactory->newLabelDescriptionLookup($language); |
|
152 | 152 | |
153 | 153 | $this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( |
154 | 154 | $labelLookup |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return array |
182 | 182 | */ |
183 | 183 | private function getModules() { |
184 | - return [ 'SpecialConstraintReportPage' ]; |
|
184 | + return ['SpecialConstraintReportPage']; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public function getDescription() { |
202 | - return $this->msg( 'wbqc-constraintreport' )->escaped(); |
|
202 | + return $this->msg('wbqc-constraintreport')->escaped(); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -211,42 +211,42 @@ discard block |
||
211 | 211 | * @throws EntityIdParsingException |
212 | 212 | * @throws UnexpectedValueException |
213 | 213 | */ |
214 | - public function execute( $subPage ) { |
|
214 | + public function execute($subPage) { |
|
215 | 215 | $out = $this->getOutput(); |
216 | 216 | |
217 | - $postRequest = $this->getContext()->getRequest()->getVal( 'entityid' ); |
|
218 | - if ( $postRequest ) { |
|
219 | - $out->redirect( $this->getPageTitle( strtoupper( $postRequest ) )->getLocalURL() ); |
|
217 | + $postRequest = $this->getContext()->getRequest()->getVal('entityid'); |
|
218 | + if ($postRequest) { |
|
219 | + $out->redirect($this->getPageTitle(strtoupper($postRequest))->getLocalURL()); |
|
220 | 220 | return; |
221 | 221 | } |
222 | 222 | |
223 | - $out->addModules( $this->getModules() ); |
|
223 | + $out->addModules($this->getModules()); |
|
224 | 224 | |
225 | 225 | $this->setHeaders(); |
226 | 226 | |
227 | - $out->addHTML( $this->getExplanationText() ); |
|
227 | + $out->addHTML($this->getExplanationText()); |
|
228 | 228 | $this->buildEntityIdForm(); |
229 | 229 | |
230 | - if ( !$subPage ) { |
|
230 | + if (!$subPage) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | |
234 | - if ( !is_string( $subPage ) ) { |
|
235 | - throw new InvalidArgumentException( '$subPage must be string.' ); |
|
234 | + if (!is_string($subPage)) { |
|
235 | + throw new InvalidArgumentException('$subPage must be string.'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | try { |
239 | - $entityId = $this->entityIdParser->parse( $subPage ); |
|
240 | - } catch ( EntityIdParsingException $e ) { |
|
239 | + $entityId = $this->entityIdParser->parse($subPage); |
|
240 | + } catch (EntityIdParsingException $e) { |
|
241 | 241 | $out->addHTML( |
242 | - $this->buildNotice( 'wbqc-constraintreport-invalid-entity-id', true ) |
|
242 | + $this->buildNotice('wbqc-constraintreport-invalid-entity-id', true) |
|
243 | 243 | ); |
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
247 | - if ( !$this->entityLookup->hasEntity( $entityId ) ) { |
|
247 | + if (!$this->entityLookup->hasEntity($entityId)) { |
|
248 | 248 | $out->addHTML( |
249 | - $this->buildNotice( 'wbqc-constraintreport-not-existent-entity', true ) |
|
249 | + $this->buildNotice('wbqc-constraintreport-not-existent-entity', true) |
|
250 | 250 | ); |
251 | 251 | return; |
252 | 252 | } |
@@ -254,18 +254,18 @@ discard block |
||
254 | 254 | $this->dataFactory->increment( |
255 | 255 | 'wikibase.quality.constraints.specials.specialConstraintReport.executeCheck' |
256 | 256 | ); |
257 | - $results = $this->constraintChecker->checkAgainstConstraintsOnEntityId( $entityId ); |
|
257 | + $results = $this->constraintChecker->checkAgainstConstraintsOnEntityId($entityId); |
|
258 | 258 | |
259 | - if ( count( $results ) > 0 ) { |
|
259 | + if (count($results) > 0) { |
|
260 | 260 | $out->addHTML( |
261 | - $this->buildResultHeader( $entityId ) |
|
262 | - . $this->buildSummary( $results ) |
|
263 | - . $this->buildResultTable( $entityId, $results ) |
|
261 | + $this->buildResultHeader($entityId) |
|
262 | + . $this->buildSummary($results) |
|
263 | + . $this->buildResultTable($entityId, $results) |
|
264 | 264 | ); |
265 | 265 | } else { |
266 | 266 | $out->addHTML( |
267 | - $this->buildResultHeader( $entityId ) |
|
268 | - . $this->buildNotice( 'wbqc-constraintreport-empty-result' ) |
|
267 | + $this->buildResultHeader($entityId) |
|
268 | + . $this->buildNotice('wbqc-constraintreport-empty-result') |
|
269 | 269 | ); |
270 | 270 | } |
271 | 271 | } |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | 'name' => 'entityid', |
282 | 282 | 'label-message' => 'wbqc-constraintreport-form-entityid-label', |
283 | 283 | 'cssclass' => 'wbqc-constraintreport-form-entity-id', |
284 | - 'placeholder' => $this->msg( 'wbqc-constraintreport-form-entityid-placeholder' )->escaped() |
|
284 | + 'placeholder' => $this->msg('wbqc-constraintreport-form-entityid-placeholder')->escaped() |
|
285 | 285 | ] |
286 | 286 | ]; |
287 | - $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form' ); |
|
288 | - $htmlForm->setSubmitText( $this->msg( 'wbqc-constraintreport-form-submit-label' )->escaped() ); |
|
289 | - $htmlForm->setSubmitCallback( function() { |
|
287 | + $htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext(), 'wbqc-constraintreport-form'); |
|
288 | + $htmlForm->setSubmitText($this->msg('wbqc-constraintreport-form-submit-label')->escaped()); |
|
289 | + $htmlForm->setSubmitCallback(function() { |
|
290 | 290 | return false; |
291 | 291 | } ); |
292 | - $htmlForm->setMethod( 'post' ); |
|
292 | + $htmlForm->setMethod('post'); |
|
293 | 293 | $htmlForm->show(); |
294 | 294 | } |
295 | 295 | |
@@ -303,16 +303,16 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return string HTML |
305 | 305 | */ |
306 | - private function buildNotice( $messageKey, $error = false ) { |
|
307 | - if ( !is_string( $messageKey ) ) { |
|
308 | - throw new InvalidArgumentException( '$message must be string.' ); |
|
306 | + private function buildNotice($messageKey, $error = false) { |
|
307 | + if (!is_string($messageKey)) { |
|
308 | + throw new InvalidArgumentException('$message must be string.'); |
|
309 | 309 | } |
310 | - if ( !is_bool( $error ) ) { |
|
311 | - throw new InvalidArgumentException( '$error must be bool.' ); |
|
310 | + if (!is_bool($error)) { |
|
311 | + throw new InvalidArgumentException('$error must be bool.'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | $cssClasses = 'wbqc-constraintreport-notice'; |
315 | - if ( $error ) { |
|
315 | + if ($error) { |
|
316 | 316 | $cssClasses .= ' wbqc-constraintreport-notice-error'; |
317 | 317 | } |
318 | 318 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | [ |
322 | 322 | 'class' => $cssClasses |
323 | 323 | ], |
324 | - $this->msg( $messageKey )->escaped() |
|
324 | + $this->msg($messageKey)->escaped() |
|
325 | 325 | ); |
326 | 326 | } |
327 | 327 | |
@@ -331,16 +331,16 @@ discard block |
||
331 | 331 | private function getExplanationText() { |
332 | 332 | return Html::rawElement( |
333 | 333 | 'div', |
334 | - [ 'class' => 'wbqc-explanation' ], |
|
334 | + ['class' => 'wbqc-explanation'], |
|
335 | 335 | Html::rawElement( |
336 | 336 | 'p', |
337 | 337 | [], |
338 | - $this->msg( 'wbqc-constraintreport-explanation-part-one' )->escaped() |
|
338 | + $this->msg('wbqc-constraintreport-explanation-part-one')->escaped() |
|
339 | 339 | ) |
340 | 340 | . Html::rawElement( |
341 | 341 | 'p', |
342 | 342 | [], |
343 | - $this->msg( 'wbqc-constraintreport-explanation-part-two' )->escaped() |
|
343 | + $this->msg('wbqc-constraintreport-explanation-part-two')->escaped() |
|
344 | 344 | ) |
345 | 345 | ); |
346 | 346 | } |
@@ -351,71 +351,70 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @return string HTML |
353 | 353 | */ |
354 | - private function buildResultTable( EntityId $entityId, array $results ) { |
|
354 | + private function buildResultTable(EntityId $entityId, array $results) { |
|
355 | 355 | // Set table headers |
356 | 356 | $table = new HtmlTableBuilder( |
357 | 357 | [ |
358 | 358 | new HtmlTableHeaderBuilder( |
359 | - $this->msg( 'wbqc-constraintreport-result-table-header-status' )->escaped(), |
|
359 | + $this->msg('wbqc-constraintreport-result-table-header-status')->escaped(), |
|
360 | 360 | true |
361 | 361 | ), |
362 | 362 | new HtmlTableHeaderBuilder( |
363 | - $this->msg( 'wbqc-constraintreport-result-table-header-claim' )->escaped(), |
|
363 | + $this->msg('wbqc-constraintreport-result-table-header-claim')->escaped(), |
|
364 | 364 | true |
365 | 365 | ), |
366 | 366 | new HtmlTableHeaderBuilder( |
367 | - $this->msg( 'wbqc-constraintreport-result-table-header-constraint' )->escaped(), |
|
367 | + $this->msg('wbqc-constraintreport-result-table-header-constraint')->escaped(), |
|
368 | 368 | true |
369 | 369 | ) |
370 | 370 | ] |
371 | 371 | ); |
372 | 372 | |
373 | - foreach ( $results as $result ) { |
|
374 | - $table = $this->appendToResultTable( $table, $entityId, $result ); |
|
373 | + foreach ($results as $result) { |
|
374 | + $table = $this->appendToResultTable($table, $entityId, $result); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | return $table->toHtml(); |
378 | 378 | } |
379 | 379 | |
380 | - private function appendToResultTable( HtmlTableBuilder $table, EntityId $entityId, CheckResult $result ) { |
|
380 | + private function appendToResultTable(HtmlTableBuilder $table, EntityId $entityId, CheckResult $result) { |
|
381 | 381 | // Status column |
382 | 382 | $statusColumn = $this->buildTooltipElement( |
383 | - $this->formatStatus( $result->getStatus() ), |
|
383 | + $this->formatStatus($result->getStatus()), |
|
384 | 384 | $result->getMessage() !== null ? |
385 | - $this->violationMessageRenderer->render( $result->getMessage() ) : |
|
386 | - null, |
|
385 | + $this->violationMessageRenderer->render($result->getMessage()) : null, |
|
387 | 386 | '[?]' |
388 | 387 | ); |
389 | 388 | |
390 | 389 | // Claim column |
391 | - $property = $this->entityIdLabelFormatter->formatEntityId( $result->getContext()->getSnak()->getPropertyId() ); |
|
392 | - if ( $result->getSnakType() === 'value' ) { |
|
393 | - $value = $this->constraintParameterRenderer->formatValue( $result->getDataValue() ); |
|
390 | + $property = $this->entityIdLabelFormatter->formatEntityId($result->getContext()->getSnak()->getPropertyId()); |
|
391 | + if ($result->getSnakType() === 'value') { |
|
392 | + $value = $this->constraintParameterRenderer->formatValue($result->getDataValue()); |
|
394 | 393 | } else { |
395 | - $value = htmlspecialchars( $result->getSnakType() ); |
|
394 | + $value = htmlspecialchars($result->getSnakType()); |
|
396 | 395 | } |
397 | 396 | |
398 | 397 | $claimColumn = $this->getClaimLink( |
399 | 398 | $entityId, |
400 | 399 | $result->getContext()->getSnak()->getPropertyId(), |
401 | - $property . ': ' . $value |
|
400 | + $property.': '.$value |
|
402 | 401 | ); |
403 | 402 | |
404 | 403 | // Constraint column |
405 | 404 | $constraintTypeItemId = $result->getConstraint()->getConstraintTypeItemId(); |
406 | 405 | try { |
407 | - $constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId( new ItemId( $constraintTypeItemId ) ); |
|
408 | - } catch ( InvalidArgumentException $e ) { |
|
409 | - $constraintTypeLabel = htmlspecialchars( $constraintTypeItemId ); |
|
406 | + $constraintTypeLabel = $this->entityIdLabelFormatter->formatEntityId(new ItemId($constraintTypeItemId)); |
|
407 | + } catch (InvalidArgumentException $e) { |
|
408 | + $constraintTypeLabel = htmlspecialchars($constraintTypeItemId); |
|
410 | 409 | } |
411 | 410 | $constraintLink = $this->getClaimLink( |
412 | 411 | $result->getContext()->getSnak()->getPropertyId(), |
413 | - new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ), |
|
412 | + new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')), |
|
414 | 413 | $constraintTypeLabel |
415 | 414 | ); |
416 | 415 | $constraintColumn = $this->buildExpandableElement( |
417 | 416 | $constraintLink, |
418 | - $this->constraintParameterRenderer->formatParameters( $result->getParameters() ), |
|
417 | + $this->constraintParameterRenderer->formatParameters($result->getParameters()), |
|
419 | 418 | '[...]' |
420 | 419 | ); |
421 | 420 | |
@@ -450,15 +449,15 @@ discard block |
||
450 | 449 | * |
451 | 450 | * @return string HTML |
452 | 451 | */ |
453 | - protected function buildResultHeader( EntityId $entityId ) { |
|
454 | - $entityLink = sprintf( '%s (%s)', |
|
455 | - $this->entityIdLinkFormatter->formatEntityId( $entityId ), |
|
456 | - htmlspecialchars( $entityId->getSerialization() ) ); |
|
452 | + protected function buildResultHeader(EntityId $entityId) { |
|
453 | + $entityLink = sprintf('%s (%s)', |
|
454 | + $this->entityIdLinkFormatter->formatEntityId($entityId), |
|
455 | + htmlspecialchars($entityId->getSerialization())); |
|
457 | 456 | |
458 | 457 | return Html::rawElement( |
459 | 458 | 'h3', |
460 | 459 | [], |
461 | - sprintf( '%s %s', $this->msg( 'wbqc-constraintreport-result-headline' )->escaped(), $entityLink ) |
|
460 | + sprintf('%s %s', $this->msg('wbqc-constraintreport-result-headline')->escaped(), $entityLink) |
|
462 | 461 | ); |
463 | 462 | } |
464 | 463 | |
@@ -469,24 +468,24 @@ discard block |
||
469 | 468 | * |
470 | 469 | * @return string HTML |
471 | 470 | */ |
472 | - protected function buildSummary( array $results ) { |
|
471 | + protected function buildSummary(array $results) { |
|
473 | 472 | $statuses = []; |
474 | - foreach ( $results as $result ) { |
|
475 | - $status = strtolower( $result->getStatus() ); |
|
476 | - $statuses[$status] = isset( $statuses[$status] ) ? $statuses[$status] + 1 : 1; |
|
473 | + foreach ($results as $result) { |
|
474 | + $status = strtolower($result->getStatus()); |
|
475 | + $statuses[$status] = isset($statuses[$status]) ? $statuses[$status] + 1 : 1; |
|
477 | 476 | } |
478 | 477 | |
479 | 478 | $statusElements = []; |
480 | - foreach ( $statuses as $status => $count ) { |
|
481 | - if ( $count > 0 ) { |
|
479 | + foreach ($statuses as $status => $count) { |
|
480 | + if ($count > 0) { |
|
482 | 481 | $statusElements[] = |
483 | - $this->formatStatus( $status ) |
|
482 | + $this->formatStatus($status) |
|
484 | 483 | . ': ' |
485 | 484 | . $count; |
486 | 485 | } |
487 | 486 | } |
488 | 487 | |
489 | - return Html::rawElement( 'p', [], implode( ', ', $statusElements ) ); |
|
488 | + return Html::rawElement('p', [], implode(', ', $statusElements)); |
|
490 | 489 | } |
491 | 490 | |
492 | 491 | /** |
@@ -501,15 +500,15 @@ discard block |
||
501 | 500 | * |
502 | 501 | * @return string HTML |
503 | 502 | */ |
504 | - protected function buildTooltipElement( $content, $tooltipContent, $indicator ) { |
|
505 | - if ( !is_string( $content ) ) { |
|
506 | - throw new InvalidArgumentException( '$content has to be string.' ); |
|
503 | + protected function buildTooltipElement($content, $tooltipContent, $indicator) { |
|
504 | + if (!is_string($content)) { |
|
505 | + throw new InvalidArgumentException('$content has to be string.'); |
|
507 | 506 | } |
508 | - if ( $tooltipContent && ( !is_string( $tooltipContent ) ) ) { |
|
509 | - throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' ); |
|
507 | + if ($tooltipContent && (!is_string($tooltipContent))) { |
|
508 | + throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.'); |
|
510 | 509 | } |
511 | 510 | |
512 | - if ( empty( $tooltipContent ) ) { |
|
511 | + if (empty($tooltipContent)) { |
|
513 | 512 | return $content; |
514 | 513 | } |
515 | 514 | |
@@ -526,13 +525,13 @@ discard block |
||
526 | 525 | [ |
527 | 526 | 'class' => 'wbqc-indicator' |
528 | 527 | ], |
529 | - htmlspecialchars( $indicator ) . $tooltip |
|
528 | + htmlspecialchars($indicator).$tooltip |
|
530 | 529 | ); |
531 | 530 | |
532 | 531 | return Html::rawElement( |
533 | 532 | 'span', |
534 | 533 | [], |
535 | - sprintf( '%s %s', $content, $tooltipIndicator ) |
|
534 | + sprintf('%s %s', $content, $tooltipIndicator) |
|
536 | 535 | ); |
537 | 536 | } |
538 | 537 | |
@@ -548,15 +547,15 @@ discard block |
||
548 | 547 | * |
549 | 548 | * @return string HTML |
550 | 549 | */ |
551 | - protected function buildExpandableElement( $content, $expandableContent, $indicator ) { |
|
552 | - if ( !is_string( $content ) ) { |
|
553 | - throw new InvalidArgumentException( '$content has to be string.' ); |
|
550 | + protected function buildExpandableElement($content, $expandableContent, $indicator) { |
|
551 | + if (!is_string($content)) { |
|
552 | + throw new InvalidArgumentException('$content has to be string.'); |
|
554 | 553 | } |
555 | - if ( $expandableContent && ( !is_string( $expandableContent ) ) ) { |
|
556 | - throw new InvalidArgumentException( '$tooltipContent, if provided, has to be string.' ); |
|
554 | + if ($expandableContent && (!is_string($expandableContent))) { |
|
555 | + throw new InvalidArgumentException('$tooltipContent, if provided, has to be string.'); |
|
557 | 556 | } |
558 | 557 | |
559 | - if ( empty( $expandableContent ) ) { |
|
558 | + if (empty($expandableContent)) { |
|
560 | 559 | return $content; |
561 | 560 | } |
562 | 561 | |
@@ -576,7 +575,7 @@ discard block |
||
576 | 575 | $expandableContent |
577 | 576 | ); |
578 | 577 | |
579 | - return sprintf( '%s %s %s', $content, $tooltipIndicator, $expandableContent ); |
|
578 | + return sprintf('%s %s %s', $content, $tooltipIndicator, $expandableContent); |
|
580 | 579 | } |
581 | 580 | |
582 | 581 | /** |
@@ -588,16 +587,16 @@ discard block |
||
588 | 587 | * |
589 | 588 | * @return string HTML |
590 | 589 | */ |
591 | - private function formatStatus( $status ) { |
|
592 | - $messageName = "wbqc-constraintreport-status-" . strtolower( $status ); |
|
590 | + private function formatStatus($status) { |
|
591 | + $messageName = "wbqc-constraintreport-status-".strtolower($status); |
|
593 | 592 | |
594 | 593 | $formattedStatus = |
595 | 594 | Html::element( |
596 | 595 | 'span', |
597 | 596 | [ |
598 | - 'class' => 'wbqc-status wbqc-status-' . $status |
|
597 | + 'class' => 'wbqc-status wbqc-status-'.$status |
|
599 | 598 | ], |
600 | - $this->msg( $messageName )->text() |
|
599 | + $this->msg($messageName)->text() |
|
601 | 600 | ); |
602 | 601 | |
603 | 602 | return $formattedStatus; |
@@ -613,26 +612,26 @@ discard block |
||
613 | 612 | * |
614 | 613 | * @return string HTML |
615 | 614 | */ |
616 | - protected function formatDataValues( $dataValues, $separator = ', ' ) { |
|
617 | - if ( $dataValues instanceof DataValue ) { |
|
618 | - $dataValues = [ $dataValues ]; |
|
619 | - } elseif ( !is_array( $dataValues ) ) { |
|
620 | - throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' ); |
|
615 | + protected function formatDataValues($dataValues, $separator = ', ') { |
|
616 | + if ($dataValues instanceof DataValue) { |
|
617 | + $dataValues = [$dataValues]; |
|
618 | + } elseif (!is_array($dataValues)) { |
|
619 | + throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.'); |
|
621 | 620 | } |
622 | 621 | |
623 | 622 | $formattedDataValues = []; |
624 | - foreach ( $dataValues as $dataValue ) { |
|
625 | - if ( !( $dataValue instanceof DataValue ) ) { |
|
626 | - throw new InvalidArgumentException( '$dataValues has to be instance of DataValue or an array of DataValues.' ); |
|
623 | + foreach ($dataValues as $dataValue) { |
|
624 | + if (!($dataValue instanceof DataValue)) { |
|
625 | + throw new InvalidArgumentException('$dataValues has to be instance of DataValue or an array of DataValues.'); |
|
627 | 626 | } |
628 | - if ( $dataValue instanceof EntityIdValue ) { |
|
629 | - $formattedDataValues[ ] = $this->entityIdLabelFormatter->formatEntityId( $dataValue->getEntityId() ); |
|
627 | + if ($dataValue instanceof EntityIdValue) { |
|
628 | + $formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId($dataValue->getEntityId()); |
|
630 | 629 | } else { |
631 | - $formattedDataValues[ ] = $this->dataValueFormatter->format( $dataValue ); |
|
630 | + $formattedDataValues[] = $this->dataValueFormatter->format($dataValue); |
|
632 | 631 | } |
633 | 632 | } |
634 | 633 | |
635 | - return implode( $separator, $formattedDataValues ); |
|
634 | + return implode($separator, $formattedDataValues); |
|
636 | 635 | } |
637 | 636 | |
638 | 637 | /** |
@@ -644,11 +643,11 @@ discard block |
||
644 | 643 | * |
645 | 644 | * @return string HTML |
646 | 645 | */ |
647 | - private function getClaimLink( EntityId $entityId, PropertyId $propertyId, $text ) { |
|
646 | + private function getClaimLink(EntityId $entityId, PropertyId $propertyId, $text) { |
|
648 | 647 | return Html::rawElement( |
649 | 648 | 'a', |
650 | 649 | [ |
651 | - 'href' => $this->getClaimUrl( $entityId, $propertyId ), |
|
650 | + 'href' => $this->getClaimUrl($entityId, $propertyId), |
|
652 | 651 | 'target' => '_blank' |
653 | 652 | ], |
654 | 653 | $text |
@@ -663,9 +662,9 @@ discard block |
||
663 | 662 | * |
664 | 663 | * @return string |
665 | 664 | */ |
666 | - private function getClaimUrl( EntityId $entityId, PropertyId $propertyId ) { |
|
667 | - $title = $this->entityTitleLookup->getTitleForId( $entityId ); |
|
668 | - $entityUrl = sprintf( '%s#%s', $title->getLocalURL(), $propertyId->getSerialization() ); |
|
665 | + private function getClaimUrl(EntityId $entityId, PropertyId $propertyId) { |
|
666 | + $title = $this->entityTitleLookup->getTitleForId($entityId); |
|
667 | + $entityUrl = sprintf('%s#%s', $title->getLocalURL(), $propertyId->getSerialization()); |
|
669 | 668 | |
670 | 669 | return $entityUrl; |
671 | 670 | } |