Jforrester has uploaded a new change for review.

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

Change subject: build: Enable phpcs rule 'Generic.Files.LineLength' and make 
pass
......................................................................

build: Enable phpcs rule 'Generic.Files.LineLength' and make pass

Change-Id: Ibc92d112ae1cfaee3c409b9b936c7f894d32960f
---
M Echo.php
M Hooks.php
M Notifier.php
M includes/BatchRowUpdate.php
M includes/ContainmentSet.php
M includes/DataOutputFormatter.php
M includes/DiffParser.php
M includes/DiscussionParser.php
M includes/EmailBatch.php
M includes/EmailBundler.php
M includes/EmailFormatter.php
M includes/NotifUser.php
M includes/api/ApiEchoMarkRead.php
M includes/api/ApiEchoNotifications.php
M includes/controller/NotificationController.php
M includes/formatters/BasicFormatter.php
M includes/formatters/NotificationFormatter.php
M includes/jobs/NotificationEmailBundleJob.php
M includes/mapper/EventMapper.php
M includes/mapper/NotificationMapper.php
M includes/model/Notification.php
M includes/special/SpecialNotifications.php
M maintenance/testDiscussionParser.php
M maintenance/updateEchoSchemaForSuppression.php
M phpcs.xml
M tests/phpunit/AttributeManagerTest.php
M tests/phpunit/BatchRowUpdateTest.php
M tests/phpunit/DiscussionParserTest.php
M tests/phpunit/EmailFormatterTest.php
M tests/phpunit/TalkPageFunctionalTest.php
M tests/phpunit/controller/NotificationControllerTest.php
M tests/phpunit/formatters/NotificationFormatterTest.php
M tests/phpunit/gateway/UserNotificationGatewayTest.php
M tests/phpunit/mapper/EventMapperTest.php
M tests/phpunit/mapper/NotificationMapperTest.php
M tests/phpunit/mapper/TargetPageMapperTest.php
36 files changed, 789 insertions(+), 248 deletions(-)


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

diff --git a/Echo.php b/Echo.php
index ef2e0ed..7a3a512 100644
--- a/Echo.php
+++ b/Echo.php
@@ -24,7 +24,8 @@
  * @licence MIT License
  */
 
-# Alert the user that this is not a valid entry point to MediaWiki if they try 
to access the special pages file directly.
+# Alert the user that this is not a valid entry point to MediaWiki if they try 
to
+# access the special pages file directly.
 if ( !defined( 'MEDIAWIKI' ) ) {
        echo <<<EOT
 To install this extension, put the following line in LocalSettings.php:
@@ -38,7 +39,7 @@
        'path' => __FILE__,
        'name' => 'Echo',
        'url' => 'https://www.mediawiki.org/wiki/Extension:Echo',
-       'author' => array( 'Andrew Garrett', 'Ryan Kaldari', 'Benny Situ', 
'Luke Welling' ),
+       'author' => array( 'Andrew Garrett', 'Ryan Kaldari', 'Benny Situ', 
'Luke Welling', '...' ),
        'descriptionmsg' => 'echo-desc',
        'license-name' => 'MIT',
 );
@@ -304,8 +305,12 @@
                'user-locators' => array(
                        'EchoUserLocator::locateTalkPageOwner',
                ),
-               'primary-link' => array( 'message' => 
'notification-link-text-view-message', 'destination' => 'section' ),
-               'secondary-link' => array( 'message' => 
'notification-link-text-view-changes', 'destination' => 'diff' ),
+               'primary-link' => array(
+                       'message' => 'notification-link-text-view-message', 
'destination' => 'section'
+               ),
+               'secondary-link' => array(
+                       'message' => 'notification-link-text-view-changes', 
'destination' => 'diff'
+               ),
                'category' => 'edit-user-talk',
                'group' => 'interactive',
                'section' => 'message',
@@ -330,7 +335,10 @@
                'user-locators' => array(
                        array( 'EchoUserLocator::locateFromEventExtra', array( 
'reverted-user-id' ) ),
                ),
-               'primary-link' => array( 'message' => 
'notification-link-text-view-edit', 'destination' => 'diff' ),
+               'primary-link' => array(
+                       'message' => 'notification-link-text-view-edit',
+                       'destination' => 'diff'
+               ),
                'category' => 'reverted',
                'group' => 'negative',
                'section' => 'alert',
@@ -349,16 +357,28 @@
                'user-locators' => array(
                        'EchoUserLocator::locateArticleCreator',
                ),
-               'primary-link' => array( 'message' => 
'notification-link-text-view-page', 'destination' => 'link-from-page' ),
+               'primary-link' => array(
+                       'message' => 'notification-link-text-view-page',
+                       'destination' => 'link-from-page'
+               ),
                'category' => 'article-linked',
                'group' => 'neutral',
                'section' => 'alert',
-               'bundle' => array( 'web' => true, 'email' => true ),
+               'bundle' => array(
+                       'web' => true,
+                       'email' => true
+               ),
                'formatter-class' => 'EchoPageLinkFormatter',
                'title-message' => 'notification-page-linked',
                'title-params' => array( 'agent', 'title', 'link-from-page' ),
                'bundle-message' => 'notification-page-linked-bundle',
-               'bundle-params' => array( 'agent', 'title', 'link-from-page', 
'link-from-page-other-display', 'link-from-page-other-count' ),
+               'bundle-params' => array(
+                       'agent',
+                       'title',
+                       'link-from-page',
+                       'link-from-page-other-display',
+                       'link-from-page-other-count'
+               ),
                'flyout-message' => 'notification-page-linked-flyout',
                'flyout-params' => array( 'agent', 'title', 'link-from-page' ),
                'email-subject-message' => 
'notification-page-linked-email-subject',
@@ -366,15 +386,27 @@
                'email-body-batch-message' => 
'notification-page-linked-email-batch-body',
                'email-body-batch-params' => array( 'agent', 'title', 
'link-from-page' ),
                'email-body-batch-bundle-message' => 
'notification-page-linked-email-batch-bundle-body',
-               'email-body-batch-bundle-params' => array( 'agent', 'title', 
'link-from-page', 'link-from-page-other-display', 'link-from-page-other-count' 
),
+               'email-body-batch-bundle-params' => array(
+                       'agent',
+                       'title',
+                       'link-from-page',
+                       'link-from-page-other-display',
+                       'link-from-page-other-count'
+               ),
                'icon' => 'linked',
        ),
        'mention' => array(
                'user-locators' => array(
                        array( 'EchoUserLocator::locateFromEventExtra', array( 
'mentioned-users' ) ),
                ),
-               'primary-link' => array( 'message' => 
'notification-link-text-view-mention', 'destination' => 'section' ),
-               'secondary-link' => array( 'message' => 
'notification-link-text-view-changes', 'destination' => 'diff' ),
+               'primary-link' => array(
+                       'message' => 'notification-link-text-view-mention',
+                       'destination' => 'section'
+               ),
+               'secondary-link' => array(
+                       'message' => 'notification-link-text-view-changes',
+                       'destination' => 'diff'
+               ),
                'category' => 'mention',
                'group' => 'interactive',
                'section' => 'alert',
@@ -382,9 +414,13 @@
                // 'presentation-model' => 'EchoMentionPresentationModel',
                'formatter-class' => 'EchoMentionFormatter',
                'title-message' => 'notification-mention',
-               'title-params' => array( 'agent', 'subject-anchor', 'title', 
'section-title', 'main-title-text' ),
+               'title-params' => array(
+                       'agent', 'subject-anchor', 'title', 'section-title', 
'main-title-text'
+               ),
                'flyout-message' => 'notification-mention-flyout',
-               'flyout-params' => array( 'agent', 'subject-anchor', 'title', 
'section-title', 'main-title-text' ),
+               'flyout-params' => array(
+                       'agent', 'subject-anchor', 'title', 'section-title', 
'main-title-text'
+               ),
                'email-subject-message' => 'notification-mention-email-subject',
                'email-subject-params' => array( 'agent' ),
                'email-body-batch-message' => 
'notification-mention-email-batch-body',
@@ -439,7 +475,8 @@
        $wgDefaultUserOptions['echo-email-format'] = 'plain-text'; 
/*EchoHooks::EMAIL_FORMAT_PLAIN_TEXT*/
 }
 
-// Set all of the events to notify by web but not email by default (won't 
affect events that don't email)
+// Set all of the events to notify by web but not email by default (won't 
affect events that
+// don't email)
 foreach ( $wgEchoNotificationCategories as $category => $categoryData ) {
        $wgDefaultUserOptions["echo-subscriptions-email-{$category}"] = false;
        $wgDefaultUserOptions["echo-subscriptions-web-{$category}"] = true;
diff --git a/Hooks.php b/Hooks.php
index ea489d7..3b4bd2d 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -17,7 +17,10 @@
                        $wgEchoConfig;
 
                // allow extensions to define their own event
-               Hooks::run( 'BeforeCreateEchoEvent', array( 
&$wgEchoNotifications, &$wgEchoNotificationCategories, 
&$wgEchoNotificationIcons ) );
+               Hooks::run(
+                       'BeforeCreateEchoEvent',
+                       array( &$wgEchoNotifications, 
&$wgEchoNotificationCategories, &$wgEchoNotificationIcons )
+               );
 
                // turn schema off if eventLogging is not enabled
                if ( !class_exists( 'EventLogging' ) ) {
@@ -137,38 +140,106 @@
                }
                $dir = __DIR__;
                $baseSQLFile = "$dir/echo.sql";
-               $updater->addExtensionTable( 'echo_event', $baseSQLFile );
-               $updater->addExtensionTable( 'echo_email_batch', 
"$dir/db_patches/echo_email_batch.sql" );
-               $updater->addExtensionTable( 'echo_target_page', 
"$dir/db_patches/echo_target_page.sql" );
+               $updater->addExtensionTable(
+                       'echo_event',
+                       $baseSQLFile
+               );
+               $updater->addExtensionTable(
+                       'echo_email_batch',
+                       "$dir/db_patches/echo_email_batch.sql"
+               );
+               $updater->addExtensionTable(
+                       'echo_target_page',
+                       "$dir/db_patches/echo_target_page.sql"
+               );
 
                if ( $updater->getDB()->getType() === 'sqlite' ) {
-                       $updater->modifyExtensionField( 'echo_event', 
'event_agent', "$dir/db_patches/patch-event_agent-split.sqlite.sql" );
-                       $updater->modifyExtensionField( 'echo_event', 
'event_variant', "$dir/db_patches/patch-event_variant_nullability.sqlite.sql" );
-                       $updater->addExtensionField( 'echo_target_page', 
'etp_id', "$dir/db_patches/patch-multiple_target_pages.sqlite.sql" );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_agent',
+                               
"$dir/db_patches/patch-event_agent-split.sqlite.sql"
+                       );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_variant',
+                               
"$dir/db_patches/patch-event_variant_nullability.sqlite.sql"
+                       );
+                       $updater->addExtensionField(
+                               'echo_target_page',
+                               'etp_id',
+                               
"$dir/db_patches/patch-multiple_target_pages.sqlite.sql"
+                       );
                        // There is no need to run the patch-event_extra-size 
or patch-event_agent_ip-size because
                        // sqlite ignores numeric arguments in parentheses that 
follow the type name (ex: VARCHAR(255))
                        // see http://www.sqlite.org/datatype3.html Section 2.2 
for more info
                } else {
-                       $updater->modifyExtensionField( 'echo_event', 
'event_agent', "$dir/db_patches/patch-event_agent-split.sql" );
-                       $updater->modifyExtensionField( 'echo_event', 
'event_variant', "$dir/db_patches/patch-event_variant_nullability.sql" );
-                       $updater->modifyExtensionField( 'echo_event', 
'event_extra', "$dir/db_patches/patch-event_extra-size.sql" );
-                       $updater->modifyExtensionField( 'echo_event', 
'event_agent_ip', "$dir/db_patches/patch-event_agent_ip-size.sql" );
-                       $updater->addExtensionField( 'echo_target_page', 
'etp_id', "$dir/db_patches/patch-multiple_target_pages.sql" );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_agent',
+                               "$dir/db_patches/patch-event_agent-split.sql"
+                       );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_variant',
+                               
"$dir/db_patches/patch-event_variant_nullability.sql"
+                       );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_extra',
+                               "$dir/db_patches/patch-event_extra-size.sql"
+                       );
+                       $updater->modifyExtensionField(
+                               'echo_event',
+                               'event_agent_ip',
+                               "$dir/db_patches/patch-event_agent_ip-size.sql"
+                       );
+                       $updater->addExtensionField(
+                               'echo_target_page',
+                               'etp_id',
+                               
"$dir/db_patches/patch-multiple_target_pages.sql"
+                       );
                }
 
