From ec5d3e55c7b13d894de7e84ab766cf79251b8678 Mon Sep 17 00:00:00 2001 From: Art4 Date: Thu, 28 Nov 2024 08:04:53 +0000 Subject: [PATCH] Use Status object in User object --- src/Factory/Api/Twitter/User.php | 2 +- src/Object/Api/Twitter/User.php | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Factory/Api/Twitter/User.php b/src/Factory/Api/Twitter/User.php index 71721f143b..8ffe07f10e 100644 --- a/src/Factory/Api/Twitter/User.php +++ b/src/Factory/Api/Twitter/User.php @@ -57,7 +57,7 @@ class User extends BaseFactory ['author-id' => $publicContact['id'], 'gravity' => [Item::GRAVITY_COMMENT, Item::GRAVITY_PARENT], 'private' => [Item::PUBLIC, Item::UNLISTED]], ['order' => ['uri-id' => true]]); if (!empty($post['uri-id'])) { - $status = $this->status->createFromUriId($post['uri-id'], $uid)->toArray(); + $status = $this->status->createFromUriId($post['uri-id'], $uid); } } diff --git a/src/Object/Api/Twitter/User.php b/src/Object/Api/Twitter/User.php index 7a3a2b4622..151a968bff 100644 --- a/src/Object/Api/Twitter/User.php +++ b/src/Object/Api/Twitter/User.php @@ -117,12 +117,11 @@ class User extends BaseDataTransferObject * @param array $publicContact Full contact table record with uid = 0 * @param array $apcontact Optional full apcontact table record * @param array $userContact Optional full contact table record with uid != 0 - * @param array $status * @param bool $include_user_entities Whether to add the entities property * * @throws InternalServerErrorException */ - public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], ?array $status = null, bool $include_user_entities = true) + public function __construct(array $publicContact, array $apcontact = [], array $userContact = [], ?Status $status = null, bool $include_user_entities = true) { $uid = $userContact['uid'] ?? 0; @@ -156,10 +155,10 @@ class User extends BaseDataTransferObject $this->default_profile = false; $this->default_profile_image = false; - if (is_array($status)) { - $this->status = $status; - } else { + if ($status === null) { unset($this->status); + } else { + $this->status = $status->toArray(); } // Unused optional fields