From 23f8d37bcd0c291a45ad07f1c17ef386496dd203 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 19 Dec 2021 07:39:39 +0000 Subject: [PATCH] Use dynamic function --- src/Factory/Api/Twitter/DirectMessage.php | 24 ++--------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/Factory/Api/Twitter/DirectMessage.php b/src/Factory/Api/Twitter/DirectMessage.php index 9ee655f04..f2a4771d3 100644 --- a/src/Factory/Api/Twitter/DirectMessage.php +++ b/src/Factory/Api/Twitter/DirectMessage.php @@ -25,8 +25,6 @@ use Friendica\BaseFactory; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; use Friendica\Database\Database; -use Friendica\Database\DBA; -use Friendica\Factory\Api\Friendica\Activities; use Friendica\Factory\Api\Twitter\User as TwitterUser; use Friendica\Model\Contact; use Friendica\Network\HTTPException; @@ -38,30 +36,12 @@ class DirectMessage extends BaseFactory private $dba; /** @var twitterUser entity */ private $twitterUser; - /** @var Hashtag entity */ - private $hashtag; - /** @var Media entity */ - private $media; - /** @var Url entity */ - private $url; - /** @var Mention entity */ - private $mention; - /** @var Activities entity */ - private $activities; - /** @var Activities entity */ - private $attachment; - public function __construct(LoggerInterface $logger, Database $dba, TwitterUser $twitteruser, Hashtag $hashtag, Media $media, Url $url, Mention $mention, Activities $activities, Attachment $attachment) + public function __construct(LoggerInterface $logger, Database $dba, TwitterUser $twitteruser) { parent::__construct($logger); $this->dba = $dba; $this->twitterUser = $twitteruser; - $this->hashtag = $hashtag; - $this->media = $media; - $this->url = $url; - $this->mention = $mention; - $this->activities = $activities; - $this->attachment = $attachment; } /** @@ -77,7 +57,7 @@ class DirectMessage extends BaseFactory */ public function createFromMailId(int $id, int $uid, string $text_mode = ''): \Friendica\Object\Api\Twitter\DirectMessage { - $mail = DBA::selectFirst('mail', [], ['id' => $id, 'uid' => $uid]); + $mail = $this->dba->selectFirst('mail', [], ['id' => $id, 'uid' => $uid]); if (!$mail) { throw new HTTPException\NotFoundException('Direct message with ID ' . $mail . ' not found.'); }