Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364300 )

Change subject: Break long lines
......................................................................

Break long lines

Change-Id: Iaf56c84be20674955b014f702d799caaa0db82e9
---
M includes/api/ApiCrossWikiBase.php
M includes/api/ApiEchoMarkRead.php
M includes/api/ApiEchoMarkSeen.php
M includes/api/ApiEchoNotifications.php
M includes/api/ApiEchoUnreadNotificationPages.php
M includes/controller/NotificationController.php
M includes/gateway/UserNotificationGateway.php
M includes/mapper/EventMapper.php
M includes/mapper/NotificationMapper.php
M includes/model/Event.php
M includes/special/NotificationPager.php
M includes/special/SpecialDisplayNotificationsConfiguration.php
M includes/special/SpecialNotifications.php
13 files changed, 317 insertions(+), 95 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/00/364300/1

diff --git a/includes/api/ApiCrossWikiBase.php 
b/includes/api/ApiCrossWikiBase.php
index b9184da..ce5ca39 100644
--- a/includes/api/ApiCrossWikiBase.php
+++ b/includes/api/ApiCrossWikiBase.php
@@ -23,7 +23,8 @@
         * This will turn the current API call (with all of it's params) and 
execute
         * it on all foreign wikis, returning an array of results per wiki.
         *
-        * @param array $wikis List of wikis to query. Defaults to the result 
of getRequestedForeignWikis().
+        * @param array $wikis List of wikis to query.
+        *   Defaults to the result of getRequestedForeignWikis().
         * @param array $paramOverrides Request parameter overrides
         * @return array
         * @throws Exception
@@ -116,7 +117,9 @@
                                        ApiBase::PARAM_DFLT => wfWikiID(),
                                        // `*` will let you immediately fetch 
from all wikis that have
                                        // unread notifications, without having 
to look them up first
-                                       ApiBase::PARAM_TYPE => array_unique( 
array_merge( $wgConf->wikis, [ wfWikiID(), '*' ] ) ),
+                                       ApiBase::PARAM_TYPE => array_unique( 
array_merge(
+                                               $wgConf->wikis, [ wfWikiID(), 
'*' ]
+                                       ) ),
                                ],
                        ];
                }
diff --git a/includes/api/ApiEchoMarkRead.php b/includes/api/ApiEchoMarkRead.php
index 551c183..b7e46c9 100644
--- a/includes/api/ApiEchoMarkRead.php
+++ b/includes/api/ApiEchoMarkRead.php
@@ -40,9 +40,12 @@
                ];
                $rawCount = 0;
                foreach ( EchoAttributeManager::$sections as $section ) {
-                       $rawSectionCount = $notifUser->getNotificationCount( /* 
$tryCache = */true, DB_SLAVE, $section );
+                       $rawSectionCount = $notifUser->getNotificationCount(
+                               /* $tryCache = */true, DB_SLAVE, $section
+                       );
                        $result[$section]['rawcount'] = $rawSectionCount;
-                       $result[$section]['count'] = 
EchoNotificationController::formatNotificationCount( $rawSectionCount );
+                       $result[$section]['count'] =
+                               
EchoNotificationController::formatNotificationCount( $rawSectionCount );
                        $rawCount += $rawSectionCount;
                }
 
diff --git a/includes/api/ApiEchoMarkSeen.php b/includes/api/ApiEchoMarkSeen.php
index d06852a..f95609c 100644
--- a/includes/api/ApiEchoMarkSeen.php
+++ b/includes/api/ApiEchoMarkSeen.php
@@ -20,7 +20,9 @@
                        $outputTimestamp = wfTimestamp( TS_ISO_8601, $timestamp 
);
                } else {
                        // MW
-                       $this->addDeprecation( 
'apiwarn-echo-deprecation-timestampformat', 
'action=echomarkseen&timestampFormat=MW' );
+                       $this->addDeprecation(
+                               'apiwarn-echo-deprecation-timestampformat', 
'action=echomarkseen&timestampFormat=MW'
+                       );
 
                        $outputTimestamp = $timestamp;
                }
