Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231524

Change subject: Fix phpcs issue in SpecialViolationsPage
......................................................................

Fix phpcs issue in SpecialViolationsPage

Change-Id: I34989c8a9cb2ed2b720723f8115f57dccf99692b
---
M specials/SpecialViolationsPage.php
1 file changed, 62 insertions(+), 19 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQuality 
refs/changes/24/231524/1

diff --git a/specials/SpecialViolationsPage.php 
b/specials/SpecialViolationsPage.php
index eb9eab1..26d0cef 100644
--- a/specials/SpecialViolationsPage.php
+++ b/specials/SpecialViolationsPage.php
@@ -161,11 +161,18 @@
 
                $formatterOptions = new FormatterOptions();
                $formatterOptions->setOption( SnakFormatter::OPT_LANG, 
$this->getLanguage()->getCode() );
-               $this->dataValueFormatter = 
$valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, 
$formatterOptions );
+               $this->dataValueFormatter =
+                       $valueFormatterFactory->getValueFormatter(
+                               SnakFormatter::FORMAT_HTML,
+                               $formatterOptions
+                       );
 
-               $labelLookup = new LanguageLabelDescriptionLookup( $termLookup, 
$this->getLanguage()->getCode() );
-               $this->entityIdLabelFormatter = 
$entityIdLabelFormatterFactory->getEntityIdFormater( $labelLookup );
-               $this->entityIdLinkFormatter = 
$entityIdHtmlLinkFormatterFactory->getEntityIdFormater( $labelLookup );
+               $labelLookup =
+                       new LanguageLabelDescriptionLookup( $termLookup, 
$this->getLanguage()->getCode() );
+               $this->entityIdLabelFormatter =
+                       $entityIdLabelFormatterFactory->getEntityIdFormater( 
$labelLookup );
+               $this->entityIdLinkFormatter =
+                       $entityIdHtmlLinkFormatterFactory->getEntityIdFormater( 
$labelLookup );
        }
 
        /**
@@ -197,7 +204,13 @@
                list( $violations, $prevPageAvailable, $nextPageAvailable ) = 
$this->getViolations();
                if ( count( $violations ) > 0 ) {
                        $out->addHTML( $this->buildViolationTable( $violations 
) );
-                       $out->addHTML( $this->buildPaginationControls( 
$violations, $prevPageAvailable, $nextPageAvailable ) );
+                       $out->addHTML(
+                               $this->buildPaginationControls(
+                                       $violations,
+                                       $prevPageAvailable,
+                                       $nextPageAvailable
+                               )
+                       );
                }
        }
 
@@ -228,7 +241,11 @@
 
                $output = Html::openElement( 'div', array( 'class' => 
'wbq-violations-filter' ) );
                $output .= Html::openElement( 'fieldset' );
-               $output .= Html::element( 'legend', array(), $this->msg( 
'wbq-violatons-filter-headline' )->text() );
+               $output .= Html::element(
+                       'legend',
+                       array(),
+                       $this->msg( 'wbq-violatons-filter-headline' )->text()
+               );
 
                $output .= Html::openElement(
                        'form',
@@ -412,7 +429,8 @@
        private function getGroups() {
                $groups = array();
                foreach ( $this->subExtensionIds as $subExtensionId ) {
-                       $groups[$subExtensionId] = $this->msg( sprintf( 
'wbq-subextension-name-%s', $subExtensionId ) )->text();
+                       $groups[$subExtensionId] =
+                               $this->msg( sprintf( 
'wbq-subextension-name-%s', $subExtensionId ) )->text();
                }
 
                return $groups;
@@ -558,19 +576,32 @@
        private function buildViolationTable( array $violations ) {
                $table = new HtmlTableBuilder(
                        array(
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-entity' )->text() ),
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-claim' )->text() ),
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-constraint-type' )->text() ),
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-status' )->text() ),
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-updated-at' )->text() ),
-                               new HtmlTableHeaderBuilder( $this->msg( 
'wbq-violations-table-header-additional-info' )->text() )
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-entity' )->text()
+                               ),
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-claim' )->text()
+                               ),
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-constraint-type' )->text()
+                               ),
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-status' )->text()
+                               ),
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-updated-at' )->text()
+                               ),
+                               new HtmlTableHeaderBuilder(
+                                       $this->msg( 
'wbq-violations-table-header-additional-info' )->text()
+                               ),
                        )
                );
 
                foreach ( $violations as $violation ) {
                        $entity = $this->entityIdLinkFormatter->formatEntityId( 
$violation->getEntityId() );
                        $claim = $this->formatClaimGuid( 
$violation->getEntityId(), $violation->getClaimGuid() );
-                       $type = $violation->getConstraintTypeEntityId(); // 
TODO better format when format of type is clear
+                       // TODO better format when format of type is clear
+                       $type = $violation->getConstraintTypeEntityId();
                        $status = $this->formatStatus( $violation );
                        $updatedAt = $this->getLanguage()->date( 
$violation->getUpdatedAt(), true );
                        try {
@@ -641,9 +672,11 @@
 
        /**
         * Returns message for the status of a violation.
-        * Additionally, if the current user is permitted, a link for marking 
the violation as exception/violation is appended.
+        * Additionally, if the current user is permitted, a link for marking 
the violation as
+        * exception/violation is appended.
         *
         * @param Violation $violation
+        *
         * @return string HTML
         */
        private function formatStatus( Violation $violation ) {
@@ -659,8 +692,8 @@
                        'wikibase-violation-exception',
                        $violation->getEntityId()
                );
-               if( $permission->isOK() ) {
-                       if( $violation->getStatus() === 
Violation::STATUS_VIOLATION ) {
+               if ( $permission->isOK() ) {
+                       if ( $violation->getStatus() === 
Violation::STATUS_VIOLATION ) {
                                $status = 'violation';
                                $linkContent = $this->msg( 
'wbq-violations-mark-as-exception' )->text();
                        }
@@ -711,9 +744,14 @@
         * @param Violation[] $violations
         * @param bool $prevPageAvailable
         * @param bool $nextPageAvailable
+        *
         * @return string HTML
         */
-       private function buildPaginationControls( array $violations, 
$prevPageAvailable, $nextPageAvailable ) {
+       private function buildPaginationControls(
+               array $violations,
+               $prevPageAvailable,
+               $nextPageAvailable
+       ) {
                $html = Html::openElement( 'p', array( 'class' => 
'wbq-violations-pagination' ) );
 
                if ( $prevPageAvailable ) {
@@ -754,9 +792,14 @@
         * @param string $contentMessage
         * @param array $additionalQuery
         * @param array $customAttribs
+        *
         * @return string HTML
         */
-       private function buildPaginationLink( $contentMessage, array 
$additionalQuery, array $customAttribs = array() ) {
+       private function buildPaginationLink(
+               $contentMessage,
+               array $additionalQuery,
+               array $customAttribs = array()
+       ) {
                $query = $this->getRequest()->getQueryValues();
                $query = array_merge( $query, $additionalQuery );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/231524
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34989c8a9cb2ed2b720723f8115f57dccf99692b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQuality
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to