*/ class UserPresenter extends BasePresenter implements Arrayable { /** * Returns the users avatar. * * @return string */ public function avatar() { if (Config::get('setting.enable_external_dependencies')) { return sprintf('https://www.gravatar.com/avatar/%s?size=%d', md5(strtolower($this->email)), 200); } return Avatar::create($this->username)->toBase64(); } /** * Convert the presenter instance to an array. * * @return string[] */ public function toArray() { return array_merge($this->wrappedObject->toArray(), [ 'avatar' => $this->avatar(), ]); } }