-               $updater->addExtensionField( 'echo_notification', 
'notification_bundle_base',
-                       "$dir/db_patches/patch-notification-bundling-field.sql" 
);
-               // This index was renamed twice,  first from type_page to 
event_type and later from event_type to echo_event_type
+               $updater->addExtensionField(
+                       'echo_notification',
+                       'notification_bundle_base',
+                       "$dir/db_patches/patch-notification-bundling-field.sql"
+               );
+               // This index was renamed twice,  first from type_page to 
event_type and later from
+               // event_type to echo_event_type
                if ( $updater->getDB()->indexExists( 'echo_event', 'type_page', 
__METHOD__ ) ) {
-                       $updater->addExtensionIndex( 'echo_event', 
'event_type', "$dir/db_patches/patch-alter-type_page-index.sql" );
+                       $updater->addExtensionIndex(
+                               'echo_event',
+                               'event_type',
+                               
"$dir/db_patches/patch-alter-type_page-index.sql"
+                       );
                }
                $updater->dropTable( 'echo_subscription' );
-               $updater->dropExtensionField( 'echo_event', 'event_timestamp', 
"$dir/db_patches/patch-drop-echo_event-event_timestamp.sql" );
-               $updater->addExtensionField( 'echo_email_batch', 
'eeb_event_hash',
-                       "$dir/db_patches/patch-email_batch-new-field.sql" );
-               $updater->addExtensionField( 'echo_event', 'event_page_id', 
"$dir/db_patches/patch-add-echo_event-event_page_id.sql" );
-               $updater->addExtensionIndex( 'echo_event', 'echo_event_type', 
"$dir/db_patches/patch-alter-event_type-index.sql" );
-               $updater->addExtensionIndex( 'echo_notification', 
'echo_user_timestamp', "$dir/db_patches/patch-alter-user_timestamp-index.sql" );
+               $updater->dropExtensionField(
+                       'echo_event',
+                       'event_timestamp',
+                       
"$dir/db_patches/patch-drop-echo_event-event_timestamp.sql"
+               );
+               $updater->addExtensionField(
+                       'echo_email_batch',
+                       'eeb_event_hash',
+                       "$dir/db_patches/patch-email_batch-new-field.sql"
+               );
+               $updater->addExtensionField(
+                       'echo_event',
+                       'event_page_id',
+                       "$dir/db_patches/patch-add-echo_event-event_page_id.sql"
+               );
+               $updater->addExtensionIndex(
+                       'echo_event',
+                       'echo_event_type',
+                       "$dir/db_patches/patch-alter-event_type-index.sql"
+               );
+               $updater->addExtensionIndex(
+                       'echo_notification',
+                       'echo_user_timestamp',
+                       "$dir/db_patches/patch-alter-user_timestamp-index.sql"
+               );
        }
 
        /**
@@ -320,7 +391,9 @@
                        $categoryMessage = wfMessage( 'echo-category-title-' . 
$category )->numParams( 1 )->escaped();
                        $rows[$categoryMessage] = $category;
                        if ( isset( 
$wgEchoNotificationCategories[$category]['tooltip'] ) ) {
-                               $tooltips[$categoryMessage] = wfMessage( 
$wgEchoNotificationCategories[$category]['tooltip'] )->text();
+                               $tooltips[$categoryMessage] = wfMessage(
+                                       
$wgEchoNotificationCategories[$category]['tooltip']
+                               )->text();
                        }
                }
 
@@ -402,7 +475,18 @@
         * @param $status Status
         * @return bool true in all cases
         */
