. // }}} /** * 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; use ActivityPhp\Type\AbstractObject; use Symfony\Component\HttpFoundation\JsonResponse; /** * TypeResponse represents an HTTP response in application/ld+json format. * * @copyright 2021 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ class TypeResponse extends JsonResponse { /** * Provides a response in application/ld+json for ActivityStreams 2.0 Types * * @param null|AbstractObject|string $json * @param int $status The response status code */ public function __construct(string|AbstractObject|null $json = null, int $status = 202) { parent::__construct( data: \is_object($json) ? $json->toJson() : $json, status: $status, headers: ['content-type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'], json: true, ); } }