. // }}} /** * ActivityPub implementation for GNU social * * @package GNUsocial * @category ActivityPub * @author Diogo Peralta Cordeiro <@diogo.site> * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ namespace Plugin\ActivityPub\Util\Response; use App\Entity\Activity as GSActivity; use App\Util\Exception\ClientException; use Plugin\ActivityPub\Util\Model\Activity as ModelActivity; use Plugin\ActivityPub\Util\TypeResponse; /** * Provides a response in application/ld+json to GSActivity * * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ abstract class ActivityResponse { /** * Provides a response in application/ld+json to GSActivity * * @param GSActivity $activity * @param int $status The response status code * @return TypeResponse * @throws ClientException */ public static function handle(GSActivity $activity, int $status = 200): TypeResponse { return new TypeResponse(json: ModelActivity::toJson($activity), status: $status); } }