. * */ namespace Friendica\Factory\Api\Mastodon; use Friendica\BaseFactory; use Friendica\Database\Database; use Friendica\Network\HTTPException\InternalServerErrorException; use Psr\Log\LoggerInterface; class ListEntity extends BaseFactory { /** @var Database */ private $dba; public function __construct(LoggerInterface $logger, Database $dba) { parent::__construct($logger); $this->dba = $dba; } /** * @throws InternalServerErrorException */ public function createFromGroupId(int $id): \Friendica\Object\Api\Mastodon\ListEntity { $group = $this->dba->selectFirst('group', ['name'], ['id' => $id, 'deleted' => false]); return new \Friendica\Object\Api\Mastodon\ListEntity($id, $group['name'] ?? '', 'list'); } }