Matthias Mullie has submitted this change and it was merged.

Change subject: Keep instance variable 'type' the same visibility as the others
......................................................................


Keep instance variable 'type' the same visibility as the others

1. Keep it as protected like the rest of the variables and there is an accessor 
method getType() for external access

2. Add some more documentation

Change-Id: I26b20e6b211a7dbfa96cf57eb87621698015646e
---
M formatters/BasicFormatter.php
M model/Event.php
2 files changed, 21 insertions(+), 3 deletions(-)

Approvals:
  Matthias Mullie: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index 9590ba4..1789ead 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -129,7 +129,7 @@
                ) . $output;
 
                // Add the hidden dismiss interface if the notification is 
dismissable
-               $category = 
EchoNotificationController::getNotificationCategory( $event->type );
+               $category = 
EchoNotificationController::getNotificationCategory( $event->getType() );
                if ( isset( 
$wgEchoNotificationCategories[$category]['no-dismiss'] ) ) {
                        $noDismiss = 
$wgEchoNotificationCategories[$category]['no-dismiss'];
                } else {
@@ -172,7 +172,7 @@
         * @return string
         */
        protected function formatDismissInterface( $event, $user ) {
-               $dismissTitle = wfMessage( 'echo-dismiss-title-' . $event->type 
)
+               $dismissTitle = wfMessage( 'echo-dismiss-title-' . 
$event->getType() )
                        ->inLanguage( $user->getOption( 'language' ) )
                        ->escaped();
                $dismissMessage = wfMessage( 'echo-dismiss-message', 
$dismissTitle )
diff --git a/model/Event.php b/model/Event.php
index ceb181a..6a6915d 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -6,7 +6,7 @@
  * A user's subscriptions determine what Notifications they receive.
  */
 class EchoEvent {
-       public $type = null;
+       protected $type = null;
        protected $id = null;
        protected $variant = null;
        /**
@@ -240,26 +240,44 @@
        }
 
        ## Accessors
+       /**
+        * @return int
+        */
        public function getId() {
                return $this->id;
        }
 
+       /**
+        * @return string
+        */
        public function getTimestamp() {
                return $this->timestamp;
        }
 
+       /**
+        * @return string
+        */
        public function getType() {
                return $this->type;
        }
 
+       /**
+        * @return string
+        */
        public function getVariant() {
                return $this->variant;
        }
 
+       /**
+        * @return array|null
+        */
        public function getExtra() {
                return $this->extra;
        }
 
+       /**
+        * @return User
+        */
        public function getAgent() {
                return $this->agent;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I26b20e6b211a7dbfa96cf57eb87621698015646e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to