@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | EntityIdHtmlLinkFormatterFactory $entityIdHtmlLinkFormatterFactory, |
| 50 | 50 | DumpMetaInformationLookup $dumpMetaInformationRepo |
| 51 | 51 | ) { |
| 52 | - parent::__construct( 'ExternalDatabases' ); |
|
| 52 | + parent::__construct('ExternalDatabases'); |
|
| 53 | 53 | |
| 54 | 54 | $this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( |
| 55 | 55 | $this->getLanguage() |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @return string |
| 74 | 74 | */ |
| 75 | 75 | public function getDescription() { |
| 76 | - return $this->msg( 'wbqev-externaldbs' )->text(); |
|
| 76 | + return $this->msg('wbqev-externaldbs')->text(); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -81,51 +81,51 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @param string|null $subPage |
| 83 | 83 | */ |
| 84 | - public function execute( $subPage ) { |
|
| 84 | + public function execute($subPage) { |
|
| 85 | 85 | $out = $this->getOutput(); |
| 86 | 86 | |
| 87 | 87 | $this->setHeaders(); |
| 88 | 88 | |
| 89 | 89 | $out->addHTML( |
| 90 | - Html::openElement( 'p' ) |
|
| 91 | - . $this->msg( 'wbqev-externaldbs-instructions' )->parse() |
|
| 92 | - . Html::closeElement( 'p' ) |
|
| 93 | - . Html::openElement( 'h3' ) |
|
| 94 | - . $this->msg( 'wbqev-externaldbs-overview-headline' )->parse() |
|
| 95 | - . Html::closeElement( 'h3' ) |
|
| 90 | + Html::openElement('p') |
|
| 91 | + . $this->msg('wbqev-externaldbs-instructions')->parse() |
|
| 92 | + . Html::closeElement('p') |
|
| 93 | + . Html::openElement('h3') |
|
| 94 | + . $this->msg('wbqev-externaldbs-overview-headline')->parse() |
|
| 95 | + . Html::closeElement('h3') |
|
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | 98 | $dumps = $this->dumpMetaInformationRepo->getAll(); |
| 99 | - if ( $dumps !== [] ) { |
|
| 99 | + if ($dumps !== []) { |
|
| 100 | 100 | $groupedDumpMetaInformation = []; |
| 101 | - foreach ( $dumps as $dump ) { |
|
| 101 | + foreach ($dumps as $dump) { |
|
| 102 | 102 | $sourceItemId = $dump->getSourceItemId()->getSerialization(); |
| 103 | 103 | $groupedDumpMetaInformation[$sourceItemId][] = $dump; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $table = new HtmlTableBuilder( |
| 107 | 107 | [ |
| 108 | - $this->msg( 'wbqev-externaldbs-name' )->escaped(), |
|
| 109 | - $this->msg( 'wbqev-externaldbs-id' )->escaped(), |
|
| 110 | - $this->msg( 'wbqev-externaldbs-import-date' )->escaped(), |
|
| 111 | - $this->msg( 'wbqev-externaldbs-language' )->escaped(), |
|
| 112 | - $this->msg( 'wbqev-externaldbs-source-urls' )->escaped(), |
|
| 113 | - $this->msg( 'wbqev-externaldbs-size' )->escaped(), |
|
| 114 | - $this->msg( 'wbqev-externaldbs-license' )->escaped() |
|
| 108 | + $this->msg('wbqev-externaldbs-name')->escaped(), |
|
| 109 | + $this->msg('wbqev-externaldbs-id')->escaped(), |
|
| 110 | + $this->msg('wbqev-externaldbs-import-date')->escaped(), |
|
| 111 | + $this->msg('wbqev-externaldbs-language')->escaped(), |
|
| 112 | + $this->msg('wbqev-externaldbs-source-urls')->escaped(), |
|
| 113 | + $this->msg('wbqev-externaldbs-size')->escaped(), |
|
| 114 | + $this->msg('wbqev-externaldbs-license')->escaped() |
|
| 115 | 115 | ], |
| 116 | 116 | true |
| 117 | 117 | ); |
| 118 | 118 | |
| 119 | - foreach ( $groupedDumpMetaInformation as $dumpMetaInformation ) { |
|
| 120 | - $table->appendRows( $this->getRowGroup( $dumpMetaInformation ) ); |
|
| 119 | + foreach ($groupedDumpMetaInformation as $dumpMetaInformation) { |
|
| 120 | + $table->appendRows($this->getRowGroup($dumpMetaInformation)); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $out->addHTML( $table->toHtml() ); |
|
| 123 | + $out->addHTML($table->toHtml()); |
|
| 124 | 124 | } else { |
| 125 | 125 | $out->addHTML( |
| 126 | - Html::openElement( 'p' ) |
|
| 127 | - . $this->msg( 'wbqev-externaldbs-no-databases' )->escaped() |
|
| 128 | - . Html::closeElement( 'p' ) |
|
| 126 | + Html::openElement('p') |
|
| 127 | + . $this->msg('wbqev-externaldbs-no-databases')->escaped() |
|
| 128 | + . Html::closeElement('p') |
|
| 129 | 129 | ); |
| 130 | 130 | } |
| 131 | 131 | } |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @return array[] |
| 139 | 139 | */ |
| 140 | - private function getRowGroup( array $dumpMetaInformationGroup ) { |
|
| 140 | + private function getRowGroup(array $dumpMetaInformationGroup) { |
|
| 141 | 141 | $rows = []; |
| 142 | 142 | |
| 143 | - foreach ( $dumpMetaInformationGroup as $dumpMetaInformation ) { |
|
| 143 | + foreach ($dumpMetaInformationGroup as $dumpMetaInformation) { |
|
| 144 | 144 | $dumpId = $dumpMetaInformation->getDumpId(); |
| 145 | - $importDate = $this->getLanguage()->timeanddate( $dumpMetaInformation->getImportDate() ); |
|
| 145 | + $importDate = $this->getLanguage()->timeanddate($dumpMetaInformation->getImportDate()); |
|
| 146 | 146 | $language = Language::fetchLanguageName( |
| 147 | 147 | $dumpMetaInformation->getLanguageCode(), |
| 148 | 148 | $this->getLanguage()->getCode() |
@@ -151,23 +151,23 @@ discard block |
||
| 151 | 151 | $dumpMetaInformation->getSourceUrl(), |
| 152 | 152 | $dumpMetaInformation->getSourceUrl() |
| 153 | 153 | ); |
| 154 | - $size = $this->getLanguage()->formatSize( $dumpMetaInformation->getSize() ); |
|
| 155 | - $license = $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformation->getLicenseItemId() ); |
|
| 154 | + $size = $this->getLanguage()->formatSize($dumpMetaInformation->getSize()); |
|
| 155 | + $license = $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformation->getLicenseItemId()); |
|
| 156 | 156 | $rows[] = [ |
| 157 | - new HtmlTableCellBuilder( $dumpId ), |
|
| 158 | - new HtmlTableCellBuilder( $importDate ), |
|
| 159 | - new HtmlTableCellBuilder( $language ), |
|
| 160 | - new HtmlTableCellBuilder( $sourceUrl, [], true ), |
|
| 161 | - new HtmlTableCellBuilder( $size ), |
|
| 162 | - new HtmlTableCellBuilder( $license, [], true ) |
|
| 157 | + new HtmlTableCellBuilder($dumpId), |
|
| 158 | + new HtmlTableCellBuilder($importDate), |
|
| 159 | + new HtmlTableCellBuilder($language), |
|
| 160 | + new HtmlTableCellBuilder($sourceUrl, [], true), |
|
| 161 | + new HtmlTableCellBuilder($size), |
|
| 162 | + new HtmlTableCellBuilder($license, [], true) |
|
| 163 | 163 | ]; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | array_unshift( |
| 167 | 167 | $rows[0], |
| 168 | 168 | new HtmlTableCellBuilder( |
| 169 | - $this->entityIdLinkFormatter->formatEntityId( $dumpMetaInformationGroup[0]->getSourceItemId() ), |
|
| 170 | - [ 'rowspan' => (string)count( $dumpMetaInformationGroup ) ], |
|
| 169 | + $this->entityIdLinkFormatter->formatEntityId($dumpMetaInformationGroup[0]->getSourceItemId()), |
|
| 170 | + ['rowspan' => (string)count($dumpMetaInformationGroup)], |
|
| 171 | 171 | true |
| 172 | 172 | ) |
| 173 | 173 | ); |
@@ -94,17 +94,17 @@ discard block |
||
| 94 | 94 | OutputFormatValueFormatterFactory $valueFormatterFactory, |
| 95 | 95 | CrossCheckInteractor $crossCheckInteractor |
| 96 | 96 | ) { |
| 97 | - parent::__construct( 'CrossCheck' ); |
|
| 97 | + parent::__construct('CrossCheck'); |
|
| 98 | 98 | |
| 99 | 99 | $this->entityLookup = $entityLookup; |
| 100 | 100 | $this->entityIdParser = $entityIdParser; |
| 101 | 101 | |
| 102 | 102 | $formatterOptions = new FormatterOptions(); |
| 103 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $this->getLanguage()->getCode() ); |
|
| 104 | - $this->dataValueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
| 103 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $this->getLanguage()->getCode()); |
|
| 104 | + $this->dataValueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
| 105 | 105 | |
| 106 | - $this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $this->getLanguage() ); |
|
| 107 | - $this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $this->getLanguage() ); |
|
| 106 | + $this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($this->getLanguage()); |
|
| 107 | + $this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($this->getLanguage()); |
|
| 108 | 108 | |
| 109 | 109 | $this->crossCheckInteractor = $crossCheckInteractor; |
| 110 | 110 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @return string (plain text) |
| 125 | 125 | */ |
| 126 | 126 | public function getDescription() { |
| 127 | - return $this->msg( 'wbqev-crosscheck' )->text(); |
|
| 127 | + return $this->msg('wbqev-crosscheck')->text(); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | /** |
@@ -136,55 +136,55 @@ discard block |
||
| 136 | 136 | * @throws EntityIdParsingException |
| 137 | 137 | * @throws UnexpectedValueException |
| 138 | 138 | */ |
| 139 | - public function execute( $subPage ) { |
|
| 139 | + public function execute($subPage) { |
|
| 140 | 140 | $out = $this->getOutput(); |
| 141 | - $postRequest = $this->getContext()->getRequest()->getVal( 'entityid' ); |
|
| 142 | - if ( $postRequest ) { |
|
| 143 | - $out->redirect( $this->getPageTitle( strtoupper( $postRequest ) )->getLocalURL() ); |
|
| 141 | + $postRequest = $this->getContext()->getRequest()->getVal('entityid'); |
|
| 142 | + if ($postRequest) { |
|
| 143 | + $out->redirect($this->getPageTitle(strtoupper($postRequest))->getLocalURL()); |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $out->addModules( 'SpecialCrossCheckPage' ); |
|
| 147 | + $out->addModules('SpecialCrossCheckPage'); |
|
| 148 | 148 | |
| 149 | 149 | $this->setHeaders(); |
| 150 | 150 | |
| 151 | - $out->addHTML( $this->buildInfoBox() ); |
|
| 151 | + $out->addHTML($this->buildInfoBox()); |
|
| 152 | 152 | $this->buildEntityIdForm(); |
| 153 | 153 | |
| 154 | - if ( $subPage ) { |
|
| 155 | - $this->buildResult( $subPage ); |
|
| 154 | + if ($subPage) { |
|
| 155 | + $this->buildResult($subPage); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | 160 | * @param string $idSerialization |
| 161 | 161 | */ |
| 162 | - private function buildResult( $idSerialization ) { |
|
| 162 | + private function buildResult($idSerialization) { |
|
| 163 | 163 | $out = $this->getOutput(); |
| 164 | 164 | |
| 165 | 165 | try { |
| 166 | - $entityId = $this->entityIdParser->parse( $idSerialization ); |
|
| 167 | - } catch ( EntityIdParsingException $ex ) { |
|
| 168 | - $out->addHTML( $this->buildNotice( 'wbqev-crosscheck-invalid-entity-id', true ) ); |
|
| 166 | + $entityId = $this->entityIdParser->parse($idSerialization); |
|
| 167 | + } catch (EntityIdParsingException $ex) { |
|
| 168 | + $out->addHTML($this->buildNotice('wbqev-crosscheck-invalid-entity-id', true)); |
|
| 169 | 169 | return; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $out->addHTML( $this->buildResultHeader( $entityId ) ); |
|
| 172 | + $out->addHTML($this->buildResultHeader($entityId)); |
|
| 173 | 173 | |
| 174 | - $entity = $this->entityLookup->getEntity( $entityId ); |
|
| 175 | - if ( $entity === null ) { |
|
| 176 | - $out->addHTML( $this->buildNotice( 'wbqev-crosscheck-not-existent-entity', true ) ); |
|
| 174 | + $entity = $this->entityLookup->getEntity($entityId); |
|
| 175 | + if ($entity === null) { |
|
| 176 | + $out->addHTML($this->buildNotice('wbqev-crosscheck-not-existent-entity', true)); |
|
| 177 | 177 | return; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $results = $this->getCrossCheckResultsFromEntity( $entity ); |
|
| 180 | + $results = $this->getCrossCheckResultsFromEntity($entity); |
|
| 181 | 181 | |
| 182 | - if ( $results === null || $results->toArray() === [] ) { |
|
| 183 | - $out->addHTML( $this->buildNotice( 'wbqev-crosscheck-empty-result' ) ); |
|
| 182 | + if ($results === null || $results->toArray() === []) { |
|
| 183 | + $out->addHTML($this->buildNotice('wbqev-crosscheck-empty-result')); |
|
| 184 | 184 | } else { |
| 185 | 185 | $out->addHTML( |
| 186 | - $this->buildSummary( $results ) |
|
| 187 | - . $this->buildResultTable( $results ) |
|
| 186 | + $this->buildSummary($results) |
|
| 187 | + . $this->buildResultTable($results) |
|
| 188 | 188 | ); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return CrossCheckResultList|null |
| 196 | 196 | */ |
| 197 | - private function getCrossCheckResultsFromEntity( EntityDocument $entity ) { |
|
| 198 | - if ( $entity instanceof StatementListProvider ) { |
|
| 199 | - return $this->crossCheckInteractor->crossCheckStatements( $entity->getStatements() ); |
|
| 197 | + private function getCrossCheckResultsFromEntity(EntityDocument $entity) { |
|
| 198 | + if ($entity instanceof StatementListProvider) { |
|
| 199 | + return $this->crossCheckInteractor->crossCheckStatements($entity->getStatements()); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | return null; |
@@ -213,15 +213,15 @@ discard block |
||
| 213 | 213 | 'name' => 'entityid', |
| 214 | 214 | 'label-message' => 'wbqev-crosscheck-form-entityid-label', |
| 215 | 215 | 'cssclass' => 'wbqev-crosscheck-form-entity-id', |
| 216 | - 'placeholder' => $this->msg( 'wbqev-crosscheck-form-entityid-placeholder' )->escaped() |
|
| 216 | + 'placeholder' => $this->msg('wbqev-crosscheck-form-entityid-placeholder')->escaped() |
|
| 217 | 217 | ] |
| 218 | 218 | ]; |
| 219 | - $htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'wbqev-crosscheck-form' ); |
|
| 220 | - $htmlForm->setSubmitText( $this->msg( 'wbqev-crosscheck-form-submit-label' )->escaped() ); |
|
| 221 | - $htmlForm->setSubmitCallback( function() { |
|
| 219 | + $htmlForm = new HTMLForm($formDescriptor, $this->getContext(), 'wbqev-crosscheck-form'); |
|
| 220 | + $htmlForm->setSubmitText($this->msg('wbqev-crosscheck-form-submit-label')->escaped()); |
|
| 221 | + $htmlForm->setSubmitCallback(function() { |
|
| 222 | 222 | return false; |
| 223 | 223 | } ); |
| 224 | - $htmlForm->setMethod( 'post' ); |
|
| 224 | + $htmlForm->setMethod('post'); |
|
| 225 | 225 | $htmlForm->show(); |
| 226 | 226 | } |
| 227 | 227 | |
@@ -231,18 +231,18 @@ discard block |
||
| 231 | 231 | * @return string HTML |
| 232 | 232 | */ |
| 233 | 233 | private function buildInfoBox() { |
| 234 | - $externalDbLink = Linker::specialLink( 'ExternalDatabases', 'wbqev-externaldbs' ); |
|
| 234 | + $externalDbLink = Linker::specialLink('ExternalDatabases', 'wbqev-externaldbs'); |
|
| 235 | 235 | $infoBox = |
| 236 | 236 | Html::openElement( |
| 237 | 237 | 'div', |
| 238 | - [ 'class' => 'wbqev-infobox' ] |
|
| 238 | + ['class' => 'wbqev-infobox'] |
|
| 239 | 239 | ) |
| 240 | - . $this->msg( 'wbqev-crosscheck-explanation-general' )->parse() |
|
| 241 | - . sprintf( ' %s.', $externalDbLink ) |
|
| 242 | - . Html::element( 'br' ) |
|
| 243 | - . Html::element( 'br' ) |
|
| 244 | - . $this->msg( 'wbqev-crosscheck-explanation-detail' )->parse() |
|
| 245 | - . Html::closeElement( 'div' ); |
|
| 240 | + . $this->msg('wbqev-crosscheck-explanation-general')->parse() |
|
| 241 | + . sprintf(' %s.', $externalDbLink) |
|
| 242 | + . Html::element('br') |
|
| 243 | + . Html::element('br') |
|
| 244 | + . $this->msg('wbqev-crosscheck-explanation-detail')->parse() |
|
| 245 | + . Html::closeElement('div'); |
|
| 246 | 246 | |
| 247 | 247 | return $infoBox; |
| 248 | 248 | } |
@@ -257,16 +257,16 @@ discard block |
||
| 257 | 257 | * |
| 258 | 258 | * @return string HTML |
| 259 | 259 | */ |
| 260 | - private function buildNotice( $messageKey, $error = false ) { |
|
| 260 | + private function buildNotice($messageKey, $error = false) { |
|
| 261 | 261 | $cssClasses = 'wbqev-crosscheck-notice'; |
| 262 | - if ( $error ) { |
|
| 262 | + if ($error) { |
|
| 263 | 263 | $cssClasses .= ' wbqev-crosscheck-notice-error'; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | return Html::element( |
| 267 | 267 | 'p', |
| 268 | - [ 'class' => $cssClasses ], |
|
| 269 | - $this->msg( $messageKey )->text() |
|
| 268 | + ['class' => $cssClasses], |
|
| 269 | + $this->msg($messageKey)->text() |
|
| 270 | 270 | ); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -277,17 +277,17 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return string HTML |
| 279 | 279 | */ |
| 280 | - private function buildResultHeader( EntityId $entityId ) { |
|
| 280 | + private function buildResultHeader(EntityId $entityId) { |
|
| 281 | 281 | $entityLink = sprintf( |
| 282 | 282 | '%s (%s)', |
| 283 | - $this->entityIdLinkFormatter->formatEntityId( $entityId ), |
|
| 284 | - htmlspecialchars( $entityId->getSerialization() ) |
|
| 283 | + $this->entityIdLinkFormatter->formatEntityId($entityId), |
|
| 284 | + htmlspecialchars($entityId->getSerialization()) |
|
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | 287 | return Html::rawElement( |
| 288 | 288 | 'h3', |
| 289 | 289 | [], |
| 290 | - sprintf( '%s %s', $this->msg( 'wbqev-crosscheck-result-headline' )->escaped(), $entityLink ) |
|
| 290 | + sprintf('%s %s', $this->msg('wbqev-crosscheck-result-headline')->escaped(), $entityLink) |
|
| 291 | 291 | ); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -298,11 +298,11 @@ discard block |
||
| 298 | 298 | * |
| 299 | 299 | * @return string HTML |
| 300 | 300 | */ |
| 301 | - private function buildSummary( $results ) { |
|
| 301 | + private function buildSummary($results) { |
|
| 302 | 302 | $statuses = []; |
| 303 | - foreach ( $results as $result ) { |
|
| 304 | - $status = strtolower( $result->getComparisonResult()->getStatus() ); |
|
| 305 | - if ( array_key_exists( $status, $statuses ) ) { |
|
| 303 | + foreach ($results as $result) { |
|
| 304 | + $status = strtolower($result->getComparisonResult()->getStatus()); |
|
| 305 | + if (array_key_exists($status, $statuses)) { |
|
| 306 | 306 | $statuses[$status]++; |
| 307 | 307 | } else { |
| 308 | 308 | $statuses[$status] = 1; |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $statusElements = []; |
| 313 | - foreach ( $statuses as $status => $count ) { |
|
| 314 | - if ( $count > 0 ) { |
|
| 315 | - $statusElements[] = $this->formatStatus( $status ) . ': ' . $count; |
|
| 313 | + foreach ($statuses as $status => $count) { |
|
| 314 | + if ($count > 0) { |
|
| 315 | + $statusElements[] = $this->formatStatus($status).': '.$count; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | $summary = |
| 319 | - Html::openElement( 'p' ) |
|
| 320 | - . implode( ', ', $statusElements ) |
|
| 321 | - . Html::closeElement( 'p' ); |
|
| 319 | + Html::openElement('p') |
|
| 320 | + . implode(', ', $statusElements) |
|
| 321 | + . Html::closeElement('p'); |
|
| 322 | 322 | |
| 323 | 323 | return $summary; |
| 324 | 324 | } |
@@ -332,16 +332,16 @@ discard block |
||
| 332 | 332 | * |
| 333 | 333 | * @return string HTML |
| 334 | 334 | */ |
| 335 | - private function formatStatus( $status ) { |
|
| 336 | - $messageKey = 'wbqev-crosscheck-status-' . strtolower( $status ); |
|
| 335 | + private function formatStatus($status) { |
|
| 336 | + $messageKey = 'wbqev-crosscheck-status-'.strtolower($status); |
|
| 337 | 337 | |
| 338 | 338 | $formattedStatus = |
| 339 | 339 | Html::element( |
| 340 | 340 | 'span', |
| 341 | 341 | [ |
| 342 | - 'class' => 'wbqev-status wbqev-status-' . $status |
|
| 342 | + 'class' => 'wbqev-status wbqev-status-'.$status |
|
| 343 | 343 | ], |
| 344 | - $this->msg( $messageKey )->text() |
|
| 344 | + $this->msg($messageKey)->text() |
|
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | 347 | return $formattedStatus; |
@@ -358,29 +358,29 @@ discard block |
||
| 358 | 358 | * |
| 359 | 359 | * @return string HTML |
| 360 | 360 | */ |
| 361 | - private function formatDataValues( $dataValues, $linking = true, $separator = null ) { |
|
| 362 | - if ( $dataValues instanceof DataValue ) { |
|
| 363 | - $dataValues = [ $dataValues ]; |
|
| 361 | + private function formatDataValues($dataValues, $linking = true, $separator = null) { |
|
| 362 | + if ($dataValues instanceof DataValue) { |
|
| 363 | + $dataValues = [$dataValues]; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | $formattedDataValues = []; |
| 367 | - foreach ( $dataValues as $dataValue ) { |
|
| 368 | - if ( $dataValue instanceof EntityIdValue ) { |
|
| 369 | - if ( $linking ) { |
|
| 370 | - $formattedDataValues[] = $this->entityIdLinkFormatter->formatEntityId( $dataValue->getEntityId() ); |
|
| 367 | + foreach ($dataValues as $dataValue) { |
|
| 368 | + if ($dataValue instanceof EntityIdValue) { |
|
| 369 | + if ($linking) { |
|
| 370 | + $formattedDataValues[] = $this->entityIdLinkFormatter->formatEntityId($dataValue->getEntityId()); |
|
| 371 | 371 | } else { |
| 372 | - $formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId( $dataValue->getEntityId() ); |
|
| 372 | + $formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId($dataValue->getEntityId()); |
|
| 373 | 373 | } |
| 374 | 374 | } else { |
| 375 | - $formattedDataValues[] = $this->dataValueFormatter->format( $dataValue ); |
|
| 375 | + $formattedDataValues[] = $this->dataValueFormatter->format($dataValue); |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( $separator ) { |
|
| 380 | - return implode( $separator, $formattedDataValues ); |
|
| 379 | + if ($separator) { |
|
| 380 | + return implode($separator, $formattedDataValues); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - return $this->getLanguage()->commaList( $formattedDataValues ); |
|
| 383 | + return $this->getLanguage()->commaList($formattedDataValues); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -388,31 +388,31 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @return string HTML |
| 390 | 390 | */ |
| 391 | - private function buildResultTable( $results ) { |
|
| 391 | + private function buildResultTable($results) { |
|
| 392 | 392 | $table = new HtmlTableBuilder( |
| 393 | 393 | [ |
| 394 | 394 | new HtmlTableHeaderBuilder( |
| 395 | - $this->msg( 'wbqev-crosscheck-result-table-header-status' )->escaped(), |
|
| 395 | + $this->msg('wbqev-crosscheck-result-table-header-status')->escaped(), |
|
| 396 | 396 | true |
| 397 | 397 | ), |
| 398 | 398 | new HtmlTableHeaderBuilder( |
| 399 | - $this->msg( 'datatypes-type-wikibase-property' )->escaped(), |
|
| 399 | + $this->msg('datatypes-type-wikibase-property')->escaped(), |
|
| 400 | 400 | true |
| 401 | 401 | ), |
| 402 | 402 | new HtmlTableHeaderBuilder( |
| 403 | - $this->msg( 'wbqev-crosscheck-result-table-header-local-value' )->escaped() |
|
| 403 | + $this->msg('wbqev-crosscheck-result-table-header-local-value')->escaped() |
|
| 404 | 404 | ), |
| 405 | 405 | new HtmlTableHeaderBuilder( |
| 406 | - $this->msg( 'wbqev-crosscheck-result-table-header-external-value' )->escaped() |
|
| 406 | + $this->msg('wbqev-crosscheck-result-table-header-external-value')->escaped() |
|
| 407 | 407 | ), |
| 408 | 408 | new HtmlTableHeaderBuilder( |
| 409 | - $this->msg( 'wbqev-crosscheck-result-table-header-references' )->escaped(), |
|
| 409 | + $this->msg('wbqev-crosscheck-result-table-header-references')->escaped(), |
|
| 410 | 410 | true |
| 411 | 411 | ), |
| 412 | 412 | new HtmlTableHeaderBuilder( |
| 413 | 413 | Linker::linkKnown( |
| 414 | - self::getTitleFor( 'ExternalDatabases' ), |
|
| 415 | - $this->msg( 'wbqev-crosscheck-result-table-header-external-source' )->escaped() |
|
| 414 | + self::getTitleFor('ExternalDatabases'), |
|
| 415 | + $this->msg('wbqev-crosscheck-result-table-header-external-source')->escaped() |
|
| 416 | 416 | ), |
| 417 | 417 | true, |
| 418 | 418 | true |
@@ -421,28 +421,28 @@ discard block |
||
| 421 | 421 | true |
| 422 | 422 | ); |
| 423 | 423 | |
| 424 | - foreach ( $results as $result ) { |
|
| 425 | - $status = $this->formatStatus( $result->getComparisonResult()->getStatus() ); |
|
| 426 | - $propertyId = $this->entityIdLinkFormatter->formatEntityId( $result->getPropertyId() ); |
|
| 427 | - $localValue = $this->formatDataValues( $result->getComparisonResult()->getLocalValue() ); |
|
| 424 | + foreach ($results as $result) { |
|
| 425 | + $status = $this->formatStatus($result->getComparisonResult()->getStatus()); |
|
| 426 | + $propertyId = $this->entityIdLinkFormatter->formatEntityId($result->getPropertyId()); |
|
| 427 | + $localValue = $this->formatDataValues($result->getComparisonResult()->getLocalValue()); |
|
| 428 | 428 | $externalValue = $this->formatDataValues( |
| 429 | 429 | $result->getComparisonResult()->getExternalValues(), |
| 430 | 430 | true, |
| 431 | - Html::element( 'br' ) |
|
| 431 | + Html::element('br') |
|
| 432 | 432 | ); |
| 433 | 433 | $referenceStatus = $this->msg( |
| 434 | - 'wbqev-crosscheck-status-' . $result->getReferenceResult()->getStatus() |
|
| 434 | + 'wbqev-crosscheck-status-'.$result->getReferenceResult()->getStatus() |
|
| 435 | 435 | )->text(); |
| 436 | - $dataSource = $this->entityIdLinkFormatter->formatEntityId( $result->getDumpMetaInformation()->getSourceItemId() ); |
|
| 436 | + $dataSource = $this->entityIdLinkFormatter->formatEntityId($result->getDumpMetaInformation()->getSourceItemId()); |
|
| 437 | 437 | |
| 438 | 438 | $table->appendRow( |
| 439 | 439 | [ |
| 440 | - new HtmlTableCellBuilder( $status, [], true ), |
|
| 441 | - new HtmlTableCellBuilder( $propertyId, [], true ), |
|
| 442 | - new HtmlTableCellBuilder( $localValue, [], true ), |
|
| 443 | - new HtmlTableCellBuilder( $externalValue, [], true ), |
|
| 444 | - new HtmlTableCellBuilder( $referenceStatus, [] ), |
|
| 445 | - new HtmlTableCellBuilder( $dataSource, [], true ) |
|
| 440 | + new HtmlTableCellBuilder($status, [], true), |
|
| 441 | + new HtmlTableCellBuilder($propertyId, [], true), |
|
| 442 | + new HtmlTableCellBuilder($localValue, [], true), |
|
| 443 | + new HtmlTableCellBuilder($externalValue, [], true), |
|
| 444 | + new HtmlTableCellBuilder($referenceStatus, []), |
|
| 445 | + new HtmlTableCellBuilder($dataSource, [], true) |
|
| 446 | 446 | ] |
| 447 | 447 | ); |
| 448 | 448 | } |