. * */ namespace Friendica\Moderation\Factory; use Friendica\Capabilities\ICanCreateFromTableRow; use Friendica\Moderation\Entity; class Report extends \Friendica\BaseFactory implements ICanCreateFromTableRow { /** * @param array $row `report` table row * @param array $postUriIds List of post URI ids from the `report-post` table * @return Entity\Report * @throws \Exception */ public function createFromTableRow(array $row, array $postUriIds = []): Entity\Report { return new Entity\Report( $row['uid'], $row['cid'], new \DateTime($row['created'] ?? 'now', new \DateTimeZone('UTC')), $row['comment'], $row['forward'], $postUriIds, $row['id'], ); } /** * Creates a Report entity from a Mastodon API /reports request * * @see \Friendica\Module\Api\Mastodon\Reports::post() * * @param int $uid * @param int $cid * @param string $comment * @param bool $forward * @param array $postUriIds * @return Entity\Report * @throws \Exception */ public function createFromReportsRequest(int $uid, int $cid, string $comment = '', bool $forward = false, array $postUriIds = []): Entity\Report { return new Entity\Report( $uid, $cid, new \DateTime('now', new \DateTimeZone('UTC')), $comment, $forward, $postUriIds, ); } }