Эх сурвалжийг харах

add maintainer avatar_url to package detail JSON

Indra Gunawan 8 жил өмнө
parent
commit
a6273428fc

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

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