From d9d30d9555c88b197202d1e058eddabcb061eb8e Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Fri, 25 Jun 2021 20:00:59 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Hypolite Petovan --- src/Model/Contact.php | 8 ++++---- src/Object/Api/Mastodon/Account.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Model/Contact.php b/src/Model/Contact.php index fad1db347..dc7848278 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1668,9 +1668,9 @@ class Contact * @param integer $cid contact id * @return string avatar link */ - public static function getAvatarForContact(int $cid):string + public static function getAvatarUrlForId(int $cid):string { - return DI::baseUrl() . '/photo/contact/'. $cid; + return DI::baseUrl() . '/photo/contact/' . $cid; } /** @@ -1679,9 +1679,9 @@ class Contact * @param integer $cid contact id * @return string header link */ - public static function getHeaderForContact(int $cid):string + public static function getHeaderUrlForId(int $cid):string { - return DI::baseUrl() . '/photo/header/'. $cid; + return DI::baseUrl() . '/photo/header/' . $cid; } /** diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index b34af7951..2ea9da704 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -112,9 +112,9 @@ class Account extends BaseDataTransferObject $this->note = BBCode::convert($publicContact['about'], false); $this->url = $publicContact['url']; - $this->avatar = (($userContact['photo'] ?? '') ?: $publicContact['photo']) ?: Contact::getAvatarForContact(($userContact['id'] ?? 0) ?: $publicContact['id']); + $this->avatar = $userContact['photo'] ?? '' ?: $publicContact['photo'] ?: Contact::getAvatarUrlForId($userContact['id'] ?? 0 ?: $publicContact['id']); $this->avatar_static = $this->avatar; - $this->header = Contact::getHeaderForContact(($userContact['id'] ?? 0) ?: $publicContact['id']); + $this->header = Contact::getHeaderUrlForId($userContact['id'] ?? 0 ?: $publicContact['id']); $this->header_static = $this->header; $this->followers_count = $apcontact['followers_count'] ?? 0; $this->following_count = $apcontact['following_count'] ?? 0;