diff --git a/includes/api/ApiEchoNotifications.php 
b/includes/api/ApiEchoNotifications.php
index e8f4797..f96f2f5 100644
--- a/includes/api/ApiEchoNotifications.php
+++ b/includes/api/ApiEchoNotifications.php
@@ -22,9 +22,14 @@
 
                /* @deprecated */
                if ( $params['format'] === 'flyout' ) {
-                       $this->addDeprecation( 
'apiwarn-echo-deprecation-flyout', 
'action=query&meta=notifications&notformat=flyout' );
+                       $this->addDeprecation(
+                               'apiwarn-echo-deprecation-flyout',
+                               
'action=query&meta=notifications&notformat=flyout'
+                       );
                } elseif ( $params['format'] === 'html' ) {
-                       $this->addDeprecation( 'apiwarn-echo-deprecation-html', 
'action=query&meta=notifications&notformat=html' );
+                       $this->addDeprecation(
+                               'apiwarn-echo-deprecation-html', 
'action=query&meta=notifications&notformat=html'
+                       );
                }
 
                if ( $this->allowCrossWikiNotifications() ) {
@@ -50,7 +55,9 @@
                if ( $params['groupbysection'] ) {
                        foreach ( $params['sections'] as $section ) {
                                if ( in_array( 'list', $params['prop'] ) ) {
-                                       $this->getResult()->setIndexedTagName( 
$result[$section]['list'], 'notification' );
+                                       $this->getResult()->setIndexedTagName(
+                                               $result[$section]['list'], 
'notification'
+                                       );
                                }
                        }
                } else {
@@ -70,7 +77,9 @@
                $prop = $params['prop'];
                $titles = null;
                if ( $params['titles'] ) {
-                       $titles = array_values( array_filter( array_map( 
'Title::newFromText', $params['titles'] ) ) );
+                       $titles = array_values( array_filter( array_map(
+                               'Title::newFromText', $params['titles']
+                       ) ) );
                        if ( in_array( '[]', $params['titles'] ) ) {
                                $titles[] = null;
                        }
@@ -89,7 +98,9 @@
 
                                        if ( $this->crossWikiSummary ) {
                                                // insert fake notification for 
foreign notifications
-                                               $foreignNotification = 
$this->makeForeignNotification( $user, $params['format'], $section );
+                                               $foreignNotification = 
$this->makeForeignNotification(
+                                                       $user, 
$params['format'], $section
+                                               );
                                                if ( $foreignNotification ) {
                                                        array_unshift( 
$result[$section]['list'], $foreignNotification );
                                                }
@@ -99,16 +110,22 @@
                                $attributeManager = 
EchoAttributeManager::newFromGlobalVars();
                                $result = $this->getPropList(
                                        $user,
-                                       
$attributeManager->getUserEnabledEventsbySections( $user, 'web', 
$params['sections'] ),
+                                       
$attributeManager->getUserEnabledEventsbySections(
+                                               $user, 'web', 
$params['sections']
+                                       ),
                                        $params['filter'], $params['limit'], 
$params['continue'], $params['format'],
                                        $titles, $params['unreadfirst'], 
$params['bundle']
                                );
 
                                // if exactly 1 section is specified, we 
consider only that section, otherwise
                                // we pass ALL to consider all foreign 
notifications
-                               $section = count( $params['sections'] ) === 1 ? 
reset( $params['sections'] ) : EchoAttributeManager::ALL;
+                               $section = count( $params['sections'] ) === 1
+                                       ? reset( $params['sections'] )
+                                       : EchoAttributeManager::ALL;
                                if ( $this->crossWikiSummary ) {
-                                       $foreignNotification = 
$this->makeForeignNotification( $user, $params['format'], $section );
+                                       $foreignNotification = 
$this->makeForeignNotification(
+                                               $user, $params['format'], 
$section
+                                       );
                                        if ( $foreignNotification ) {
                                                array_unshift( $result['list'], 
$foreignNotification );
                                        }
@@ -146,9 +163,21 @@
         * @param bool $bundle
         * @return array
         */
-       protected function getSectionPropList( User $user, $section, $filter, 
$limit, $continue, $format, array $titles = null, $unreadFirst = false, $bundle 
= false ) {
+       protected function getSectionPropList(
+               User $user,
+               $section,
+               $filter,
+               $limit,
+               $continue,
+               $format,
+               array $titles = null,
+               $unreadFirst = false,
+               $bundle = false
+       ) {
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
-               $sectionEvents = 
$attributeManager->getUserEnabledEventsbySections( $user, 'web', [ $section ] );
+               $sectionEvents = 
$attributeManager->getUserEnabledEventsbySections(
+                       $user, 'web', [ $section ]
+               );
 
                if ( !$sectionEvents ) {
                        $result = [
@@ -157,7 +186,15 @@
                        ];
                } else {
                        $result = $this->getPropList(
-                               $user, $sectionEvents, $filter, $limit, 
$continue, $format, $titles, $unreadFirst, $bundle
+                               $user,
+                               $sectionEvents,
+                               $filter,
+                               $limit,
+                               $continue,
+                               $format,
+                               $titles,
+                               $unreadFirst,
+                               $bundle
                        );
                }
 
@@ -179,7 +216,17 @@
         * @param bool $bundle
         * @return array
         */
-       protected function getPropList( User $user, array $eventTypes, $filter, 
$limit, $continue, $format, array $titles = null, $unreadFirst = false, $bundle 
= false ) {
+       protected function getPropList(
+               User $user,
+               array $eventTypes,
+               $filter,
+               $limit,
+               $continue,
+               $format,
+               array $titles = null,
+               $unreadFirst = false,
+               $bundle = false
+       ) {
                $result = [
                        'list' => [],
                        'continue' => null
@@ -192,7 +239,9 @@
                        // Prefer unread notifications. We don't care about 
next offset in this case
                        if ( $unreadFirst ) {
                                // query for unread notifications past 
'continue' (offset)
-                               $notifs = $notifMapper->fetchUnreadByUser( 
$user, $limit + 1, $continue, $eventTypes, $titles );
+                               $notifs = $notifMapper->fetchUnreadByUser(
+                                       $user, $limit + 1, $continue, 
$eventTypes, $titles
+                               );
 
                                /*
                                 * 'continue' has a timestamp & id (to start 
with, in case
@@ -224,8 +273,8 @@
                                $count = count( $notifs );
                                // we need 1 more than $limit, so we can 
respond 'continue'
                                if ( $count <= $limit ) {
-                                       // Query planner should be smart enough 
that passing a short list of ids to exclude
-                                       // will only visit at most that number 
of extra rows.
+                                       // Query planner should be smart enough 
that passing a short list of ids to
+                                       // exclude will only visit at most that 
number of extra rows.
                                        $mixedNotifs = 
$notifMapper->fetchByUser(
                                                $user,
                                                $limit - $count + 1,
@@ -242,12 +291,18 @@
                                        }
                                }
                        } else {
-                               $notifs = $notifMapper->fetchByUser( $user, 
$limit + 1, $continue, $eventTypes, [], $titles );
+                               $notifs = $notifMapper->fetchByUser(
+                                       $user, $limit + 1, $continue, 
$eventTypes, [], $titles
+                               );
                        }
                } elseif ( in_array( 'read', $filter ) ) {
-                       $notifs = $notifMapper->fetchReadByUser( $user, $limit 
+ 1, $continue, $eventTypes, $titles );
+                       $notifs = $notifMapper->fetchReadByUser(
+                               $user, $limit + 1, $continue, $eventTypes, 
$titles
+                       );
                } else { // = if ( in_array( '!read', $filter ) ) {
-                       $notifs = $notifMapper->fetchUnreadByUser( $user, 
$limit + 1, $continue, $eventTypes, $titles );
+                       $notifs = $notifMapper->fetchUnreadByUser(
+                               $user, $limit + 1, $continue, $eventTypes, 
$titles
+                       );
                }
 
                // get $overfetchedItem before bundling and rendering so that 
it is not affected by filtering
@@ -262,13 +317,17 @@
                while ( count( $notifs ) ) {
                        /** @var EchoNotification $notif */
                        $notif = array_shift( $notifs );
-                       $output = EchoDataOutputFormatter::formatOutput( 
$notif, $format, $user, $this->getLanguage() );
+                       $output = EchoDataOutputFormatter::formatOutput(
+                               $notif, $format, $user, $this->getLanguage()
+                       );
                        if ( $output !== false ) {
                                $result['list'][] = $output;
                        } elseif ( $bundle && $notif->getBundledNotifications() 
) {
                                // when the bundle_base gets filtered out, 
bundled notifications
                                // have to be re-bundled and formatted
-                               $notifs = array_merge( $bundler->bundle( 
$notif->getBundledNotifications() ), $notifs );
+                               $notifs = array_merge(
+                                       $bundler->bundle( 
$notif->getBundledNotifications() ), $notifs
+                               );
                        }
                }
 
@@ -297,10 +356,13 @@
 
                $totalRawCount = 0;
                foreach ( $sections as $section ) {
-                       $rawCount = $notifUser->getNotificationCount( /* 
$tryCache = */true, DB_SLAVE, $section, $global );
+                       $rawCount = $notifUser->getNotificationCount(
+                               /* $tryCache = */true, DB_SLAVE, $section, 
$global
+                       );
                        if ( $groupBySection ) {
                                $result[$section]['rawcount'] = $rawCount;
-                               $result[$section]['count'] = 
EchoNotificationController::formatNotificationCount( $rawCount );
+                               $result[$section]['count'] =
+                                       
EchoNotificationController::formatNotificationCount( $rawCount );
                        }
                        $totalRawCount += $rawCount;
                }
@@ -342,23 +404,29 @@
         * @param string $section
         * @return array|false A formatted notification, or false if there are 
no foreign notifications
         */
-       protected function makeForeignNotification( User $user, $format, 
$section = EchoAttributeManager::ALL ) {
+       protected function makeForeignNotification(
+               User $user, $format, $section = EchoAttributeManager::ALL
+       ) {
                global $wgEchoSectionTransition, $wgEchoBundleTransition;
                if (
                        ( $wgEchoSectionTransition && $section !== 
EchoAttributeManager::ALL ) ||
                        $wgEchoBundleTransition
                ) {
-                       // In section transition mode we trust that 
echo_unread_wikis is accurate for the total of alerts+messages,
-                       // but not for each section individually (i.e. we don't 
trust that notifications won't be misclassified).
-                       // We get all wikis that have any notifications at all 
according to the euw table,
-                       // and query them to find out what's really there.
-                       // In bundle transition mode, we trust that 
notifications are classified correctly, but we don't
-                       // trust the counts in the table.
-                       $potentialWikis = 
$this->foreignNotifications->getWikis( $wgEchoSectionTransition ? 
EchoAttributeManager::ALL : $section );
+                       // In section transition mode we trust that 
echo_unread_wikis is accurate for the total
+                       // of alerts+messages, but not for each section 
individually (i.e. we don't trust that
+                       // notifications won't be misclassified). We get all 
wikis that have any notifications
+                       // at all according to the euw table, and query them to 
find out what's really there.
+                       // In bundle transition mode, we trust that 
notifications are classified correctly,
+                       // but we don't trust the counts in the table.
+                       $potentialWikis = $this->foreignNotifications->getWikis(
+                               $wgEchoSectionTransition ? 
EchoAttributeManager::ALL : $section
+                       );
                        if ( !$potentialWikis ) {
                                return false;
                        }
-                       $foreignResults = $this->getFromForeign( 
$potentialWikis, [ $this->getModulePrefix() . 'filter' => '!read' ] );
+                       $foreignResults = $this->getFromForeign(
+                               $potentialWikis, [ $this->getModulePrefix() . 
'filter' => '!read' ]
+                       );
 
                        $countsByWiki = [];
                        $timestampsByWiki = [];
@@ -368,7 +436,9 @@
                                        $countsByWiki[$wiki] = intval( 
$result['query']['notifications']['count'] );
                                } elseif ( isset( 
$result['query']['notifications'][$section]['list'] ) ) {
                                        $notifs = 
$result['query']['notifications'][$section]['list'];
-                                       $countsByWiki[$wiki] = intval( 
$result['query']['notifications'][$section]['count'] );
+                                       $countsByWiki[$wiki] = intval(
+                                               
$result['query']['notifications'][$section]['count']
+                                       );
                                } else {
                                        $notifs = false;
                                        $countsByWiki[$wiki] = 0;
@@ -394,7 +464,8 @@
                        $maxTimestamp = 
$this->foreignNotifications->getTimestamp( $section );
                        $timestampsByWiki = [];
                        foreach ( $wikis as $wiki ) {
-                               $timestampsByWiki[$wiki] = 
$this->foreignNotifications->getWikiTimestamp( $wiki, $section );
+                               $timestampsByWiki[$wiki] =
+                                       
$this->foreignNotifications->getWikiTimestamp( $wiki, $section );
                        }
                }
 
@@ -404,7 +475,8 @@
 
                // Sort wikis by timestamp, in descending order (newest first)
                usort( $wikis, function ( $a, $b ) use ( $section, 
$timestampsByWiki ) {
-                       return $timestampsByWiki[$b]->getTimestamp( TS_UNIX ) - 
$timestampsByWiki[$a]->getTimestamp( TS_UNIX );
+                       return $timestampsByWiki[$b]->getTimestamp( TS_UNIX ) -
+                               $timestampsByWiki[$a]->getTimestamp( TS_UNIX );
                } );
 
                $row = new StdClass;
@@ -432,7 +504,9 @@
 
                // Format output like any other notification
                $notif = EchoNotification::newFromRow( $row );
-               $output = EchoDataOutputFormatter::formatOutput( $notif, 
$format, $user, $this->getLanguage() );
+               $output = EchoDataOutputFormatter::formatOutput(
+                       $notif, $format, $user, $this->getLanguage()
+               );
 
                // Add cross-wiki-specific data
                $output['section'] = $section ?: 'all';
@@ -497,7 +571,9 @@
                                        $master[$section]['list'] = [];
                                }
                                foreach ( $results as $result ) {
-                                       $master[$section]['list'] = 
array_merge( $master[$section]['list'], $result[$section]['list'] );
+                                       $master[$section]['list'] = array_merge(
+                                               $master[$section]['list'], 
$result[$section]['list']
+                                       );
                                }
                                usort( $master[$section]['list'], $sort );
                        }
@@ -529,7 +605,9 @@
                                foreach ( $results as $result ) {
                                        $master[$section]['rawcount'] += 
$result[$section]['rawcount'];
                                }
-                               $master[$section]['count'] = 
EchoNotificationController::formatNotificationCount( 
$master[$section]['rawcount'] );
+                               $master[$section]['count'] = 
EchoNotificationController::formatNotificationCount(
+                                       $master[$section]['rawcount']
+                               );
                        }
                }
 
@@ -540,7 +618,9 @@
                        // regardless of groupbysection, totals are always 
included
                        $master['rawcount'] += $result['rawcount'];
                }
-               $master['count'] = 
EchoNotificationController::formatNotificationCount( $master['rawcount'] );
+               $master['count'] = 
EchoNotificationController::formatNotificationCount(
+                       $master['rawcount']
+               );
 
                return $master;
        }
@@ -636,8 +716,8 @@
                return [
                        'action=query&meta=notifications'
                                => 'apihelp-query+notifications-example-1',
-                       
'action=query&meta=notifications&notprop=count&notsections=alert|message&notgroupbysection=1'
-                               => 'apihelp-query+notifications-example-2',
+                       
'action=query&meta=notifications&notprop=count&notsections=alert|message' .
+                               '&notgroupbysection=1' => 
'apihelp-query+notifications-example-2',
                ];
        }
 
diff --git a/includes/api/ApiEchoUnreadNotificationPages.php 
b/includes/api/ApiEchoUnreadNotificationPages.php
index 3d12209..c23a51f 100644
--- a/includes/api/ApiEchoUnreadNotificationPages.php
+++ b/includes/api/ApiEchoUnreadNotificationPages.php
@@ -55,8 +55,8 @@
                $enabledTypes = $attributeManager->getUserEnabledEvents( 
$this->getUser(), 'web' );
 
                $dbr = MWEchoDbFactory::newFromDefault()->getEchoDb( DB_SLAVE );
-               // If $groupPages is true, we need to fetch all pages and apply 
the ORDER BY and LIMIT ourselves
-               // after grouping.
+               // If $groupPages is true, we need to fetch all pages and apply 
the ORDER BY and LIMIT
+               // ourselves after grouping.
                $extraOptions = $groupPages ? [] : [ 'ORDER BY' => 'count 
DESC', 'LIMIT' => $limit ];
                $rows = $dbr->select(
                        [ 'echo_event', 'echo_notification' ],
@@ -126,7 +126,10 @@
                foreach ( $groupCounts as $pageName => $count ) {
                        if ( $groupPages ) {
                                $title = Title::newFromText( $pageName );
-                               $pages = [ 
$title->getSubjectPage()->getPrefixedText(), 
$title->getTalkPage()->getPrefixedText() ];
+                               $pages = [
+                                       
$title->getSubjectPage()->getPrefixedText(),
+                                       $title->getTalkPage()->getPrefixedText()
+                               ];
                                if ( $pageName === $userPageName ) {
                                        $pages[] = null;
                                }
@@ -152,7 +155,8 @@
 
                return [
                        'pages' => $result,
-                       'totalCount' => MWEchoNotifUser::newFromUser( 
$this->getUser() )->getLocalNotificationCount(),
+                       'totalCount' => MWEchoNotifUser::newFromUser( 
$this->getUser() )
+                               ->getLocalNotificationCount(),
                ];
        }
 
@@ -199,7 +203,8 @@
         */
        protected function getExamplesMessages() {
                return [
-                       'action=query&meta=unreadnotificationpages' => 
'apihelp-query+unreadnotificationpages-example-1',
+                       'action=query&meta=unreadnotificationpages' =>
+                               
'apihelp-query+unreadnotificationpages-example-1',
                ];
        }
 
diff --git a/includes/controller/NotificationController.php 
b/includes/controller/NotificationController.php
index 1706bcb..c1b3c7d 100644
--- a/includes/controller/NotificationController.php
+++ b/includes/controller/NotificationController.php
@@ -175,7 +175,9 @@
 
                $notifyTypes = $wgDefaultNotifyTypeAvailability;
 
-               if ( $isTypeSpecificConsidered && isset( 
$wgEchoNotifications[$eventType]['notify-type-availability'] ) ) {
+               if ( $isTypeSpecificConsidered &&
+                       isset( 
$wgEchoNotifications[$eventType]['notify-type-availability'] )
+               ) {
                        $notifyTypes = array_merge(
                                $notifyTypes,
                                
$wgEchoNotifications[$eventType]['notify-type-availability']
@@ -342,10 +344,13 @@
         * user-locator|user-filters attached to the event type.
         *
         * @param EchoEvent $event
-        * @param string $locator Either EchoAttributeManager::ATTR_LOCATORS or 
EchoAttributeManager::ATTR_FILTERS
+        * @param string $locator Either EchoAttributeManager::ATTR_LOCATORS or
+        *   EchoAttributeManager::ATTR_FILTERS
         * @return array
         */
-       public static function evaluateUserCallable( EchoEvent $event, $locator 
= EchoAttributeManager::ATTR_LOCATORS ) {
+       public static function evaluateUserCallable(
+               EchoEvent $event, $locator = EchoAttributeManager::ATTR_LOCATORS
+       ) {
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
                $type = $event->getType();
                $result = [];
@@ -377,7 +382,9 @@
         */
        public static function getUsersToNotifyForEvent( EchoEvent $event ) {
                $notify = new EchoFilteredSequentialIterator;
-               foreach ( self::evaluateUserCallable( $event, 
EchoAttributeManager::ATTR_LOCATORS ) as $users ) {
+               foreach (
+                       self::evaluateUserCallable( $event, 
EchoAttributeManager::ATTR_LOCATORS ) as $users
+               ) {
                        $notify->add( $users );
                }
 
@@ -390,7 +397,9 @@
                }
 
                // Exclude certain users
-               foreach ( self::evaluateUserCallable( $event, 
EchoAttributeManager::ATTR_FILTERS ) as $users ) {
+               foreach (
+                       self::evaluateUserCallable( $event, 
EchoAttributeManager::ATTR_FILTERS ) as $users
+               ) {
                        // the result of the callback can be both an iterator 
or array
                        $users = is_array( $users ) ? $users : 
iterator_to_array( $users );
                        $notify->addFilter( function ( User $user ) use ( 
$users ) {
diff --git a/includes/gateway/UserNotificationGateway.php 
b/includes/gateway/UserNotificationGateway.php
index e47e3b2..7cabc30 100644
--- a/includes/gateway/UserNotificationGateway.php
+++ b/includes/gateway/UserNotificationGateway.php
@@ -106,7 +106,9 @@
         * @param int $cap Max count
         * @return int
         */
-       public function getCappedNotificationCount( $dbSource, array 
$eventTypesToLoad = [], $cap = MWEchoNotifUser::MAX_BADGE_COUNT ) {
+       public function getCappedNotificationCount(
+               $dbSource, array $eventTypesToLoad = [], $cap = 
MWEchoNotifUser::MAX_BADGE_COUNT
+       ) {
                // double check
                if ( !in_array( $dbSource, [ DB_SLAVE, DB_MASTER ] ) ) {
                        $dbSource = DB_SLAVE;
diff --git a/includes/mapper/EventMapper.php b/includes/mapper/EventMapper.php
index aeee3bd..9787c81 100644
--- a/includes/mapper/EventMapper.php
+++ b/includes/mapper/EventMapper.php
@@ -47,7 +47,9 @@
         * @throws MWException
         */
        public function fetchById( $id, $fromMaster = false ) {
-               $db = $fromMaster ? $this->dbFactory->getEchoDb( DB_MASTER ) : 
$this->dbFactory->getEchoDb( DB_SLAVE );
+               $db = $fromMaster
+                       ? $this->dbFactory->getEchoDb( DB_MASTER )
+                       : $this->dbFactory->getEchoDb( DB_SLAVE );
 
                $row = $db->selectRow( 'echo_event', '*', [ 'event_id' => $id 
], __METHOD__ );
 
diff --git a/includes/mapper/NotificationMapper.php 
b/includes/mapper/NotificationMapper.php
index 13f1295..5ae26c0 100644
--- a/includes/mapper/NotificationMapper.php
+++ b/includes/mapper/NotificationMapper.php
@@ -88,7 +88,14 @@
         * @param int $dbSource Use master or slave database
         * @return EchoNotification[]
         */
-       public function fetchUnreadByUser( User $user, $limit, $continue, array 
$eventTypes = [], array $titles = null, $dbSource = DB_SLAVE ) {
+       public function fetchUnreadByUser(
+               User $user,
+               $limit,
+               $continue,
+               array $eventTypes = [],
+               array $titles = null,
+               $dbSource = DB_SLAVE
+       ) {
                $conds['notification_read_timestamp'] = null;
                if ( $titles ) {
                        $conds['event_page_id'] = $this->getIdsForTitles( 
$titles );
@@ -96,7 +103,9 @@
                                return [];
                        }
                }
-               return $this->fetchByUserInternal( $user, $limit, $continue, 
$eventTypes, $conds, $dbSource );
+               return $this->fetchByUserInternal(
+                       $user, $limit, $continue, $eventTypes, $conds, $dbSource
+               );
        }
 
        /**
@@ -114,7 +123,14 @@
         * @param int $dbSource Use master or slave database
         * @return EchoNotification[]
         */
-       public function fetchReadByUser( User $user, $limit, $continue, array 
$eventTypes = [], array $titles = null, $dbSource = DB_SLAVE ) {
+       public function fetchReadByUser(
+               User $user,
+               $limit,
+               $continue,
+               array $eventTypes = [],
+               array $titles = null,
+               $dbSource = DB_SLAVE
+       ) {
                $conds = [ 'notification_read_timestamp IS NOT NULL' ];
                if ( $titles ) {
                        $conds['event_page_id'] = $this->getIdsForTitles( 
$titles );
@@ -122,7 +138,9 @@
                                return [];
                        }
                }
-               return $this->fetchByUserInternal( $user, $limit, $continue, 
$eventTypes, $conds, $dbSource );
+               return $this->fetchByUserInternal(
+                       $user, $limit, $continue, $eventTypes, $conds, $dbSource
+               );
        }
 
        /**
@@ -137,7 +155,14 @@
         *  To find notifications not associated with any page, add null as an 
element to this array.
         * @return EchoNotification[]
         */
-       public function fetchByUser( User $user, $limit, $continue, array 
$eventTypes = [], array $excludeEventIds = [], array $titles = null ) {
+       public function fetchByUser(
+               User $user,
+               $limit,
+               $continue,
+               array $eventTypes = [],
+               array $excludeEventIds = [],
+               array $titles = null
+       ) {
                $dbr = $this->dbFactory->getEchoDb( DB_SLAVE );
 
                $conds = [];
@@ -175,7 +200,14 @@
         * @param int $dbSource Use master or slave database
         * @return EchoNotification[]
         */
-       protected function fetchByUserInternal( User $user, $limit, $continue, 
array $eventTypes = [], array $conds = [], $dbSource = DB_SLAVE ) {
+       protected function fetchByUserInternal(
+               User $user,
+               $limit,
+               $continue,
+               array $eventTypes = [],
+               array $conds = [],
+               $dbSource = DB_SLAVE
+       ) {
                $dbr = $this->dbFactory->getEchoDb( $dbSource );
 
                if ( !$eventTypes ) {
@@ -200,7 +232,8 @@
                if ( $offset['timestamp'] && $offset['offset'] ) {
                        $ts = $dbr->addQuotes( $dbr->timestamp( 
$offset['timestamp'] ) );
                        // The offset and timestamp are those of the first 
notification we want to return
-                       $conds[] = "notification_timestamp < $ts OR ( 
notification_timestamp = $ts AND notification_event <= " . $offset['offset'] . 
" )";
+                       $conds[] = "notification_timestamp < $ts OR ( 
notification_timestamp " .
+                               "= $ts AND notification_event <= " . 
$offset['offset'] . " )";
                }
 
                $res = $dbr->select(
diff --git a/includes/model/Event.php b/includes/model/Event.php
index 06ebf05..c6413e0 100644
--- a/includes/model/Event.php
+++ b/includes/model/Event.php
@@ -138,7 +138,9 @@
                // There might be data loss if the size exceeds the DB column 
size of
                // event_extra.
                if ( strlen( $obj->serializeExtra() ) > 50000 ) {
-                       wfDebugLog( __CLASS__, __FUNCTION__ . ': event extra 
data is too huge for ' . $info['type'] );
+                       wfDebugLog(
+                               __CLASS__, __FUNCTION__ . ': event extra data 
is too huge for ' . $info['type']
+                       );
 
                        return false;
                }
@@ -523,7 +525,9 @@
                                return $this->title = $title;
                        }
 
-                       return $this->title = Title::newFromID( $this->pageId, 
$fromMaster ? Title::GAID_FOR_UPDATE : 0 );
+                       return $this->title = Title::newFromID(
+                               $this->pageId, $fromMaster ? 
Title::GAID_FOR_UPDATE : 0
+                       );
                } elseif ( isset( $this->extra['page_title'], 
$this->extra['page_namespace'] ) ) {
                        return $this->title = Title::makeTitleSafe(
                                $this->extra['page_namespace'],
diff --git a/includes/special/NotificationPager.php 
b/includes/special/NotificationPager.php
index 07a4e06..b17c02c 100644
--- a/includes/special/NotificationPager.php
+++ b/includes/special/NotificationPager.php
@@ -16,7 +16,8 @@
        }
 
        function formatRow( $row ) {
-               $msg = "This pager does not support row formatting. Use 
'getNotifications()' to get a list of EchoNotification objects.";
+               $msg = "This pager does not support row formatting. " .
+                       "Use 'getNotifications()' to get a list of 
EchoNotification objects.";
                throw new Exception( $msg );
        }
 
diff --git a/includes/special/SpecialDisplayNotificationsConfiguration.php 
b/includes/special/SpecialDisplayNotificationsConfiguration.php
index 09be63c..70d71ea 100644
--- a/includes/special/SpecialDisplayNotificationsConfiguration.php
+++ b/includes/special/SpecialDisplayNotificationsConfiguration.php
@@ -84,7 +84,8 @@
                                )
                        )->parse();
 
-                       $this->categoryNames[$internalCategoryName] = 
$formattedFriendlyCategoryName . ' ' . $formattedInternalCategoryName;
+                       $this->categoryNames[$internalCategoryName] = 
$formattedFriendlyCategoryName . ' ' .
+                               $formattedInternalCategoryName;
                }
 
                $this->flippedCategoryNames = array_flip( $this->categoryNames 
);
@@ -99,7 +100,9 @@
                $notificationTypes = array_keys( $wgEchoNotifications );
                $this->notificationTypeNames = array_combine( 
$notificationTypes, $notificationTypes );
 
-               $this->getOutput()->setPageTitle( $this->msg( 
'echo-displaynotificationsconfiguration' )->text() );
+               $this->getOutput()->setPageTitle(
+                       $this->msg( 'echo-displaynotificationsconfiguration' 
)->text()
+               );
                $this->outputHeader( 
'echo-displaynotificationsconfiguration-summary' );
                $this->outputConfiguration();
        }
@@ -125,7 +128,9 @@
         * @param array $columnLabelMapping Associative array mapping label to 
tag
         * @param array $value Array consisting of strings in the format 
'$columnTag-$rowTag'
         */
-       protected function outputCheckMatrix( $id, $legendMsgKey, array 
$rowLabelMapping, array $columnLabelMapping, array $value ) {
+       protected function outputCheckMatrix(
+               $id, $legendMsgKey, array $rowLabelMapping, array 
$columnLabelMapping, array $value
+       ) {
                $form = new HTMLForm(
                        [
                                $id => [
@@ -157,7 +162,9 @@
                        Html::element(
                                'h2',
                                [ 'id' => 
'mw-echo-displaynotificationsconfiguration-notifications-by-category' ],
-                               $this->msg( 
'echo-displaynotificationsconfiguration-notifications-by-category-header' 
)->text()
+                               $this->msg(
+                                       
'echo-displaynotificationsconfiguration-notifications-by-category-header'
+                               )->text()
                        )
                );
 
@@ -173,7 +180,8 @@
                                Html::rawElement(
                                        'li',
                                        [],
-                                       $this->categoryNames[$categoryName] . 
$this->msg( 'colon-separator' )->text() . ' ' . $implodedTypes
+                                       $this->categoryNames[$categoryName] . 
$this->msg( 'colon-separator' )->text() .
+                                               ' ' . $implodedTypes
                                )
                        );
                }
@@ -184,7 +192,10 @@
         * Output the notification types in each section (alert/message)
         */
        protected function outputNotificationsInSections() {
-               $this->getOutput()->addHTML( Html::element( 'h2', [ 'id' => 
'mw-echo-displaynotificationsconfiguration-sorting-by-section' ], $this->msg( 
'echo-displaynotificationsconfiguration-sorting-by-section-header' )->text() ) 
);
+               $this->getOutput()->addHTML( Html::element( 'h2',
+                       [ 'id' => 
'mw-echo-displaynotificationsconfiguration-sorting-by-section' ],
+                       $this->msg( 
'echo-displaynotificationsconfiguration-sorting-by-section-header' )->text()
+               ) );
 
                $bySectionValue = [];
 
@@ -194,13 +205,21 @@
                        $types = $this->attributeManager->getEventsForSection( 
$section );
                        // echo-notification-alert-text-only, 
echo-notification-notice-text-only
                        $msgSection = $section == 'message' ? 'notice' : 
$section;
-                       $flippedSectionNames[$this->msg( 'echo-notification-' . 
$msgSection . '-text-only' )->text()] = $section;
+                       $flippedSectionNames[
+                               $this->msg( 'echo-notification-' . $msgSection 
. '-text-only' )->text()
+                       ] = $section;
                        foreach ( $types as $type ) {
                                $bySectionValue[] = "$section-$type";
                        }
                }
 
-               $this->outputCheckMatrix( 'type-by-section', 
'echo-displaynotificationsconfiguration-sorting-by-section-legend', 
$this->notificationTypeNames, $flippedSectionNames, $bySectionValue );
+               $this->outputCheckMatrix(
+                       'type-by-section',
+                       
'echo-displaynotificationsconfiguration-sorting-by-section-legend',
+                       $this->notificationTypeNames,
+                       $flippedSectionNames,
+                       $bySectionValue
+               );
        }
 
        /**
@@ -209,43 +228,70 @@
        protected function outputAvailability() {
                global $wgEchoNotifications;
 
-               $this->getOutput()->addHTML( Html::element( 'h2', [ 'id' => 
'mw-echo-displaynotificationsconfiguration-available-notification-methods' ], 
$this->msg( 
'echo-displaynotificationsconfiguration-available-notification-methods-header' 
)->text() ) );
+               $this->getOutput()->addHTML( Html::element( 'h2',
+                       [ 'id' => 
'mw-echo-displaynotificationsconfiguration-available-notification-methods' ],
+                       $this->msg(
+                               
'echo-displaynotificationsconfiguration-available-notification-methods-header'
+                       )->text()
+               ) );
 
                $byCategoryValue = [];
 
                foreach ( $this->notifyTypes as $notifyType => 
$displayNotifyType ) {
                        foreach ( $this->categoryNames as $category => 
$displayCategory ) {
-                               if ( 
$this->attributeManager->isNotifyTypeAvailableForCategory( $category, 
$notifyType ) ) {
+                               if ( 
$this->attributeManager->isNotifyTypeAvailableForCategory(
+                                       $category, $notifyType )
+                               ) {
                                        $byCategoryValue[] = 
"$notifyType-$category";
                                }
                        }
                }
 
-               $this->outputCheckMatrix( 'availability-by-category', 
'echo-displaynotificationsconfiguration-available-notification-methods-by-category-legend',
 $this->flippedCategoryNames, $this->flippedNotifyTypes, $byCategoryValue );
+               $this->outputCheckMatrix(
+                       'availability-by-category',
+                       
'echo-displaynotificationsconfiguration-available-notification-methods-by-category-legend',
+                       $this->flippedCategoryNames,
+                       $this->flippedNotifyTypes,
+                       $byCategoryValue
+               );
 
                $byTypeValue = [];
 
-               $specialNotificationTypes = array_keys( array_filter( 
$wgEchoNotifications, function ( $val ) {
-                       return isset( $val['notify-type-availability'] );
-               } ) );
+               $specialNotificationTypes = array_keys( array_filter( 
$wgEchoNotifications,
+                       function ( $val ) {
+                               return isset( $val['notify-type-availability'] 
);
+                       }
+               ) );
                foreach ( $specialNotificationTypes as $notificationType ) {
-                       $allowedNotifyTypes = 
$this->notificationController->getEventNotifyTypes( $notificationType );
+                       $allowedNotifyTypes = 
$this->notificationController->getEventNotifyTypes(
+                               $notificationType
+                       );
                        foreach ( $allowedNotifyTypes as $notifyType ) {
                                $byTypeValue[] = 
"$notifyType-$notificationType";
                        }
                }
 
                // No user-friendly label for rows yet
-               $this->outputCheckMatrix( 'availability-by-type', 
'echo-displaynotificationsconfiguration-available-notification-methods-by-type-legend',
 array_combine( $specialNotificationTypes, $specialNotificationTypes ), 
$this->flippedNotifyTypes, $byTypeValue );
+               $this->outputCheckMatrix(
+                       'availability-by-type',
+                       
'echo-displaynotificationsconfiguration-available-notification-methods-by-type-legend',
+                       array_combine( $specialNotificationTypes, 
$specialNotificationTypes ),
+                       $this->flippedNotifyTypes,
+                       $byTypeValue
+               );
        }
 
        /**
         * Output which notification categories are turned on by default, for 
each notify type
         */
        protected function outputEnabledDefault() {
-               $this->getOutput()->addHTML( Html::element( 'h2', [ 'id' => 
'mw-echo-displaynotificationsconfiguration-enabled-default' ], $this->msg( 
'echo-displaynotificationsconfiguration-enabled-default-header' )->text() ) );
+               $this->getOutput()->addHTML( Html::element( 'h2',
+                       [ 'id' => 
'mw-echo-displaynotificationsconfiguration-enabled-default' ],
+                       $this->msg( 
'echo-displaynotificationsconfiguration-enabled-default-header' )->text()
+               ) );
 
-               // In reality, anon users are not relevant to Echo, but this 
lets us easily query default options.
+               // In reality, anon users are not relevant to Echo,
+               // but this lets us easily query default options.
                $anonUser = new User;
 
                $byCategoryValueExisting = [];
@@ -258,7 +304,13 @@
                        }
                }
 
-               $this->outputCheckMatrix( 'enabled-by-default-generic', 
'echo-displaynotificationsconfiguration-enabled-default-existing-users-legend', 
$this->flippedCategoryNames, $this->flippedNotifyTypes, 
$byCategoryValueExisting );
+               $this->outputCheckMatrix(
+                       'enabled-by-default-generic',
+                       
'echo-displaynotificationsconfiguration-enabled-default-existing-users-legend',
+                       $this->flippedCategoryNames,
+                       $this->flippedNotifyTypes,
+                       $byCategoryValueExisting
+               );
 
                $loggedInUser = new User;
                // This might not catch if there are other hooks that do 
similar.
@@ -278,7 +330,13 @@
                        }
                }
 
-               $this->outputCheckMatrix( 'enabled-by-default-new', 
'echo-displaynotificationsconfiguration-enabled-default-new-users-legend', 
$this->flippedCategoryNames, $this->flippedNotifyTypes, $byCategoryValueNew );
+               $this->outputCheckMatrix(
+                       'enabled-by-default-new',
+                       
'echo-displaynotificationsconfiguration-enabled-default-new-users-legend',
+                       $this->flippedCategoryNames,
+                       $this->flippedNotifyTypes,
+                       $byCategoryValueNew
+               );
        }
 
        /**
@@ -287,16 +345,29 @@
        protected function outputMandatory() {
                $byCategoryValue = [];
 
-               $this->getOutput()->addHTML( Html::element( 'h2', [ 'id' => 
'mw-echo-displaynotificationsconfiguration-mandatory-notification-methods' ], 
$this->msg( 
'echo-displaynotificationsconfiguration-mandatory-notification-methods-header' 
)->text() ) );
+               $this->getOutput()->addHTML( Html::element( 'h2',
+                       [ 'id' => 
'mw-echo-displaynotificationsconfiguration-mandatory-notification-methods' ],
+                       $this->msg(
+                               
'echo-displaynotificationsconfiguration-mandatory-notification-methods-header'
+                       )->text()
+               ) );
 
                foreach ( $this->notifyTypes as $notifyType => 
$displayNotifyType ) {
                        foreach ( $this->categoryNames as $category => 
$displayCategory ) {
-                               if ( 
!$this->attributeManager->isNotifyTypeDismissableForCategory( $category, 
$notifyType ) ) {
+                               if ( 
!$this->attributeManager->isNotifyTypeDismissableForCategory(
+                                       $category, $notifyType )
+                               ) {
                                        $byCategoryValue[] = 
"$notifyType-$category";
                                }
                        }
                }
 
-               $this->outputCheckMatrix( 'mandatory', 
'echo-displaynotificationsconfiguration-mandatory-notification-methods-by-category-legend',
 $this->flippedCategoryNames, $this->flippedNotifyTypes, $byCategoryValue );
+               $this->outputCheckMatrix(
+                       'mandatory',
+                       
'echo-displaynotificationsconfiguration-mandatory-notification-methods-by-category-legend',
+                       $this->flippedCategoryNames,
+                       $this->flippedNotifyTypes,
+                       $byCategoryValue
+               );
        }
 }
diff --git a/includes/special/SpecialNotifications.php 
b/includes/special/SpecialNotifications.php
index a03a83d..595725e 100644
--- a/includes/special/SpecialNotifications.php
+++ b/includes/special/SpecialNotifications.php
@@ -20,8 +20,10 @@
                $this->addHelpLink( 'Help:Notifications/Special:Notifications' 
);
 
                $out->addJsConfigVars( 'wgNotificationsSpecialPageLinks', [
-                       'help' => 
'//www.mediawiki.org/wiki/Special:MyLanguage/Help:Notifications/Special:Notifications',
-                       'preferences' => SpecialPage::getTitleFor( 
'Preferences' )->getLinkURL() . '#mw-prefsection-echo',
+                       'help' => '//www.mediawiki.org/wiki/' .
+                               
'Special:MyLanguage/Help:Notifications/Special:Notifications',
+                       'preferences' => SpecialPage::getTitleFor( 
'Preferences' )->getLinkURL() .
+                               '#mw-prefsection-echo',
                ] );
 
                $user = $this->getUser();
@@ -56,7 +58,9 @@
 
                $notif = [];
                foreach ( $notifications as $notification ) {
-                       $output = EchoDataOutputFormatter::formatOutput( 
$notification, 'special', $user, $this->getLanguage() );
+                       $output = EchoDataOutputFormatter::formatOutput(
+                               $notification, 'special', $user, 
$this->getLanguage()
+                       );
                        if ( $output ) {
                                $notif[] = $output;
                        }
@@ -149,7 +153,9 @@
                                        $markAsReadLabelIcon->toString()
                                );
 
-                               $formHtml = 
$markSectionAsReadForm->prepareForm()->getHTML( /* First submission attempt */ 
false );
+                               $formHtml = 
$markSectionAsReadForm->prepareForm()->getHTML(
+                                       /* First submission attempt */ false
+                               );
 
                                $formWrapper = new OOUI\Tag();
                                $formWrapper
@@ -218,7 +224,8 @@
                $subtitleLinks[] = Html::element(
                        'a',
                        [
-                               'href' => SpecialPage::getTitleFor( 
'Preferences' )->getLinkURL() . '#mw-prefsection-echo',
+                               'href' => SpecialPage::getTitleFor( 
'Preferences' )->getLinkURL() .
+                                       '#mw-prefsection-echo',
                                'id' => 'mw-echo-pref-link',
                                'class' => 'mw-echo-special-header-link',
                                'title' => $this->msg( 'preferences' )->text()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaf56c84be20674955b014f702d799caaa0db82e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>

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

Reply via email to