From: Michael Date: Wed, 15 Mar 2023 03:55:39 +0000 (+0000) Subject: Changes because of code review X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7dd9972b8515a895bc289a8c8d64bdf2d41d5358;p=friendica.git Changes because of code review --- diff --git a/src/Factory/Api/Mastodon/Attachment.php b/src/Factory/Api/Mastodon/Attachment.php index 2b53ae67d9..afc2f7c271 100644 --- a/src/Factory/Api/Mastodon/Attachment.php +++ b/src/Factory/Api/Mastodon/Attachment.php @@ -59,10 +59,10 @@ class Attachment extends BaseFactory /** * @param int $id id of the media - * @return array + * @return \Friendica\Object\Api\Mastodon\Attachment * @throws HTTPException\InternalServerErrorException */ - public function createFromId(int $id): array + public function createFromId(int $id): \Friendica\Object\Api\Mastodon\Attachment { $attachment = Post\Media::getById($id); if (empty($attachment)) { @@ -73,10 +73,10 @@ class Attachment extends BaseFactory /** * @param array $attachment - * @return array + * @return \Friendica\Object\Api\Mastodon\Attachment * @throws HTTPException\InternalServerErrorException */ - private function createFromMediaArray(array $attachment): array + private function createFromMediaArray(array $attachment): \Friendica\Object\Api\Mastodon\Attachment { $filetype = !empty($attachment['mimetype']) ? strtolower(substr($attachment['mimetype'], 0, strpos($attachment['mimetype'], '/'))) : ''; @@ -106,8 +106,7 @@ class Attachment extends BaseFactory } } - $object = new \Friendica\Object\Api\Mastodon\Attachment($attachment, $type, $url, $preview, $remote); - return $object->toArray(); + return new \Friendica\Object\Api\Mastodon\Attachment($attachment, $type, $url, $preview, $remote); } /**