Bsitu has uploaded a new change for review.

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


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, 22 insertions(+), 4 deletions(-)


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

diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index ac1721d..1830f97 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -125,8 +125,8 @@
                ) . $output;
 
                // Add the hidden dismiss interface if the notification is 
dismissable
-               if ( !isset( $wgEchoEventDetails[$event->type]['nodismiss'] )
-                       || !in_array( 'web', 
$wgEchoEventDetails[$event->type]['nodismiss'] ) )
+               if ( !isset( 
$wgEchoEventDetails[$event->getType()]['nodismiss'] )
+                       || !in_array( 'web', 
$wgEchoEventDetails[$event->getType()]['nodismiss'] ) )
                {
                        $output .= $this->formatDismissInterface( $event, $user 
);
                }
@@ -182,7 +182,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();
                $dismiss = wfMessage( 'echo-dismiss-message', $dismissTitle )
diff --git a/model/Event.php b/model/Event.php
index 8fc709c..d60f1a4 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;
        /**
@@ -261,26 +261,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: newchange
Gerrit-Change-Id: I26b20e6b211a7dbfa96cf57eb87621698015646e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>

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

Reply via email to