Browse Source

add maintainer avatar_url to package detail JSON

Indra Gunawan 8 years ago
parent
commit
a6273428fc
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/Packagist/WebBundle/Entity/User.php

+ 11 - 0
src/Packagist/WebBundle/Entity/User.php

@@ -112,6 +112,7 @@ class User extends BaseUser
     {
     {
         return array(
         return array(
             'name' => $this->getUsername(),
             'name' => $this->getUsername(),
+            'avatar_url' => $this->getGravatarUrl(),
         );
         );
     }
     }
 
 
@@ -264,4 +265,14 @@ class User extends BaseUser
     {
     {
         return $this->failureNotifications;
         return $this->failureNotifications;
     }
     }
+
+    /**
+     * Get Gravatar Url
+     *
+     * @return string
+     */
+    public function getGravatarUrl()
+    {
+        return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->getEmail()));
+    }
 }
 }