-       public static function onArticleSaved( &$article, &$user, $text, 
$summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status 
) {
+       public static function onArticleSaved(
+               &$article,
+               &$user,
+               $text,
+               $summary,
+               $minoredit,
+               $watchthis,
+               $sectionanchor,
+               &$flags,
+               $revision,
+               &$status
+       ) {
                global $wgEchoNotifications, $wgRequest;
 
                if ( !$revision ) {
@@ -681,19 +765,34 @@
 
                // HACK: inverted icons only work in the "MediaWiki" OOUI theme
                // Avoid flashes in skins that don't use it (T111821)
-               $sk->getOutput()->setupOOUI( strtolower( $sk->getSkinName() ), 
$sk->getOutput()->getLanguage()->getDir() );
+               $sk->getOutput()->setupOOUI(
+                       strtolower( $sk->getSkinName() ),
+                       $sk->getOutput()->getLanguage()->getDir()
+               );
                $oouiImageClass = get_class( OOUI\Theme::singleton() ) === 
'OOUI\\MediaWikiTheme'
                        ? 'oo-ui-image-invert'
                        : '';
 
-               $msgLinkClasses = array( "mw-echo-notifications-badge 
mw-echo-notification-badge-nojs $oouiImageClass oo-ui-iconElement 
oo-ui-iconElement-icon oo-ui-icon-speechBubble" );
-               $alertLinkClasses = array( "mw-echo-notifications-badge 
mw-echo-notification-badge-nojs $oouiImageClass oo-ui-iconElement 
oo-ui-iconElement-icon" );
+               $msgLinkClasses = array(
+                       "mw-echo-notifications-badge 
mw-echo-notification-badge-nojs"
+                               . " $oouiImageClass oo-ui-iconElement 
oo-ui-iconElement-icon oo-ui-icon-speechBubble"
+               );
+               $alertLinkClasses = array(
+                       "mw-echo-notifications-badge 
mw-echo-notification-badge-nojs"
+                               . " $oouiImageClass oo-ui-iconElement 
oo-ui-iconElement-icon"
+               );
 
                $hasUnseen = false;
                if (
-                       $msgCount != 0 && // no unread notifications
-                       $msgNotificationTimestamp !== false && // should 
already always be false if count === 0
-                       ( $seenMsgTime === null || $seenMsgTime < 
$msgNotificationTimestamp->getTimestamp( TS_MW ) ) // there are no unseen 
notifications
+                       // no unread notifications
+                       $msgCount != 0 &&
+                       // should already always be false if count === 0
+                       $msgNotificationTimestamp !== false &&
+                       // there are no unseen notifications
+                       (
+                               $seenMsgTime === null ||
+                               $seenMsgTime < 
$msgNotificationTimestamp->getTimestamp( TS_MW )
+                       )
                ) {
                        $msgLinkClasses[] = 'mw-echo-unseen-notifications';
                        $hasUnseen = true;
@@ -701,9 +800,15 @@
 
                $alertIcon = "bell";
                if (
-                       $alertCount != 0 && // no unread notifications
-                       $alertNotificationTimestamp !== false && // should 
already always be false if count === 0
-                       ( $seenAlertTime === null || $seenAlertTime < 
$alertNotificationTimestamp->getTimestamp( TS_MW ) ) // all notifications have 
already been seen
+                       // no unread notifications
+                       $alertCount != 0 &&
+                       // should already always be false if count === 0
+                       $alertNotificationTimestamp !== false &&
+                       // all notifications have already been seen
+                       (
+                               $seenAlertTime === null ||
+                               $seenAlertTime < 
$alertNotificationTimestamp->getTimestamp( TS_MW )
+                       )
                ) {
                        $alertLinkClasses[] = 'mw-echo-unseen-notifications';
                        $alertIcon = "bellOn";
@@ -785,7 +890,8 @@
         * @see 
http://www.mediawiki.org/wiki/Manual:Hooks/AbortWatchlistEmailNotification
         * @param $targetUser User
         * @param $title Title
-        * @param $emailNotification EmailNotification The email notification 
object that sends non-echo notifications
+        * @param $emailNotification EmailNotification The email notification 
object that sends non-Echo
+        *    notifications
         * @return bool
         */
        static function onSendWatchlistEmailNotification( $targetUser, $title, 
$emailNotification ) {
@@ -910,8 +1016,10 @@
                $victimId = $oldRevision->getUser();
 
                if (
-                       $victimId && // No notifications for anonymous users
-                       !$oldRevision->getContent()->equals( 
$newRevision->getContent() ) // No notifications for null rollbacks
+                       // No notifications for anonymous users
+                       $victimId &&
+                       // No notifications for null rollbacks
+                       !$oldRevision->getContent()->equals( 
$newRevision->getContent() )
                ) {
                        EchoEvent::create( array(
                                'type' => 'reverted',
@@ -1049,10 +1157,29 @@
        public static function onUserMergeAccountFields( &$updateFields ) {
                // array( tableName, idField, textField )
                $dbw = MWEchoDbFactory::newFromDefault()->getEchoDb( DB_MASTER 
);
-               $updateFields[] = array( 'echo_event', 'event_agent_id', 'db' 
=> $dbw );
-               $updateFields[] = array( 'echo_notification', 
'notification_user', 'db' => $dbw, 'options' => array( 'IGNORE' ) );
-               $updateFields[] = array( 'echo_email_batch', 'eeb_user_id', 
'db' => $dbw, 'options' => array( 'IGNORE' ) );
-               $updateFields[] = array( 'echo_target_page', 'etp_user', 'db' 
=> $dbw, 'options' => array( 'IGNORE' ) );
+               $updateFields[] = array(
+                       'echo_event',
+                       'event_agent_id',
+                       'db' => $dbw
+               );
+               $updateFields[] = array(
+                       'echo_notification',
+                       'notification_user',
+                       'db' => $dbw,
+                       'options' => array( 'IGNORE' )
+               );
+               $updateFields[] = array(
+                       'echo_email_batch',
+                       'eeb_user_id',
+                       'db' => $dbw,
+                       'options' => array( 'IGNORE' )
+               );
+               $updateFields[] = array(
+                       'echo_target_page',
+                       'etp_user',
+                       'db' => $dbw,
+                       'options' => array( 'IGNORE' )
+               );
 
                return true;
        }
diff --git a/Notifier.php b/Notifier.php
index fa99840..c58232d 100644
--- a/Notifier.php
+++ b/Notifier.php
@@ -48,17 +48,26 @@
 
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
                $userEmailNotifications = 
$attributeManager->getUserEnabledEvents( $user, 'email' );
-               // See if the user wants to receive emails for this category or 
the user is eligible to receive this email
+               // See if the user wants to receive emails for this category or 
the user is eligible to
+               // receive this email
                if ( in_array( $event->getType(), $userEmailNotifications ) ) {
-                       global $wgEchoEnableEmailBatch, $wgEchoNotifications, 
$wgNotificationSender, $wgNotificationReplyName, $wgEchoBundleEmailInterval;
+                       global $wgEchoEnableEmailBatch,
+                               $wgEchoNotifications,
+                               $wgNotificationSender,
+                               $wgNotificationReplyName,
+                               $wgEchoBundleEmailInterval;
 
                        $priority = $attributeManager->getNotificationPriority( 
$event->getType() );
 
                        $bundleString = $bundleHash = '';
 
-                       // We should have bundling for email digest as long as 
either web or email bundling is on, for example, talk page
-                       // email bundling is off, but if a user decides to 
receive email digest, we should bundle those messages
-                       if ( !empty( 
$wgEchoNotifications[$event->getType()]['bundle']['web'] ) || !empty( 
$wgEchoNotifications[$event->getType()]['bundle']['email'] ) ) {
+                       // We should have bundling for email digest as long as 
either web or email bundling is on, for
+                       // example, talk page email bundling is off, but if a 
user decides to receive email digest,
+                       // we should bundle those messages
+                       if (
+                               !empty( $wgEchoNotifications[ $event->getType() 
][ 'bundle' ][ 'web '] ) ||
+                               !empty( $wgEchoNotifications[ $event->getType() 
][ 'bundle' ][ 'email' ] )
+                       ) {
                                Hooks::run( 'EchoGetBundleRules', array( 
$event, &$bundleString ) );
                        }
                        if ( $bundleString ) {
@@ -82,7 +91,11 @@
                        $addedToQueue = false;
 
                        // only send bundle email if email bundling is on
-                       if ( $wgEchoBundleEmailInterval && $bundleHash && 
!empty( $wgEchoNotifications[$event->getType()]['bundle']['email'] ) ) {
+                       if (
+                               $wgEchoBundleEmailInterval &&
+                               $bundleHash &&
+                               !empty( $wgEchoNotifications[ $event->getType() 
][ 'bundle' ][ 'email' ] )
+                       ) {
                                $bundler = MWEchoEmailBundler::newFromUserHash( 
$user, $bundleHash );
                                if ( $bundler ) {
                                        $addedToQueue = 
$bundler->addToEmailBatch( $event->getId(), $priority );
diff --git a/includes/BatchRowUpdate.php b/includes/BatchRowUpdate.php
index 1a92b93..5e61cbf 100644
--- a/includes/BatchRowUpdate.php
+++ b/includes/BatchRowUpdate.php
@@ -70,7 +70,9 @@
         * @param EchoBatchRowWriter $writer Writer capable of pushing row 
updates to the database
         * @param EchoRowUpdateGenerator $generator Generates single row 
updates based on the rows content
         */
-       public function __construct( EchoBatchRowIterator $reader, 
EchoBatchRowWriter $writer, EchoRowUpdateGenerator $generator ) {
+       public function __construct(
+               EchoBatchRowIterator $reader, EchoBatchRowWriter $writer, 
EchoRowUpdateGenerator $generator
+       ) {
                $this->reader = $reader;
                $this->writer = $writer;
                $this->generator = $generator;
@@ -136,7 +138,8 @@
 interface EchoRowUpdateGenerator {
 
        /**
-        * Given a database row, generates an array mapping column names to 
updated value within the database row
+        * Given a database row, generates an array mapping column names to 
updated value within the
+        * database row
         *
         * Sample Response:
         *   return array(
@@ -145,8 +148,8 @@
         *   );
         *
         * @param stdClass $row A row from the database
-        * @return array Map of column names to updated value within the 
database row. When no update is required
-        *   returns an empty array.
+        * @return array Map of column names to updated value within the 
database row. When no update is
+        *   required, returns an empty array.
         */
        public function update( $row );
 }
@@ -186,8 +189,9 @@
 
        /**
         * @param array $updates Array of arrays each containing two keys, 
'primaryKey' and 'changes'.
-        *   primaryKey must contain a map of column names to values sufficient 
to uniquely identify the row
-        *   changes must contain a map of column names to update values to 
apply to the row
+        * - primaryKey must contain a map of column names to values sufficient 
to uniquely identify the
+        *   row
+        * - changes must contain a map of column names to update values to 
apply to the row
         */
        public function write( array $updates ) {
                $this->db->begin();
@@ -246,7 +250,8 @@
        protected $joinConditions = array();
 
        /**
-        * @var array $fetchColumns List of column names to select from the 
table suitable for use with DatabaseBase::select()
+        * @var array $fetchColumns List of column names to select from the 
table suitable for use with
+        *   DatabaseBase::select()
         */
        protected $fetchColumns;
 
@@ -297,7 +302,8 @@
        }
 
        /**
-        * @param array $columns List of column names to select from the table 
suitable for use with DatabaseBase::select()
+        * @param array $columns List of column names to select from the table 
suitable for use with
+        *   DatabaseBase::select()
         */
        public function setFetchColumns( array $columns ) {
                // If it's not the all column selector merge in the primary 
keys we need
@@ -452,4 +458,3 @@
                return implode( ' AND ', $conditions );
        }
 }
-
diff --git a/includes/ContainmentSet.php b/includes/ContainmentSet.php
index 95c1c8a..f4bff7d 100644
--- a/includes/ContainmentSet.php
+++ b/includes/ContainmentSet.php
@@ -60,10 +60,12 @@
         * from wiki pages is cached via the BagOStuff.  Caching is disabled 
when passing a null
         * $cache object.
         *
-        * @param $namespace      integer   An NS_* constant representing the 
mediawiki namespace of the page containing the list.
-        * @param $title          string    The title of the page containing 
the list.
-        * @param $cache          BagOStuff An object to cache the page with or 
null for no cache.
-        * @param $cacheKeyPrefix string    A prefix to be combined with the 
pages latest revision id and used as a cache key.
+        * @param $namespace integer An NS_* constant representing the 
mediawiki namespace of the page
+        *   containing the list.
+        * @param $title string The title of the page containing the list.
+        * @param $cache BagOStuff An object to cache the page with or null for 
no cache.
+        * @param $cacheKeyPrefix string A prefix to be combined with the pages 
latest revision id and
+        *   used as a cache key.
         *
         * @throws MWException
         */
@@ -193,13 +195,15 @@
        private $result;
 
        /**
-        * @param $cache           BagOStuff           Bag to stored cached 
data in.
-        * @param $partialCacheKey string              Partial cache key, 
$nestedList->getCacheKey() will be appended to this
-        *                                             to construct the cache 
key used.
-        * @param $nestedList      EchoContainmentList The nested 
EchoContainmentList to cache the result of.
-        * @param $timeout         integer             How long in seconds to 
cache the nested list, defaults to 1 week.
+        * @param $cache BagOStuff Bag to stored cached data in.
+        * @param $partialCacheKey string Partial cache key, 
$nestedList->getCacheKey() will be appended
+        *   to this to construct the cache key used.
+        * @param $nestedList EchoContainmentList The nested 
EchoContainmentList to cache the result of.
+        * @param $timeout integer How long in seconds to cache the nested 
list, defaults to 1 week.
         */
-       public function __construct( BagOStuff $cache, $partialCacheKey, 
EchoContainmentList $nestedList, $timeout = self::ONE_WEEK ) {
+       public function __construct(
+               BagOStuff $cache, $partialCacheKey, EchoContainmentList 
$nestedList, $timeout = self::ONE_WEEK
+       ) {
                $this->cache = $cache;
                $this->partialCacheKey = $partialCacheKey;
                $this->nestedList = $nestedList;
diff --git a/includes/DataOutputFormatter.php b/includes/DataOutputFormatter.php
index e508274..b49b19a 100644
--- a/includes/DataOutputFormatter.php
+++ b/includes/DataOutputFormatter.php
@@ -21,7 +21,9 @@
         * @param Language $lang Language to format the notification in
         * @return array|bool false if it could not be formatted
         */
-       public static function formatOutput( EchoNotification $notification, 
$format = false, User $user, Language $lang ) {
+       public static function formatOutput(
+               EchoNotification $notification, $format = false, User $user, 
Language $lang
+       ) {
                $event = $notification->getEvent();
                $timestamp = $notification->getTimestamp();
                $utcTimestampUnix = wfTimestamp( TS_UNIX, $timestamp );
diff --git a/includes/DiffParser.php b/includes/DiffParser.php
index f7ae626..cdffaef 100644
--- a/includes/DiffParser.php
+++ b/includes/DiffParser.php
@@ -62,7 +62,8 @@
        protected $changeSet;
 
        /**
-        * Get the set of add, subtract, and change operations required to 
transform leftText into rightText
+        * Get the set of add, subtract, and change operations required to 
transform leftText into
+        * rightText
         *
         * @param string $leftText The left, or old, revision of the text
         * @param string $rightText The right, or new, revision of the text
diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php
index ececc02..1729faf 100644
--- a/includes/DiscussionParser.php
+++ b/includes/DiscussionParser.php
@@ -51,7 +51,8 @@
                        // If the recipient is a valid non-anonymous user and 
hasn't turned
                        // off their notifications, generate a talk page post 
Echo notification.
                        if ( $notifyUser && $notifyUser->getID() ) {
-                               // if this is a minor edit, only notify if the 
agent doesn't have talk page minor edit notification blocked
+                               // if this is a minor edit, only notify if the 
agent doesn't have talk page minor edit
+                               // notification blocked
                                if ( !$revision->isMinor() || 
!$user->isAllowed( 'nominornewtalk' ) ) {
                                        $section = 
self::detectSectionTitleAndText( $interpretation, $title );
                                        if ( $section['section-text'] === '' ) {
@@ -625,7 +626,13 @@
                        $title = Title::newFromText( $match[0] );
 
                        // figure out if we the link is related to a user
-                       if ( $title && ( $title->getNamespace() === NS_USER || 
$title->getNamespace() === NS_USER_TALK ) ) {
+                       if (
+                               $title &&
+                               (
+                                       $title->getNamespace() === NS_USER ||
+                                       $title->getNamespace() === NS_USER_TALK
+                               )
+                       ) {
                                $usernames[] = $title->getText();
                        } elseif ( $title && $title->isSpecial( 'Contributions' 
) ) {
                                $parts = explode( '/', $title->getText(), 2 );
@@ -665,7 +672,12 @@
                        // discovered the signature from
                        // don't validate the username - anon (IP) is fine!
                        $user = User::newFromName( $username, false );
-                       $sig = $wgParser->preSaveTransform( '~~~', $title ?: 
Title::newMainPage(), $user, new ParserOptions() );
+                       $sig = $wgParser->preSaveTransform(
+                               '~~~',
+                               $title ?: Title::newMainPage(),
+                               $user,
+                               new ParserOptions()
+                       );
 
                        // see if we can find this user's generated signature 
in the content
                        $pos = strrpos( $line, $sig );
diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php
index d7d9ab6..06582f7 100644
--- a/includes/EmailBatch.php
+++ b/includes/EmailBatch.php
@@ -210,13 +210,19 @@
                // get the category for this event
                $category = $event->getCategory();
                $event->setBundleHash( $hash );
-               $email = EchoNotificationController::formatNotification( 
$event, $this->mUser, 'email', 'emaildigest' );
+               $email = EchoNotificationController::formatNotification(
+                       $event,
+                       $this->mUser,
+                       'email',
+                       'emaildigest'
+               );
 
                $this->content[$category][] = $email;
        }
 
        /**
-        * Clear "processed" events in the queue, processed could be: email 
sent, invalid, users do not want to receive emails
+        * Clear "processed" events in the queue, processed could be: email 
sent, invalid, users do not
+        * want to receive emails
         */
        public function clearProcessedEvent() {
                $conds = array( 'eeb_user_id' => $this->mUser->getId() );
diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php
index 22a4389..0cc3bee 100644
--- a/includes/EmailBundler.php
+++ b/includes/EmailBundler.php
@@ -252,7 +252,13 @@
                $replyAddress = new MailAddress( $wgNotificationSender, 
$wgNotificationReplyName );
 
                // Schedule a email job or just send the email directly?
-               UserMailer::send( $toAddress, $fromAddress, 
$content['subject'], $content['body'], $replyAddress );
+               UserMailer::send(
+                       $toAddress,
+                       $fromAddress,
+                       $content['subject'],
+                       $content['body'],
+                       $replyAddress
+               );
                MWEchoEventLogging::logSchemaEchoMail( $this->mUser, 'bundle' );
        }
 
@@ -266,7 +272,12 @@
                }
                $this->baseEvent->setBundleHash( $this->bundleHash );
 
-               return EchoNotificationController::formatNotification( 
$this->baseEvent, $this->mUser, 'email', 'email' );
+               return EchoNotificationController::formatNotification(
+                       $this->baseEvent,
+                       $this->mUser,
+                       'email',
+                       'email'
+               );
        }
 
        /**
diff --git a/includes/EmailFormatter.php b/includes/EmailFormatter.php
index 1e65dc6..04c68d4 100644
--- a/includes/EmailFormatter.php
+++ b/includes/EmailFormatter.php
@@ -318,6 +318,12 @@
         */
        public function getHTMLTemplate() {
                $alignStart = $this->lang->alignStart();
+               $font = "font-family: Arial, Helvetica, sans-serif;";
+               $fontA = $font . " font-size:13px; line-height:20px; 
color:#6D6E70;";
+               $fontB = $font . " line-height: 20px; font-weight: 600;";
+               $fontC = $font . " padding-top: 8px; font-size:13px; 
font-weight: bold; color: #58585B;";
+               $fontD = $font . " font-size:14px; padding-top: 25px;";
+               $fontE = $font . " font-size:10px; line-height:13px; 
color:#6D6E70; padding:10px 20px;";
 
                return <<< EOF
 <html><head>
@@ -329,7 +335,9 @@
                }
        </style>
 </head><body>
-<table cellspacing="0" cellpadding="0" border="0" width="100%" align="center" 
lang="{$this->lang->getCode()}" dir="{$this->lang->getDir()}">
+<table cellspacing="0" cellpadding="0" border="0"
+       width="100%" align="center"
+       lang="{$this->lang->getCode()}" dir="{$this->lang->getDir()}">
 <tr>
        <td bgcolor="#E6E7E8"><center>
                <br /><br />
@@ -341,21 +349,23 @@
                                <td bgcolor="#FFFFFF" width="5%">&nbsp;</td>
                        </tr><tr>
                                <td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>
-                               <td bgcolor="#FFFFFF" align="center" 
valign="top" rowspan="2"><img src="%%emailIcon%%" alt="" height="30" 
width="30"></td>
-                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="font-family: Arial, Helvetica, sans-serif; font-size:13px; 
line-height:20px; color:#6D6E70;">%%intro%%</td>
+                               <td bgcolor="#FFFFFF" align="center" 
valign="top" rowspan="2">
+                                       <img src="%%emailIcon%%" alt="" 
height="30" width="30">
+                               </td>
+                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="{$fontA}">%%intro%%</td>
                                <td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>
                        </tr><tr>
-                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="font-family: Arial, Helvetica, sans-serif; line-height: 20px; 
font-weight: 600;">
+                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="{$fontB}">
                                        <table cellspacing="0" cellpadding="0" 
border="0">
                                                <tr>
-                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="font-family: Arial, Helvetica, sans-serif; 
padding-top: 8px; font-size:13px; font-weight: bold; color: #58585B;">
+                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="{$fontC}">
                                                                %%summary%%
                                                        </td>
                                                </tr>
                                        </table>
                                        <table cellspacing="0" cellpadding="0" 
border="0">
                                                <tr>
-                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="font-family: Arial, Helvetica, sans-serif; 
font-size:14px; padding-top: 25px;">
+                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="{$fontD}">
                                                                %%action%%
                                                        </td>
                                                </tr>
@@ -369,7 +379,7 @@
                        </tr><tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
-                               <td align="{$alignStart}" style="font-family: 
Arial, Helvetica, sans-serif; font-size:10px; line-height:13px; color:#6D6E70; 
padding:10px 20px;"><br />
+                               <td align="{$alignStart}" style="{$fontE}"><br 
/>
                                        %%footer%%
                                        <br /><br />
                                </td>
@@ -385,7 +395,6 @@
 </body></html>
 EOF;
        }
-
 }
 
 /**
@@ -477,6 +486,12 @@
         */
        public function getHTMLTemplate() {
                $alignStart = $this->lang->alignStart();
+               $font = "font-family: Arial, Helvetica, sans-serif;";
+               $fontTitle = $font . " line-height: 20px; font-weight: 600;";
+               $fontFooter = $font . " font-size:10px; line-height:13px; 
color:#6D6E70; padding: 10px 20px;";
+               $fontMain = $font . " font-size:13px;";
+               $fontHeader = $fontMain . " line-height:20px; color:#6D6E70; 
text-align: center;";
+               $fontContent = $fontMain . " color: #58585B; padding-top: 
25px;";
 
                return <<< EOF
 <html><head>
@@ -488,7 +503,10 @@
                }
        </style>
 </head><body>
-<table cellspacing="0" cellpadding="0" border="0" width="100%" align="center" 
lang="{$this->lang->getCode()}" dir="{$this->lang->getDir()}">
+<table
+       cellspacing="0" cellpadding="0" border="0"
+       width="100%" align="center"
+       lang="{$this->lang->getCode()}" dir="{$this->lang->getDir()}">
 <tr>
        <td bgcolor="#E6E7E8"><center>
                <br /><br />
@@ -502,14 +520,14 @@
                        <tr>
                                <td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>
                                <td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>
-                               <td bgcolor="#FFFFFF" align="center" 
style="font-family: Arial, Helvetica, sans-serif; font-size:13px; 
line-height:20px; color:#6D6E70; text-align: center;">%%intro%%</td>
+                               <td bgcolor="#FFFFFF" align="center" 
style="{$fontHeader}">%%intro%%</td>
                                <td bgcolor="#FFFFFF" rowspan="2">&nbsp;</td>
                        </tr>
                        <tr>
-                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="font-family: Arial, Helvetica, sans-serif; line-height: 20px; 
font-weight: 600;">
+                               <td bgcolor="#FFFFFF" align="{$alignStart}" 
style="{$fontTitle}">
                                        <table cellspacing="0" cellpadding="0" 
border="0" width="100%">
                                                <tr>
-                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="font-family: Arial, Helvetica, sans-serif; 
font-size:13px; color: #58585B; padding-top: 25px;">
+                                                       <td bgcolor="#FFFFFF" 
align="{$alignStart}" style="{$fontContent}">
                                                                %%digestList%%
                                                        </td>
                                                </tr>
@@ -532,7 +550,7 @@
                        <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
-                               <td align="{$alignStart}" style="font-family: 
Arial, Helvetica, sans-serif; font-size:10px; line-height:13px; color:#6D6E70; 
padding: 10px 20px;"><br />
+                               <td align="{$alignStart}" 
style="{$fontFooter}"><br />
                                        %%footer%%
                                        <br /><br />
                                </td>
@@ -596,7 +614,9 @@
         * @param $message string
         * @return string
         */
-       public function decorateSingleAction( $notifFormatter, EchoEvent 
$event, User $user, $rank, $message );
+       public function decorateSingleAction(
+               $notifFormatter, EchoEvent $event, User $user, $rank, $message
+       );
 
        /**
         * Decorate a revision snippet
@@ -632,11 +652,18 @@
 
                // build the text section for each category
                foreach ( $digestList as $category => $notifs ) {
-                       $output = EchoEmailMode::message( 
'echo-category-title-' . $category, $user )->numParams( count( $notifs ) 
)->text()
-                               . EchoEmailMode::message( 'colon-separator', 
$user )->text() . "\n";
+                       $output = EchoEmailMode::message(
+                                       'echo-category-title-' . $category,
+                                       $user
+                               )->numParams( count( $notifs ) )->text()
+                               . EchoEmailMode::message( 'colon-separator', 
$user )->text()
+                               . "\n";
 
                        foreach ( $notifs as $notif ) {
-                               $output .= "\n " . EchoEmailMode::message( 
'echo-email-batch-bullet', $user )->text() . ' ' . $notif['batch-body'];
+                               $output .= "\n "
+                                       . EchoEmailMode::message( 
'echo-email-batch-bullet', $user )->text()
+                                       . ' '
+                                       . $notif['batch-body'];
                        }
                        $result[] = $output;
                }
@@ -656,11 +683,12 @@
         * {@inheritDoc}
         */
        public function decorateDigestAction( $title, User $user ) {
-               return EchoEmailMode::message( 
'echo-email-batch-link-text-view-all-notifications', $user )->text() .
-                       EchoEmailMode::message( 'colon-separator', $user 
)->text() .
-                       '<' .
-                       $title->getFullURL( '', false, PROTO_CANONICAL ) .
-                       '>';
+               return EchoEmailMode::message(
+                               
'echo-email-batch-link-text-view-all-notifications',
+                               $user
+                       )->text()
+                       . EchoEmailMode::message( 'colon-separator', $user 
)->text()
+                       . '<' . $title->getFullURL( '', false, PROTO_CANONICAL 
) . '>';
        }
 
        /**
@@ -678,7 +706,9 @@
        /**
         * {@inheritDoc}
         */
-       public function decorateSingleAction( $notifFormatter, EchoEvent 
$event, User $user, $rank, $message ) {
+       public function decorateSingleAction(
+               $notifFormatter, EchoEvent $event, User $user, $rank, $message
+       ) {
                $url = $notifFormatter->getLink( $event, $user, $rank, false, 
true );
 
                return EchoEmailMode::message( $message, $user )->text() .
@@ -779,7 +809,9 @@
        /**
         * {@inheritDoc}
         */
-       public function decorateSingleAction( $notifFormatter, EchoEvent 
$event, User $user, $rank, $message ) {
+       public function decorateSingleAction(
+               $notifFormatter, EchoEvent $event, User $user, $rank, $message
+       ) {
                if ( $rank === 'primary' ) {
                        $style = $this->getPrimaryLinkCSS();
                } else {
@@ -817,7 +849,10 @@
         * @return string
         */
        protected function getSecondaryLinkCSS() {
-               return 'text-decoration: none;font-size: 10px;font-family: 
Arial, Helvetica, sans-serif; color: #808184';
+               return 'text-decoration: none;'
+                       . 'font-size: 10px;'
+                       . 'font-family: Arial, Helvetica, sans-serif;'
+                       . 'color: #808184;';
        }
 
        /**
@@ -860,4 +895,3 @@
        }
 
 }
-
diff --git a/includes/NotifUser.php b/includes/NotifUser.php
index 7fcb0c0..a1596c0 100644
--- a/includes/NotifUser.php
+++ b/includes/NotifUser.php
@@ -171,7 +171,14 @@
        private function getHasMessagesKey() {
                global $wgEchoConfig;
 
-               return wfMemcKey( 'echo', 'user', 'had', 'messages', 
$this->mUser->getId(), $wgEchoConfig['version'] );
+               return wfMemcKey(
+                       'echo',
+                       'user',
+                       'had',
+                       'messages',
+                       $this->mUser->getId(),
+                       $wgEchoConfig['version']
+               );
        }
 
        /**
@@ -191,7 +198,11 @@
                        }
                }
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
-               $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', array( 
$section ) );
+               $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections(
+                       $this->mUser,
+                       'web',
+                       array( $section )
+               );
 
                $count = count( $this->notifMapper->fetchByUser( $this->mUser, 
1, 0, $eventTypesToLoad ) );
 
@@ -219,7 +230,9 @@
         * @param string $section Notification section
         * @return int
         */
-       public function getNotificationCount( $cached = true, $dbSource = 
DB_SLAVE, $section = EchoAttributeManager::ALL ) {
+       public function getNotificationCount(
+               $cached = true, $dbSource = DB_SLAVE, $section = 
EchoAttributeManager::ALL
+       ) {
                global $wgEchoConfig;
 
                if ( $this->mUser->isAnon() ) {
@@ -240,9 +253,16 @@
 
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
                if ( $section === EchoAttributeManager::ALL ) {
-                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEvents( $this->mUser, 'web' );
+                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEvents(
+                               $this->mUser,
+                               'web'
+                       );
                } else {
-                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', array( 
$section ) );
+                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections(
+                               $this->mUser,
+                               'web',
+                               array( $section )
+                       );
                }
 
                $count = $this->userNotifGateway->getNotificationCount( 
$dbSource, $eventTypesToLoad );
@@ -281,7 +301,9 @@
         * @param string $section Notification section
         * @return bool|MWTimestamp Timestamp of last notification, or false if 
there is none
         */
-       public function getLastUnreadNotificationTime( $cached = true, 
$dbSource = DB_SLAVE, $section = EchoAttributeManager::ALL ) {
+       public function getLastUnreadNotificationTime(
+               $cached = true, $dbSource = DB_SLAVE, $section = 
EchoAttributeManager::ALL
+       ) {
                global $wgEchoConfig;
 
                if ( $this->mUser->isAnon() ) {
@@ -289,7 +311,8 @@
                }
 
                $memcKey = wfMemcKey(
-                       'echo-notification-timestamp' . ( $section === 
EchoAttributeManager::ALL ? '' : ( '-' . $section ) ),
+                       'echo-notification-timestamp'
+                               . ( $section === EchoAttributeManager::ALL ? '' 
: ( '-' . $section ) ),
                        $this->mUser->getId(),
                        $wgEchoConfig['version']
                );
@@ -304,12 +327,24 @@
 
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
                if ( $section === EchoAttributeManager::ALL ) {
-                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEvents( $this->mUser, 'web' );
+                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEvents(
+                               $this->mUser,
+                               'web'
+                       );
                } else {
-                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', array( 
$section ) );
+                       $eventTypesToLoad = 
$attributeManager->getUserEnabledEventsbySections(
+                               $this->mUser,
+                               'web',
+                               array( $section )
+                       );
                }
 
-               $notifications = $this->notifMapper->fetchUnreadByUser( 
$this->mUser, 1, $eventTypesToLoad, $dbSource );
+               $notifications = $this->notifMapper->fetchUnreadByUser(
+                       $this->mUser,
+                       1,
+                       $eventTypesToLoad,
+                       $dbSource
+               );
                if ( $notifications ) {
                        $notification = reset( $notifications );
                        $timestamp = $notification->getTimestamp();
@@ -344,7 +379,12 @@
                        // After this 'mark read', is there any unread 
edit-user-talk
                        // remaining?  If not, we should clear the newtalk flag.
                        if ( $this->mUser->getNewtalk() ) {
-                               $unreadEditUserTalk = 
$this->notifMapper->fetchUnreadByUser( $this->mUser, 1, array( 'edit-user-talk' 
), DB_MASTER );
+                               $unreadEditUserTalk = 
$this->notifMapper->fetchUnreadByUser(
+                                       $this->mUser,
+                                       1,
+                                       array( 'edit-user-talk' ),
+                                       DB_MASTER
+                               );
                                if ( count( $unreadEditUserTalk ) === 0 ) {
                                        $this->mUser->setNewtalk( false );
                                }
@@ -379,7 +419,11 @@
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
                $eventTypes = 
$attributeManager->getUserEnabledEventsbySections( $this->mUser, 'web', 
$sections );
 
-               $notifs = $this->notifMapper->fetchUnreadByUser( $this->mUser, 
$wgEchoMaxUpdateCount, $eventTypes );
+               $notifs = $this->notifMapper->fetchUnreadByUser(
+                       $this->mUser,
+                       $wgEchoMaxUpdateCount,
+                       $eventTypes
+               );
 
                $eventIds = array_filter(
                        array_map( function ( EchoNotification $notif ) {
@@ -429,7 +473,11 @@
         * @param string $section
         * @return string
         */
-       public function getFormattedNotificationCount( $cached = true, 
$dbSource = DB_SLAVE, $section = EchoAttributeManager::ALL ) {
+       public function getFormattedNotificationCount(
+               $cached = true,
+               $dbSource = DB_SLAVE,
+               $section = EchoAttributeManager::ALL
+       ) {
                return EchoNotificationController::formatNotificationCount(
                        $this->getNotificationCount( $cached, $dbSource, 
$section )
                );
diff --git a/includes/api/ApiEchoMarkRead.php b/includes/api/ApiEchoMarkRead.php
index 2920c5f..2e7f926 100644
--- a/includes/api/ApiEchoMarkRead.php
+++ b/includes/api/ApiEchoMarkRead.php
@@ -36,7 +36,9 @@
                foreach ( EchoAttributeManager::$sections as $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/ApiEchoNotifications.php 
b/includes/api/ApiEchoNotifications.php
index e1f4e83..66519c4 100644
--- a/includes/api/ApiEchoNotifications.php
+++ b/includes/api/ApiEchoNotifications.php
@@ -71,9 +71,15 @@
         * @param boolean $unreadFirst
         * @return array
         */
-       protected function getSectionPropList( User $user, $section, $limit, 
$continue, $format, $unreadFirst = false ) {
+       protected function getSectionPropList(
+               User $user, $section, $limit, $continue, $format, $unreadFirst 
= false
+       ) {
                $attributeManager = EchoAttributeManager::newFromGlobalVars();
-               $sectionEvents = 
$attributeManager->getUserEnabledEventsbySections( $user, 'web', array( 
$section ) );
+               $sectionEvents = 
$attributeManager->getUserEnabledEventsbySections(
+                       $user,
+                       'web',
+                       array( $section )
+               );
 
                if ( !$sectionEvents ) {
                        $result = array(
@@ -101,7 +107,9 @@
         * @param boolean $unreadFirst
         * @return array
         */
-       protected function getPropList( User $user, array $eventTypes, $limit, 
$continue, $format, $unreadFirst = false ) {
+       protected function getPropList(
+               User $user, array $eventTypes, $limit, $continue, $format, 
$unreadFirst = false
+       ) {
                $result = array(
                        'list' => array(),
                        'continue' => null
diff --git a/includes/controller/NotificationController.php 
b/includes/controller/NotificationController.php
index c62d8ca..a71a4df 100644
--- a/includes/controller/NotificationController.php
+++ b/includes/controller/NotificationController.php
@@ -355,7 +355,9 @@
         * @return string|array The formatted notification, or an array of 
subject
         *     and body (for emails), or an error message
         */
-       public static function formatNotification( EchoEvent $event, User 
$user, $format = 'text', $type = 'web' ) {
+       public static function formatNotification(
+               EchoEvent $event, User $user, $format = 'text', $type = 'web'
+       ) {
                $eventType = $event->getType();
 
                $res = '';
diff --git a/includes/formatters/BasicFormatter.php 
b/includes/formatters/BasicFormatter.php
index 47d539d..d9bf5be 100644
--- a/includes/formatters/BasicFormatter.php
+++ b/includes/formatters/BasicFormatter.php
@@ -138,7 +138,10 @@
                );
 
                // default flyout-message to title-message if not defined
-               $params += array( 'flyout-message' => $params['title-message'], 
'flyout-params' => $params['title-params'] );
+               $params += array(
+                       'flyout-message' => $params['title-message'],
+                       'flyout-params' => $params['title-params']
+               );
 
                return $params;
        }
@@ -506,7 +509,9 @@
                                $options = array( 'https' );
                        }
 
-                       return array( Message::rawParam( Linker::link( $title, 
$linkText, $attribs, $param, $options ) ) );
+                       return array(
+                               Message::rawParam( Linker::link( $title, 
$linkText, $attribs, $param, $options ) )
+                       );
                } elseif ( $this->outputFormat === 'email' ) {
                        $url = $title->getFullURL( $param, false, PROTO_HTTPS );
 
@@ -684,7 +689,9 @@
         *     'border: 1px solid green; text-decoration: none;' (optional)
         * @return String URL for link, or HTML for anchor tag, or empty string
         */
-       public function getLink( $event, $user, $rank = 'primary', $local = 
true, $urlOnly = false, $style = '' ) {
+       public function getLink(
+               $event, $user, $rank = 'primary', $local = true, $urlOnly = 
false, $style = ''
+       ) {
                $destination = $event->getLinkDestination( $rank );
                if ( !$destination ) {
                        return '';
diff --git a/includes/formatters/NotificationFormatter.php 
b/includes/formatters/NotificationFormatter.php
index f0f03eb..afec1ba 100644
--- a/includes/formatters/NotificationFormatter.php
+++ b/includes/formatters/NotificationFormatter.php
@@ -58,7 +58,8 @@
 
        /**
         * Set the output format that the notification will be displayed in.
-        * @param $format string A valid output format (by default, 'text', 
'html', 'flyout', and 'email' are allowed)
+        * @param $format string A valid output format (by default, 'text', 
'html', 'flyout', and 'email'
+        *   are allowed)
         * @throws InvalidArgumentException
         */
        public function setOutputFormat( $format ) {
@@ -157,7 +158,9 @@
                // Might be an array with different icons for ltr/rtl
                if ( is_array( $iconUrl ) ) {
                        if ( !isset( $iconUrl[$dir] ) ) {
-                               throw new UnexpectedValueException( "Icon type 
$icon doesn't have an icon for $dir directionality" );
+                               throw new UnexpectedValueException(
+                                       "Icon type $icon doesn't have an icon 
for $dir directionality"
+                               );
                        }
 
                        $iconUrl = $iconUrl[$dir];
diff --git a/includes/jobs/NotificationEmailBundleJob.php 
b/includes/jobs/NotificationEmailBundleJob.php
index fbb4ff8..b925a56 100644
--- a/includes/jobs/NotificationEmailBundleJob.php
+++ b/includes/jobs/NotificationEmailBundleJob.php
@@ -18,7 +18,10 @@
                if ( $bundle ) {
                        $bundle->processBundleEmail();
                } else {
-                       throw new MWException( 'Fail to create bundle object 
for: user_id: ' . $this->params['user_id'] . ', bundle_hash: ' . 
$this->params['bundle_hash'] );
+                       throw new MWException(
+                               'Fail to create bundle object for: user_id: ' . 
$this->params['user_id']
+                                       . ', bundle_hash: ' . 
$this->params['bundle_hash']
+                       );
                }
 
                return true;
diff --git a/includes/mapper/EventMapper.php b/includes/mapper/EventMapper.php
index 3bd90d6..fe38669 100644
--- a/includes/mapper/EventMapper.php
+++ b/includes/mapper/EventMapper.php
@@ -44,7 +44,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', '*', array( 'event_id' => 
$id ), __METHOD__ );
 
@@ -67,7 +69,9 @@
         * @param $limit int
         * @return EchoEvent[]|bool
         */
-       public function fetchByUserBundleHash( User $user, $bundleHash, $type = 
'web', $order = 'DESC', $limit = 250 ) {
+       public function fetchByUserBundleHash(
+               User $user, $bundleHash, $type = 'web', $order = 'DESC', $limit 
= 250
+       ) {
                $dbr = $this->dbFactory->getEchoDb( DB_SLAVE );
 
                // We only display 99+ if the number is over 100, we can do 
limit 250, this should
@@ -75,7 +79,8 @@
                // for the following reason:
                // 1. it will not scale for large volume data
                // 2. notification may have random grouping iterator
-               // 3. agent may be anonymous, can't do distinct over two 
columns: event_agent_id and event_agent_ip
+               // 3. agent may be anonymous, can't do distinct over two 
columns: event_agent_id and
+               //    event_agent_ip
                if ( $type == 'web' ) {
                        $res = $dbr->select(
                                array( 'echo_notification', 'echo_event' ),
diff --git a/includes/mapper/NotificationMapper.php 
b/includes/mapper/NotificationMapper.php
index b35a88d..1818a87 100644
--- a/includes/mapper/NotificationMapper.php
+++ b/includes/mapper/NotificationMapper.php
@@ -99,7 +99,9 @@
         * @param int $dbSource Use master or slave database to pull count
         * @return EchoNotification[]
         */
-       public function fetchUnreadByUser( User $user, $limit, array 
$eventTypes = array(), $dbSource = DB_SLAVE ) {
+       public function fetchUnreadByUser(
+               User $user, $limit, array $eventTypes = array(), $dbSource = 
DB_SLAVE
+       ) {
                $data = array();
 
                if ( !$eventTypes ) {
@@ -144,7 +146,9 @@
         * @param array $excludeEventIds Event id's to exclude.
         * @return EchoNotification[]
         */
-       public function fetchByUser( User $user, $limit, $continue, array 
$eventTypes = array(), array $excludeEventIds = array() ) {
+       public function fetchByUser(
+               User $user, $limit, $continue, array $eventTypes = array(), 
array $excludeEventIds = array()
+       ) {
                $dbr = $this->dbFactory->getEchoDb( DB_SLAVE );
 
                if ( !$eventTypes ) {
@@ -174,7 +178,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(
@@ -188,7 +193,10 @@
                        ),
                        array(
                                'echo_event' => array( 'LEFT JOIN', 
'notification_event=event_id' ),
-                               'echo_target_page' => array( 'LEFT JOIN', 
array( 'notification_event=etp_event', 'notification_user=etp_user' ) ),
+                               'echo_target_page' => array(
+                                       'LEFT JOIN',
+                                       array( 'notification_event=etp_event', 
'notification_user=etp_user' )
+                               ),
                        )
                );
 
diff --git a/includes/model/Notification.php b/includes/model/Notification.php
index 326fd29..225ecae 100644
--- a/includes/model/Notification.php
+++ b/includes/model/Notification.php
@@ -138,18 +138,22 @@
                $user = $this->user;
                $targetPages = self::resolveTargetPages( $event->getExtraParam( 
'target-page' ) );
                if ( $targetPages ) {
-                       $notifMapper->attachListener( 'insert', 
'add-target-page', function () use ( $event, $user, $eventIds, $targetPages ) {
-                               $targetMapper = new EchoTargetPageMapper();
-                               if ( $eventIds ) {
-                                       $targetMapper->deleteByUserEvents( 
$user, $eventIds );
-                               }
-                               foreach ( $targetPages as $title ) {
-                                       $targetPage = EchoTargetPage::create( 
$user, $title, $event );
-                                       if ( $targetPage ) {
-                                               $targetMapper->insert( 
$targetPage );
+                       $notifMapper->attachListener(
+                               'insert',
+                               'add-target-page',
+                               function () use ( $event, $user, $eventIds, 
$targetPages ) {
+                                       $targetMapper = new 
EchoTargetPageMapper();
+                                       if ( $eventIds ) {
+                                               
$targetMapper->deleteByUserEvents( $user, $eventIds );
+                                       }
+                                       foreach ( $targetPages as $title ) {
+                                               $targetPage = 
EchoTargetPage::create( $user, $title, $event );
+                                               if ( $targetPage ) {
+                                                       $targetMapper->insert( 
$targetPage );
+                                               }
                                        }
                                }
-                       } );
+                       );
                }
 
                $notifUser = MWEchoNotifUser::newFromUser( $user );
diff --git a/includes/special/SpecialNotifications.php 
b/includes/special/SpecialNotifications.php
index 0dcbcb7..8c213fa 100644
--- a/includes/special/SpecialNotifications.php
+++ b/includes/special/SpecialNotifications.php
@@ -51,7 +51,12 @@
                        $attributeManager->getUserEnabledEvents( $user, 'web' )
                );
                foreach ( $notifications as $notification ) {
-                       $output = EchoDataOutputFormatter::formatOutput( 
$notification, 'html', $user, $this->getLanguage() );
+                       $output = EchoDataOutputFormatter::formatOutput(
+                               $notification,
+                               'html',
+                               $user,
+                               $this->getLanguage()
+                       );
                        if ( $output ) {
                                $notif[] = $output;
                        }
diff --git a/maintenance/testDiscussionParser.php 
b/maintenance/testDiscussionParser.php
index 0f84dc7..4c25fbb 100644
--- a/maintenance/testDiscussionParser.php
+++ b/maintenance/testDiscussionParser.php
@@ -82,7 +82,12 @@
                        $user = $pageData['revisions'][0]['user'];
 
                        print 
"http://en.wikipedia.org/w/index.php?diff=prev&oldid=$revid\n";;
-                       EchoDiscussionParser::getInterestedUsers( $oldText, 
$newText, $user ); // FIXME: getInterestedUsers() is undefined
+                       // FIXME: getInterestedUsers() is undefined
+                       EchoDiscussionParser::getInterestedUsers(
+                               $oldText,
+                               $newText,
+                               $user
+                       );
                }
        }
 }
diff --git a/maintenance/updateEchoSchemaForSuppression.php 
b/maintenance/updateEchoSchemaForSuppression.php
index 1f186f1..7184910 100644
--- a/maintenance/updateEchoSchemaForSuppression.php
+++ b/maintenance/updateEchoSchemaForSuppression.php
@@ -34,7 +34,12 @@
        public function execute() {
                global $wgEchoCluster;
 
-               $reader = new EchoBatchRowIterator( MWEchoDbFactory::getDB( 
DB_SLAVE ), $this->table, $this->idField, $this->mBatchSize );
+               $reader = new EchoBatchRowIterator(
+                       MWEchoDbFactory::getDB( DB_SLAVE ),
+                       $this->table,
+                       $this->idField,
+                       $this->mBatchSize
+               );
                $reader->addConditions( array(
                        "event_page_title IS NOT NULL",
                        "event_page_id" => null,
diff --git a/phpcs.xml b/phpcs.xml
index a32c10e..7c7e43c 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,9 +1,7 @@
 <?xml version="1.0"?>
 <ruleset name="MediaWiki">
        <file>.</file>
-       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
-               <exclude name="Generic.Files.LineLength"/>
-       </rule>
+       <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
        <arg name="encoding" value="utf8"/>
        <arg name="extensions" value="php,php5,inc"/>
        <arg name="colors"/>
diff --git a/tests/phpunit/AttributeManagerTest.php 
b/tests/phpunit/AttributeManagerTest.php
index 201230d..52f49d3 100644
--- a/tests/phpunit/AttributeManagerTest.php
+++ b/tests/phpunit/AttributeManagerTest.php
@@ -225,7 +225,10 @@
                        )
                );
                $manager = new EchoAttributeManager( $notif, $category );
-               $this->assertEquals( $manager->getAlertEvents(), array( 
'event_two', 'event_three', 'event_four' ) );
+               $this->assertEquals(
+                       $manager->getAlertEvents(),
+                       array( 'event_two', 'event_three', 'event_four' )
+               );
        }
 
        public function testGetUserEnabledEvents() {
@@ -258,7 +261,10 @@
                        ),
                );
                $manager = new EchoAttributeManager( $notif, $category );
-               $this->assertEquals( $manager->getUserEnabledEvents( 
$this->mockUser(), 'web' ), array( 'event_two', 'event_three' ) );
+               $this->assertEquals(
+                       $manager->getUserEnabledEvents( $this->mockUser(), 
'web' ),
+                       array( 'event_two', 'event_three' )
+               );
        }
 
        public function testGetUserEnabledEventsbySections() {
@@ -297,13 +303,21 @@
                $this->assertEquals( $actual, $expected );
 
                $expected = array( 'event_two' );
-               $actual = $manager->getUserEnabledEventsBySections( 
$this->mockUser(), 'web', array( 'message' ) );
+               $actual = $manager->getUserEnabledEventsBySections(
+                       $this->mockUser(),
+                       'web',
+                       array( 'message' )
+               );
                sort( $expected );
                sort( $actual );
                $this->assertEquals( $actual, $expected );
 
                $expected = array( 'event_one', 'event_two', 'event_three', 
'event_four' );
-               $actual = $manager->getUserEnabledEventsBySections( 
$this->mockUser(), 'web', array( 'message', 'alert' ) );
+               $actual = $manager->getUserEnabledEventsBySections(
+                       $this->mockUser(),
+                       'web',
+                       array( 'message', 'alert' )
+               );
                sort( $expected );
                sort( $actual );
                $this->assertEquals( $actual, $expected );
diff --git a/tests/phpunit/BatchRowUpdateTest.php 
b/tests/phpunit/BatchRowUpdateTest.php
index ecb2360..3e890df 100644
--- a/tests/phpunit/BatchRowUpdateTest.php
+++ b/tests/phpunit/BatchRowUpdateTest.php
@@ -84,7 +84,12 @@
         * @dataProvider provider_readerGetPrimaryKey
         */
        public function testReaderGetPrimaryKey( $message, array $expected, 
array $row ) {
-               $reader = new EchoBatchRowIterator( $this->mockDb(), 
'some_table', array_keys( $expected ), 8675309 );
+               $reader = new EchoBatchRowIterator(
+                       $this->mockDb(),
+                       'some_table',
+                       array_keys( $expected ),
+                       8675309
+               );
                $this->assertEquals( $expected, $reader->extractPrimaryKeys( 
(object)$row ), $message );
        }
 
@@ -127,7 +132,9 @@
        /**
         * @dataProvider provider_readerSetFetchColumns
         */
-       public function testReaderSetFetchColumns( $message, array $columns, 
array $primaryKeys, array $fetchColumns ) {
+       public function testReaderSetFetchColumns(
+               $message, array $columns, array $primaryKeys, array 
$fetchColumns
+       ) {
                $db = $this->mockDb();
                $db->expects( $this->once() )
                        ->method( 'select' )
@@ -152,7 +159,7 @@
                        ),
 
                        array(
-                               'With multiple primary keys the first 
conditions must use >= and the final condition must use >',
+                               'With multiple primary keys the first 
conditions must use >= + the final condition must use >',
                                // Expected second iteration
                                array( "( id_field = '3' AND foo > '103' ) OR ( 
id_field > '3' )" ),
                                // Primary key(s)
@@ -168,7 +175,9 @@
         *
         * @dataProvider provider_readerSelectConditions
         */
-       public function testReaderSelectConditionsMultiplePrimaryKeys( 
$message, $expectedSecondIteration, $primaryKeys, $batchSize = 3 ) {
+       public function testReaderSelectConditionsMultiplePrimaryKeys(
+               $message, $expectedSecondIteration, $primaryKeys, $batchSize = 3
+       ) {
                $results = $this->genSelectResult( $batchSize, $batchSize * 3, 
function () {
                        static $i = 0, $j = 100, $k = 1000;
 
diff --git a/tests/phpunit/DiscussionParserTest.php 
b/tests/phpunit/DiscussionParserTest.php
index 4d69639..bb57495 100644
--- a/tests/phpunit/DiscussionParserTest.php
+++ b/tests/phpunit/DiscussionParserTest.php
@@ -48,7 +48,9 @@
                        'fancysig' => '1',
                ),
                'Reverta-me' => array(
-                       'nickname' => "[[User:Reverta-me|<span 
style=\"font-size:13px; color:blue;font-family:Lucida 
Handwriting;text-shadow:aqua 5px 3px 12px;\">Aaaaa Bbbbbbb</span>]]'' 
<sup>[[User Talk:Reverta-me|<font color=\"gold\" face=\"Lucida 
Calligraphy\">Discussão</font>]]</sup>''",
+                       'nickname' => "[[User:Reverta-me|<span 
style=\"font-size:13px; color:blue;font-family:Lucida"
+                               . " Handwriting;text-shadow:aqua 5px 3px 
12px;\">Aaaaa Bbbbbbb</span>]]'' <sup>[[User Talk:"
+                               . "Reverta-me|<font color=\"gold\" 
face=\"Lucida Calligraphy\">Discussão</font>]]</sup>''",
                        'fancysig' => '1',
                ),
                'Jorm' => array(
@@ -76,7 +78,8 @@
                        'fancysig' => '1',
                ),
                'Cwobeel' => array(
-                       'nickname' => '[[User:Cwobeel|<span 
style="color:#339966">Cwobeel</span>]] [[User_talk:Cwobeel|<span 
style="font-size:80%">(talk)</span>]]',
+                       'nickname' => '[[User:Cwobeel|<span 
style="color:#339966">Cwobeel</span>]]'
+                               . ' [[User_talk:Cwobeel|<span 
style="font-size:80%">(talk)</span>]]',
                        'fancysig' => '1',
                ),
                'Bob K31416' => array(
@@ -92,7 +95,9 @@
                        'fancysig' => '0',
                ),
                'PauloEduardo' => array(
-                       'nickname' => "[[User:PauloEduardo|<span 
style=\"font-size:13px; color:blue;font-family:Lucida 
Handwriting;text-shadow:aqua 5px 3px 12px;\">Paulo Eduardo</span>]]'' 
<sup>[[User Talk:PauloEduardo|<font color=\"gold\" face=\"Lucida 
Calligraphy\">Discussão</font>]]</sup>''",
+                       'nickname' => "[[User:PauloEduardo|<span 
style=\"font-size:13px; color:blue;font-family:Lucida"
+                               . " Handwriting;text-shadow:aqua 5px 3px 
12px;\">Paulo Eduardo</span>]]'' <sup>[[User Talk:"
+                               . "PauloEduardo|<font color=\"gold\" 
face=\"Lucida Calligraphy\">Discussão</font>]]</sup>''",
                        'fancysig' => '1',
                ),
                'PatHadley' => array(
@@ -169,7 +174,8 @@
                                'lang' => 'en',
                                'pages' => array(
                                        // pages expected to exist (e.g. 
templates to be expanded)
-                                       'Template:u' => 
'[[User:{{{1}}}|{{<includeonly>safesubst:</includeonly>#if:{{{2|}}}|{{{2}}}|{{{1}}}}}]]<noinclude>{{documentation}}</noinclude>',
+                                       'Template:u' => 
'[[User:{{{1}}}|{{<includeonly>safesubst:</includeonly>#if:{{{2|}}}|{{{2}}}|'
+                                       . 
'{{{1}}}}}]]<noinclude>{{documentation}}</noinclude>',
                                ),
                                'title' => 'UTPage', // can't remember, not 
important here
                                'expected' => array(
@@ -208,7 +214,9 @@
                                'username' => 'PauloEduardo',
                                'lang' => 'pt',
                                'pages' => array(
-                                       'Predefinição:U' => 
'[[User:{{{1|<noinclude>Exemplo</noinclude>}}}|{{{{{|safesubst:}}}#if:{{{2|}}}|{{{2}}}|{{{1|<noinclude>Exemplo</noinclude>}}}}}]]<noinclude>{{Atalho|Predefinição:U}}{{Documentação|Predefinição:Usuário/doc}}</noinclude>',
+                                       'Predefinição:U' => 
'[[User:{{{1|<noinclude>Exemplo</noinclude>}}}|{{{{{|safesubst:}}}#if:'
+                                               . 
'{{{2|}}}|{{{2}}}|{{{1|<noinclude>Exemplo</noinclude>}}}}}]]<noinclude>{{Atalho'
+                                               . 
'|Predefinição:U}}{{Documentação|Predefinição:Usuário/doc}}</noinclude>',
                                ),
                                'title' => 'UTPage', // can't remember, not 
important here
                                'expected' => array(
@@ -225,13 +233,21 @@
                                'lang' => 'en',
                                'pages' => array(
                                        'Template:ping' => 
'{{SAFESUBST:<noinclude />#if:{{{1|<noinclude>$</noinclude>}}}
- |<span class="template-ping">@[[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{1|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label1|{{{1|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{2|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{2|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label2|{{{2|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{3|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{3|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label3|{{{3|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{4|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{4|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label4|{{{4|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{5|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{5|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label5|{{{5|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{6|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{6|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label6|{{{6|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{7|}}}
- |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{7|Example}}}}}|{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{label7|{{{7|Example}}}}}}}}]]
+ |<span class="template-ping">@[[:User:{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{1|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label1|{{{1|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{2|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{2|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label2|{{{2|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{3|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{3|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label3|{{{3|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{4|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{4|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label4|{{{4|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{5|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{5|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label5|{{{5|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{6|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{6|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label6|{{{6|Example}}}}}}}}]]{{SAFESUBST:<noinclude 
/>#if:{{{7|}}}
+ |, [[:User:{{SAFESUBST:<noinclude 
/>BASEPAGENAME:{{{7|Example}}}}}|{{SAFESUBST:<noinclude />'
+       . 'BASEPAGENAME:{{{label7|{{{7|Example}}}}}}}}]]
       }}
      }}
     }}
@@ -243,7 +259,8 @@
 
 {{documentation}}
 </noinclude>',
-                                       'MediaWiki:Signature' => 
'[[User:$1|$2]] {{#ifeq:{{FULLPAGENAME}}|User talk:$1|([[User 
talk:$1#top|talk]])|([[User talk:$1|talk]])}}',
+                                       'MediaWiki:Signature' => 
'[[User:$1|$2]] {{#ifeq:{{FULLPAGENAME}}|User talk:$1|([[User talk'
+                                               . ':$1#top|talk]])|([[User 
talk:$1|talk]])}}',
                                ),
                                'title' => 'User_talk:PatHadley',
                                'expected' => array(
@@ -264,7 +281,8 @@
                                'username' => 'Kudpung',
                                'lang' => 'en',
                                'pages' => array(
-                                       'Template:U' => 
'[[User:{{{1}}}|{{<includeonly>safesubst:</includeonly>#if:{{{2|}}}|{{{2}}}|{{{1}}}}}]]<noinclude>{{documentation}}</noinclude>',
+                                       'Template:U' => 
'[[User:{{{1}}}|{{<includeonly>safesubst:</includeonly>#if:{{{2|}}}|"
+                                       . 
"{{{2}}}|{{{1}}}}}]]<noinclude>{{documentation}}</noinclude>',
                                ),
                                'title' => 'User_talk:Kudpung',
                                'expected' => array(
@@ -304,7 +322,9 @@
        /**
         * @dataProvider generateEventsForRevisionData
         */
-       public function testGenerateEventsForRevision( $newId, $oldId, 
$username, $lang, $pages, $title, $expected, $precondition = '' ) {
+       public function testGenerateEventsForRevision(
+               $newId, $oldId, $username, $lang, $pages, $title, $expected, 
$precondition = ''
+       ) {
                if ( $precondition !== '' ) {
                        $result = $this->$precondition();
                        if ( $result !== true ) {
@@ -492,7 +512,8 @@
                        ),
                        // Talk page link only
                        array(
-                               "[[User:Swalling|Steve]] is the best person I 
have ever met. --[[User talk:Werdna3|Andrew]] $ts",
+                               "[[User:Swalling|Steve]] is the best person I 
have ever met."
+                               . " --[[User talk:Werdna3|Andrew]] $ts",
                                array(
                                        62,
                                        'Werdna3'
@@ -500,7 +521,8 @@
                        ),
                        // Anonymous user
                        array(
-                               "I am anonymous because I like my IP address. 
--[[Special:Contributions/127.0.0.1|127.0.0.1]] $ts",
+                               "I am anonymous because I like my IP address."
+                               . " 
--[[Special:Contributions/127.0.0.1|127.0.0.1]] $ts",
                                array(
                                        47,
                                        '127.0.0.1'
@@ -545,7 +567,10 @@
                        ),
                        // extra long signature
                        array(
-                               "{{U|He7d3r}}, 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxã? [[User:Reverta-me|<span 
style=\"font-size:13px; color:blue;font-family:Lucida 
Handwriting;text-shadow:aqua 5px 3px 12px;\">Aaaaa Bbbbbbb</span>]]'' 
<sup>[[User Talk:Reverta-me|<font color=\"gold\" face=\"Lucida 
Calligraphy\">Discussão</font>]]</sup>''",
+                               "{{U|He7d3r}}, 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxã? [[User:Reverta-me|<span style=\""
+                               . "font-size:13px; 
color:blue;font-family:Lucida Handwriting;text-shadow:aqua 5px 3px 12px;\">"
+                               . "Aaaaa Bbbbbbb</span>]]'' <sup>[[User 
Talk:Reverta-me|<font color=\"gold\" face=\""
+                               . "Lucida 
Calligraphy\">Discussão</font>]]</sup>''",
                                array(
                                        strlen( "{{U|He7d3r}}, 
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxã? " ),
                                        'Reverta-me',
@@ -873,21 +898,34 @@
                        array(
                                'Bug T78424',
                                EchoDiscussionParser::getMachineReadableDiff(
-                                       <<<TEXT
-== Washington Post Reception Source ==
-
-''The Boston Post'' source that was used in the reception section has a couple 
of problems. First, it's actually a repost of ''The Washington Post'', but 
''The Washington Post'' doesn't allow the Internet Archive to preserve it. 
Should it still be sourced to Boston or to Washington? Second, it seems to be a 
lot of analysis that can't be summed up easily without trimming it out, and 
doesn't really fit with the reception section and should probably moved next to 
Wilson's testimony. Any suggestions? --[[User:RAN1|RAN1]] ([[User 
talk:RAN1|talk]]) 01:44, 11 December 2014 (UTC)
-TEXT
-,
-                                       <<<TEXT
-== Washington Post Reception Source ==
-
-''The Boston Post'' source that was used in the reception section has a couple 
of problems. First, it's actually a repost of ''The Washington Post'', but 
''The Washington Post'' doesn't allow the Internet Archive to preserve it. 
Should it still be sourced to Boston or to Washington? Second, it seems to be a 
lot of analysis that can't be summed up easily without trimming it out, and 
doesn't really fit with the reception section and should probably moved next to 
Wilson's testimony. Any suggestions? --[[User:RAN1|RAN1]] ([[User 
talk:RAN1|talk]]) 01:44, 11 December 2014 (UTC)
-
-== Grand jury no bill reception ==
-
-{{u|Bob K31416}} has started a process of summarizing that section, in a 
manner that I believe it to be counter productive. We have expert opinions from 
legal, law enforcement, politicians, and media outlets all of which are notable 
and informative. [[WP:NOTPAPER|Wikipedia is not paper]] – If the section is too 
long, the correct process to avoid losing good content that is well sources, is 
to create a sub-article with all the detail, and summarize here per 
[[WP:SUMMARY]]. But deleting useful and well sourced material, is not 
acceptable. We are here to build an encyclopedia. - [[User:Cwobeel|<span 
style="color:#339966">Cwobeel</span>]] [[User_talk:Cwobeel|<span 
style="font-size:80%">(talk)</span>]] 16:02, 11 December 2014 (UTC)
-TEXT
+                                       "== Washington Post Reception Source 
==\n\n"
+                                               . "''The Boston Post'' source 
that was used in the"
+                                               . " reception section has a 
couple of problems. First, it's actually a repost of ''The"
+                                               . " Washington Post'', but 
''The Washington Post'' doesn't allow the Internet Archive to"
+                                               . " preserve it. Should it 
still be sourced to Boston or to Washington? Second, it seems to"
+                                               . " be a lot of analysis that 
can't be summed up easily without trimming it out, and"
+                                               . " doesn't really fit with the 
reception section and should probably moved next to Wilson's"
+                                               . " testimony. Any suggestions?"
+                                               . " --[[User:RAN1|RAN1]] 
([[User talk:RAN1|talk]]) 01:44, 11 December 2014 (UTC)",
+                                       "== Washington Post Reception Source 
==\n\n"
+                                               . "''The Boston Post'' source 
that was used in the"
+                                               . " reception section has a 
couple of problems. First, it's actually a repost of ''The"
+                                               . " Washington Post'', but 
''The Washington Post'' doesn't allow the Internet Archive to"
+                                               . " preserve it. Should it 
still be sourced to Boston or to Washington? Second, it seems to"
+                                               . " be a lot of analysis that 
can't be summed up easily without trimming it out, and"
+                                               . " doesn't really fit with the 
reception section and should probably moved next to Wilson's"
+                                               . " testimony. Any suggestions?"
+                                               . " --[[User:RAN1|RAN1]] 
([[User talk:RAN1|talk]]) 01:44, 11 December 2014 (UTC)"
+                                               . "== Grand jury no bill 
reception ==\n\n"
+                                               . "{{u|Bob K31416}} has started 
a process of summarizing that section, in a manner that I"
+                                               . " believe it to be counter 
productive. We have expert opinions from legal, law enforcement,"
+                                               . " politicians, and media 
outlets all of which are notable and informative. [[WP:NOTPAPER|"
+                                               . "Wikipedia is not paper]] – 
If the section is too long, the correct process to avoid"
+                                               . " losing good content that is 
well sources, is to create a sub-article with all the detail,"
+                                               . " and summarize here per 
[[WP:SUMMARY]]. But deleting useful and well sourced material,"
+                                               . " is not acceptable. We are 
here to build an encyclopedia. - [[User:Cwobeel|<span style="
+                                               . 
"\"color:#339966\">Cwobeel</span>]] [[User_talk:Cwobeel|<span 
style=\"font-size:80%\">"
+                                               . "(talk)</span>]] 16:02, 11 
December 2014 (UTC)"
                                ),
                                // User
                                'Cwobeel',
@@ -897,7 +935,14 @@
                                                'type' => 
'new-section-with-comment',
                                                'content' => '== Grand jury no 
bill reception ==
 
-{{u|Bob K31416}} has started a process of summarizing that section, in a 
manner that I believe it to be counter productive. We have expert opinions from 
legal, law enforcement, politicians, and media outlets all of which are notable 
and informative. [[WP:NOTPAPER|Wikipedia is not paper]] – If the section is too 
long, the correct process to avoid losing good content that is well sources, is 
to create a sub-article with all the detail, and summarize here per 
[[WP:SUMMARY]]. But deleting useful and well sourced material, is not 
acceptable. We are here to build an encyclopedia. - [[User:Cwobeel|<span 
style="color:#339966">Cwobeel</span>]] [[User_talk:Cwobeel|<span 
style="font-size:80%">(talk)</span>]] 16:02, 11 December 2014 (UTC)',
+{{u|Bob K31416}} has started a process of summarizing that section, in a 
manner that I believe'
+. ' it to be counter productive. We have expert opinions from legal, law 
enforcement, politicians,'
+. ' and media outlets all of which are notable and informative. 
[[WP:NOTPAPER|Wikipedia is not'
+. ' paper]] – If the section is too long, the correct process to avoid losing 
good content that'
+. ' is well sources, is to create a sub-article with all the detail, and 
summarize here per'
+. ' [[WP:SUMMARY]]. But deleting useful and well sourced material, is not 
acceptable. We are here'
+. ' to build an encyclopedia. - [[User:Cwobeel|<span 
style="color:#339966">Cwobeel</span>]]'
+. ' [[User_talk:Cwobeel|<span style="font-size:80%">(talk)</span>]] 16:02, 11 
December 2014 (UTC)',
                                        ),
                                ),
                        ),
@@ -1039,7 +1084,9 @@
        }
 
        protected static function signedMessage( $name ) {
-               return ": " . self::message() . " [[User:$name|$name]] ([[User 
talk:$name|talk]]) 00:17, 7 May 2013 (UTC)";
+               return ": "
+                       . self::message()
+                       . " [[User:$name|$name]] ([[User talk:$name|talk]]) 
00:17, 7 May 2013 (UTC)";
        }
 
        protected static function message() {
diff --git a/tests/phpunit/EmailFormatterTest.php 
b/tests/phpunit/EmailFormatterTest.php
index 4e17d10..f75ba4f 100644
--- a/tests/phpunit/EmailFormatterTest.php
+++ b/tests/phpunit/EmailFormatterTest.php
@@ -27,7 +27,12 @@
 
                $this->emailSingle = new EchoEmailSingle( $formatter, $event, 
$user );
 
-               $content[$event->getCategory()][] = 
EchoNotificationController::formatNotification( $event, $user, 'email', 
'emaildigest' );
+               $content[$event->getCategory()][] = 
EchoNotificationController::formatNotification(
+                       $event,
+                       $user,
+                       'email',
+                       'emaildigest'
+               );
                $this->emailDigest = new EchoEmailDigest( User::newFromId( 2 ), 
$content );
        }
 
diff --git a/tests/phpunit/TalkPageFunctionalTest.php 
b/tests/phpunit/TalkPageFunctionalTest.php
index 1077bf5..187d05b 100644
--- a/tests/phpunit/TalkPageFunctionalTest.php
+++ b/tests/phpunit/TalkPageFunctionalTest.php
@@ -38,7 +38,11 @@
 
                // Ensure the proper event was created
                $events = $this->fetchAllEvents();
-               $this->assertCount( 1 + $messageCount, $events, 'After initial 
edit a single event must exist.' ); // +1 is due to 0 index
+               $this->assertCount(
+                       1 + $messageCount, // +1 is due to 0 index
+                       $events,
+                       'After initial edit a single event must exist.'
+               );
                $row = array_shift( $events );
                $this->assertEquals( 'edit-user-talk', $row->event_type );
                $this->assertEventSectionTitle( 'Section 8', $row );
@@ -71,21 +75,37 @@
        protected function assertEventSectionTitle( $sectionTitle, $row ) {
                $this->assertNotNull( $row->event_extra, 'Event must contain 
extra data.' );
                $extra = unserialize( $row->event_extra );
-               $this->assertArrayHasKey( 'section-title', $extra, 'Extra data 
must include a section-title key.' );
-               $this->assertEquals( $sectionTitle, $extra['section-title'], 
'Detected section title must match' );
+               $this->assertArrayHasKey(
+                       'section-title',
+                       $extra,
+                       'Extra data must include a section-title key.'
+               );
+               $this->assertEquals(
+                       $sectionTitle,
+                       $extra['section-title'],
+                       'Detected section title must match'
+               );
        }
 
        /**
         * @return array All events in db sorted from oldest to newest
         */
        protected function fetchAllEvents() {
-               $res = $this->dbr->select( 'echo_event', array( '*' ), array(), 
__METHOD__, array( 'ORDER BY' => 'event_id ASC' ) );
+               $res = $this->dbr->select(
+                       'echo_event',
+                       array( '*' ),
+                       array(),
+                       __METHOD__,
+                       array( 'ORDER BY' => 'event_id ASC' )
+               );
 
                return iterator_to_array( $res );
        }
 
        protected function signedMessage( $name, $content = 'Moar cowbell', 
$depth = 1 ) {
-               return str_repeat( ':', $depth ) . " $content 
[[User:$name|$name]] ([[User talk:$name|$name]]) 00:17, 7 May 2013 (UTC)\n";
+               return str_repeat( ':', $depth )
+                       . " $content [[User:$name|$name]] ([[User 
talk:$name|$name]])"
+                       . " 00:17, 7 May 2013 (UTC)\n";
        }
 
 }
diff --git a/tests/phpunit/controller/NotificationControllerTest.php 
b/tests/phpunit/controller/NotificationControllerTest.php
index ab47b76..62f3d9b 100644
--- a/tests/phpunit/controller/NotificationControllerTest.php
+++ b/tests/phpunit/controller/NotificationControllerTest.php
@@ -67,7 +67,9 @@
        /**
         * @dataProvider evaluateUserLocatorsProvider
         */
-       public function testEvaluateUserLocators( $message, $expect, 
$locatorConfigForEventType, $setup = null ) {
+       public function testEvaluateUserLocators(
+               $message, $expect, $locatorConfigForEventType, $setup = null
+       ) {
                $this->setMwGlobals( array(
                        'wgEchoNotifications' => array(
                                'unit-test' => array(
diff --git a/tests/phpunit/formatters/NotificationFormatterTest.php 
b/tests/phpunit/formatters/NotificationFormatterTest.php
index 143ec4f..1eec2eb 100644
--- a/tests/phpunit/formatters/NotificationFormatterTest.php
+++ b/tests/phpunit/formatters/NotificationFormatterTest.php
@@ -48,8 +48,8 @@
 
        public static function provider_editUserTalk() {
                return array(
-                       // if there is a section-title, the message should be 
'[[User:user_name|user_name]] left a message on
-                       // your talk page in '[[User 
talk:user_name#section_title|section_title]]'
+                       // if there is a section-title, the message should be 
'[[User:user_name|user_name]] left a
+                       // message on your talk page in '[[User 
talk:user_name#section_title|section_title]]'
                        array( '/[[User 
talk:[^#]+#moar_cowbell|moar_cowbell]]/', 'moar_cowbell', 'text' ),
                        array( '/#moar_cowbell/', 'moar_cowbell', 'html' ),
                        array( '/#moar_cowbell/', 'moar_cowbell', 'flyout' ),
@@ -177,11 +177,13 @@
        }
 
        public static function provider_sectionTitle() {
-               $message = "some_section_title"; // underscores simplifies the 
test, since it will transform ' ' to '_'
+               // underscores simplifies the test, since it will transform ' ' 
to '_'
+               $message = "some_section_title";
                $suppressed = wfMessage( 'echo-rev-deleted-text-view' )->text();
 
                $tests = array();
-               $events = array( 'mention' ); // currently only mention uses 
sectionTitle, but likely edit-user-talk will soon as well
+               // currently only mention uses sectionTitle, but likely 
edit-user-talk will soon as well
+               $events = array( 'mention' );
                foreach ( $events as $eventType ) {
                        $tests[] = array( $eventType, $message, $message, 0 );
                        $tests[] = array( $eventType, $suppressed, $message, 
Revision::DELETED_TEXT );
@@ -209,7 +211,9 @@
        /**
         * @dataProvider provider_sectionTitle
         */
-       public function testMentionSubjectSectionTitleSuppression( $eventType, 
$expect, $sectionTitle, $deleted ) {
+       public function testMentionSubjectSectionTitleSuppression(
+               $eventType, $expect, $sectionTitle, $deleted
+       ) {
                $event = $this->mockEvent(
                        $eventType,
                        array( 'section-title' => $sectionTitle ),
@@ -228,7 +232,9 @@
                return EchoNotificationController::formatNotification( $event, 
$user, $format, $type );
        }
 
-       protected function mockEvent( $type, array $extra = array(), Revision 
$rev = null, User $agent = null ) {
+       protected function mockEvent(
+               $type, array $extra = array(), Revision $rev = null, User 
$agent = null
+       ) {
                $methods = get_class_methods( 'EchoEvent' );
                $methods = array_diff( $methods, array( 'userCan', 
'getLinkMessage', 'getLinkDestination' ) );
 
diff --git a/tests/phpunit/gateway/UserNotificationGatewayTest.php 
b/tests/phpunit/gateway/UserNotificationGatewayTest.php
index 0c96d53..673146d 100644
--- a/tests/phpunit/gateway/UserNotificationGatewayTest.php
+++ b/tests/phpunit/gateway/UserNotificationGatewayTest.php
@@ -8,44 +8,77 @@
                $this->assertNull( $gateway->markRead( array() ) );
 
                // successful update
-               $gateway = new EchoUserNotificationGateway( User::newFromId( 1 
), $this->mockMWEchoDbFactory( array( 'update' => true ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       User::newFromId( 1 ),
+                       $this->mockMWEchoDbFactory( array( 'update' => true ) )
+               );
                $this->assertTrue( $gateway->markRead( array( 2 ) ) );
 
                // unsuccessful update
-               $gateway = new EchoUserNotificationGateway( User::newFromId( 1 
), $this->mockMWEchoDbFactory( array( 'update' => false ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       User::newFromId( 1 ),
+                       $this->mockMWEchoDbFactory( array( 'update' => false ) )
+               );
                $this->assertFalse( $gateway->markRead( array( 2 ) ) );
        }
 
        public function testMarkAllRead() {
                // successful update
-               $gateway = new EchoUserNotificationGateway( User::newFromId( 1 
), $this->mockMWEchoDbFactory( array( 'update' => true ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       User::newFromId( 1 ),
+                       $this->mockMWEchoDbFactory( array( 'update' => true ) )
+               );
                $this->assertTrue( $gateway->markAllRead( array( 2 ) ) );
 
                // unsuccessful update
-               $gateway = new EchoUserNotificationGateway( User::newFromId( 1 
), $this->mockMWEchoDbFactory( array( 'update' => false ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       User::newFromId( 1 ),
+                       $this->mockMWEchoDbFactory( array( 'update' => false ) )
+               );
                $this->assertFalse( $gateway->markAllRead( array( 2 ) ) );
        }
 
        public function testGetNotificationCount() {
                // unsuccessful select
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => false ) ) );
-               $this->assertEquals( 0, $gateway->getNotificationCount( 
DB_SLAVE, array( 'event_one' ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
+               $this->assertEquals(
+                       0,
+                       $gateway->getNotificationCount( DB_SLAVE, array( 
'event_one' ) )
+               );
 
                // successful select of alert
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => array( 1, 2 ) ) ) );
-               $this->assertEquals( 2, $gateway->getNotificationCount( 
DB_SLAVE, array( 'event_one', 'event_two' ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => array( 
1, 2 ) ) )
+               );
+               $this->assertEquals(
+                       2,
+                       $gateway->getNotificationCount( DB_SLAVE, array( 
'event_one', 'event_two' ) )
+               );
 
                // there is event, should return 0
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => array( 1, 2 ) ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => array( 
1, 2 ) ) )
+               );
                $this->assertEquals( 0, $gateway->getNotificationCount( 
DB_SLAVE, array() ) );
 
                // successful select
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => array( 1, 2, 3 ) ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => array( 
1, 2, 3 ) ) )
+               );
                $this->assertEquals( 3, $gateway->getNotificationCount( 
DB_SLAVE, array( 'event_one' ) ) );
        }
 
        public function testGetUnreadNotifications() {
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => false ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
                $this->assertEmpty( $gateway->getUnreadNotifications( 
'user_talk' ) );
 
                $dbResult = array(
@@ -53,7 +86,10 @@
                        (object)array( 'notification_event' => 2 ),
                        (object)array( 'notification_event' => 3 ),
                );
-               $gateway = new EchoUserNotificationGateway( $this->mockUser(), 
$this->mockMWEchoDbFactory( array( 'select' => $dbResult ) ) );
+               $gateway = new EchoUserNotificationGateway(
+                       $this->mockUser(),
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$dbResult ) )
+               );
                $res = $gateway->getUnreadNotifications( 'user_talk' );
                $this->assertEquals( $res, array( 1 => 1, 2 => 2, 3 => 3 ) );
        }
diff --git a/tests/phpunit/mapper/EventMapperTest.php 
b/tests/phpunit/mapper/EventMapperTest.php
index f1a4d92..ef400d4 100644
--- a/tests/phpunit/mapper/EventMapperTest.php
+++ b/tests/phpunit/mapper/EventMapperTest.php
@@ -72,8 +72,16 @@
        public function testFetchByUserBundleHash() {
                // Unsuccessful select
                $event = $this->mockEchoEvent();
-               $eventMapper = new EchoEventMapper( $this->mockMWEchoDbFactory( 
array( 'select' => false ) ) );
-               $res = $eventMapper->fetchByUserBundleHash( User::newFromId( 1 
), 'testhash', 'web', 'DESC', 250 );
+               $eventMapper = new EchoEventMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
+               $res = $eventMapper->fetchByUserBundleHash(
+                       User::newFromId( 1 ),
+                       'testhash',
+                       'web',
+                       'DESC',
+                       250
+               );
                $this->assertFalse( $res );
 
                // Successful select
@@ -98,8 +106,16 @@
                                'event_agent_ip' => ''
                        )
                );
-               $eventMapper = new EchoEventMapper( $this->mockMWEchoDbFactory( 
array( 'select' => $dbResult ) ) );
-               $res = $eventMapper->fetchByUserBundleHash( User::newFromId( 1 
), 'testhash', 'web', 'DESC', 250 );
+               $eventMapper = new EchoEventMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$dbResult ) )
+               );
+               $res = $eventMapper->fetchByUserBundleHash(
+                       User::newFromId( 1 ),
+                       'testhash',
+                       'web',
+                       'DESC',
+                       250
+               );
                $this->assertTrue( is_array( $res ) );
                foreach ( $res as $row ) {
                        $this->assertInstanceOf( 'EchoEvent', $row );
diff --git a/tests/phpunit/mapper/NotificationMapperTest.php 
b/tests/phpunit/mapper/NotificationMapperTest.php
index 03fc008..f4d1436 100644
--- a/tests/phpunit/mapper/NotificationMapperTest.php
+++ b/tests/phpunit/mapper/NotificationMapperTest.php
@@ -11,7 +11,9 @@
 
        public function fetchUnreadByUser( User $user, $limit, array 
$eventTypes = array() ) {
                // Unsuccessful select
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'select' => false ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
                $res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, 
'' );
                $this->assertEmpty( $res );
 
@@ -33,11 +35,15 @@
                                'notification_bundle_display_hash' => 
'testdisplayhash'
                        )
                );
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'select' => $dbResult ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$dbResult ) )
+               );
                $res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, 
'', array() );
                $this->assertEmpty( $res );
 
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'select' => $dbResult ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$dbResult ) )
+               );
                $res = $notifMapper->fetchUnreadByUser( $this->mockUser(), 10, 
'', array( 'test_event' ) );
                $this->assertTrue( is_array( $res ) );
                $this->assertGreaterThan( 0, count( $res ) );
@@ -48,7 +54,9 @@
 
        public function testFetchByUser() {
                // Unsuccessful select
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'select' => false ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
                $res = $notifMapper->fetchByUser( $this->mockUser(), 10, '' );
                $this->assertEmpty( $res );
 
@@ -79,7 +87,9 @@
                        ),
                );
 
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'select' => $notifDbResult ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$notifDbResult ) )
+               );
                $res = $notifMapper->fetchByUser( $this->mockUser(), 10, '', 
array() );
                $this->assertEmpty( $res );
 
@@ -96,14 +106,18 @@
                        $this->assertInstanceOf( 'EchoNotification', $row );
                }
 
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array() ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array() )
+               );
                $res = $notifMapper->fetchByUser( $this->mockUser(), 10, '' );
                $this->assertEmpty( $res );
        }
 
        public function testFetchNewestByUserBundleHash() {
                // Unsuccessful select
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'selectRow' => false ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'selectRow' => false 
) )
+               );
                $res = $notifMapper->fetchNewestByUserBundleHash( 
User::newFromId( 1 ), 'testhash' );
                $this->assertFalse( $res );
 
@@ -123,14 +137,18 @@
                        'notification_bundle_hash' => 'testhash',
                        'notification_bundle_display_hash' => 'testdisplayhash'
                );
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'selectRow' => $dbResult ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'selectRow' => 
$dbResult ) )
+               );
                $row = $notifMapper->fetchNewestByUserBundleHash( 
User::newFromId( 1 ), 'testdisplayhash' );
                $this->assertInstanceOf( 'EchoNotification', $row );
        }
 
        public function testFetchByUserOffset() {
                // Unsuccessful select
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'selectRow' => false ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'selectRow' => false 
) )
+               );
                $res = $notifMapper->fetchByUserOffset( User::newFromId( 1 ), 
500 );
                $this->assertFalse( $res );
 
@@ -150,18 +168,24 @@
                        'notification_bundle_hash' => 'testhash',
                        'notification_bundle_display_hash' => 'testdisplayhash'
                );
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( array( 'selectRow' => $dbResult ) ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( array( 'selectRow' => 
$dbResult ) )
+               );
                $row = $notifMapper->fetchNewestByUserBundleHash( 
User::newFromId( 1 ), 500 );
                $this->assertInstanceOf( 'EchoNotification', $row );
        }
 
        public function testDeleteByUserEventOffset() {
                $dbResult = array( 'delete' => true );
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( $dbResult ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( $dbResult )
+               );
                $this->assertTrue( $notifMapper->deleteByUserEventOffset( 
User::newFromId( 1 ), 500 ) );
 
                $dbResult = array( 'delete' => false );
-               $notifMapper = new EchoNotificationMapper( 
$this->mockMWEchoDbFactory( $dbResult ) );
+               $notifMapper = new EchoNotificationMapper(
+                       $this->mockMWEchoDbFactory( $dbResult )
+               );
                $this->assertFalse( $notifMapper->deleteByUserEventOffset( 
User::newFromId( 1 ), 500 ) );
        }
 
diff --git a/tests/phpunit/mapper/TargetPageMapperTest.php 
b/tests/phpunit/mapper/TargetPageMapperTest.php
index 83faeb9..c5cfd33 100644
--- a/tests/phpunit/mapper/TargetPageMapperTest.php
+++ b/tests/phpunit/mapper/TargetPageMapperTest.php
@@ -3,7 +3,9 @@
 class EchoTargetPageMapperTest extends MediaWikiTestCase {
 
        public function testFetchByUserPageId() {
-               $targetMapper = new EchoTargetPageMapper( 
$this->mockMWEchoDbFactory( array( 'select' => false ) ) );
+               $targetMapper = new EchoTargetPageMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => false ) )
+               );
                $res = $targetMapper->fetchByUserPageId( User::newFromId( 1 ), 
1 );
                $this->assertFalse( $res );
 
@@ -19,7 +21,9 @@
                                'etp_event' => 7,
                        )
                );
-               $targetMapper = new EchoTargetPageMapper( 
$this->mockMWEchoDbFactory( array( 'select' => $dbResult ) ) );
+               $targetMapper = new EchoTargetPageMapper(
+                       $this->mockMWEchoDbFactory( array( 'select' => 
$dbResult ) )
+               );
                $res = $targetMapper->fetchByUserPageId( User::newFromId( 1 ), 
2 );
                $this->assertTrue( is_array( $res ) );
                $this->assertCount( 2, $res );
@@ -84,7 +88,10 @@
        public function testDeleteByUserEvents( $deleteResult, $eventIds, 
$result ) {
                $dbResult = array( 'delete' => $deleteResult );
                $targetMapper = new EchoTargetPageMapper( 
$this->mockMWEchoDbFactory( $dbResult ) );
-               $this->assertSame( $targetMapper->deleteByUserEvents( 
User::newFromId( 1 ), $eventIds ), $result );
+               $this->assertSame(
+                       $targetMapper->deleteByUserEvents( User::newFromId( 1 
), $eventIds ),
+                       $result
+               );
        }
 
        public function testDeleteByUser() {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc92d112ae1cfaee3c409b9b936c7f894d32960f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Jforrester <jforres...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to