Jack Phoenix has submitted this change and it was merged.

Change subject: Define __toString() magic method in the wAvatar class
......................................................................


Define __toString() magic method in the wAvatar class

This allows lazy coders to write stuff like $avatar = new wAvatar( 'user
ID', 'l' ); echo $avatar; and have it work as intended. It's also a bit
nicer than dying with a (catchable) fatal error; core Title class does
something similar, for example.

Change-Id: I800f232df18af9bed5b0609689deb31a19042053
---
M UserProfile/AvatarClass.php
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Jack Phoenix: Looks good to me, approved



diff --git a/UserProfile/AvatarClass.php b/UserProfile/AvatarClass.php
index e7139c3..656e09f 100644
--- a/UserProfile/AvatarClass.php
+++ b/UserProfile/AvatarClass.php
@@ -76,4 +76,13 @@
 
                return Html::element( 'img', $params, '' );
        }
+
+       /**
+        * Return a string representation of this avatar object
+        *
+        * @return string Representation of this avatar object
+        */
+       public function __toString() {
+               return $this->getAvatarURL();
+       }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I800f232df18af9bed5b0609689deb31a19042053
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to