. * */ namespace Friendica\Factory\Api\Mastodon; use Friendica\App\BaseURL; use Friendica\BaseFactory; use Friendica\Model\Tag as TagModel; use Friendica\Network\HTTPException; use Friendica\Repository\ProfileField; use Psr\Log\LoggerInterface; class Tag extends BaseFactory { /** @var BaseURL */ protected $baseUrl; /** @var ProfileField */ protected $profileField; /** @var Field */ protected $mstdnField; public function __construct(LoggerInterface $logger, BaseURL $baseURL, ProfileField $profileField, Field $mstdnField) { parent::__construct($logger); $this->baseUrl = $baseURL; $this->profileField = $profileField; $this->mstdnField = $mstdnField; } /** * @param int $uriId Uri-ID of the item * @return array * @throws HTTPException\InternalServerErrorException * @throws \ImagickException */ public function createFromUriId(int $uriId) { $hashtags = []; $tags = TagModel::getByURIId($uriId, [TagModel::HASHTAG]); foreach ($tags as $tag) { $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $tag); $hashtags[] = $hashtag->toArray(); } return $hashtags; } }